.TH AUSEARCH: "8" "Sept 2009" "Red Hat" "System Administration Utilities" .SH NAME ausearch \- a tool to query audit daemon logs .SH SYNOPSIS .B ausearch .RI [ options ] .SH DESCRIPTION \fBausearch\fP is a tool that can query the audit daemon logs based for events based on different search criteria. The ausearch utility can also take input from stdin as long as the input is the raw log data. Each commandline option given forms an "and" statement. For example, searching with \fB\-m\fP and \fB\-ui\fP means return events that have both the requested type and match the user id given. An exception is the \fB\-n\fP option; multiple nodes are allowed in a search which will return any matching node. It should also be noted that each syscall excursion from user space into the kernel and back into user space has one event ID that is unique. Any auditable event that is triggered during this trip share this ID so that they may be correlated. Different parts of the kernel may add supplemental records. For example, an audit event on the syscall "open" will also cause the kernel to emit a PATH record with the file name. The ausearch utility will present all records that make up one event together. This could mean that even though you search for a specific kind of record, the resulting events may contain SYSCALL records. Also be aware that not all record types have the requested information. For example, a PATH record does not have a hostname or a loginuid. .SH OPTIONS .TP .BR \-a ,\ \-\-event \ \fIaudit-event-id\fP Search for an event based on the given \fIevent ID\fP. Messages always start with something like msg=audit(1116360555.329:2401771). The event ID is the number after the ':'. All audit events that are recorded from one application's syscall have the same audit event ID. A second syscall made by the same application will have a different event ID. This way they are unique. .TP .BR \-c ,\ \-\-comm \ \fIcomm-name\fP Search for an event based on the given \fIcomm name\fP. The comm name is the executable's name from the task structure. .TP .BR \-e,\ \-\-exit \ \fIexit-code-or-errno\fP Search for an event based on the given syscall \fIexit code or errno\fP. .TP .BR \-f ,\ \-\-file \ \fIfile-name\fP Search for an event based on the given \fIfilename\fP. .TP .BR \-ga ,\ \-\-gid\-all \ \fIall-group-id\fP Search for an event with either effective group ID or group ID matching the given \fIgroup ID\fP. .TP .BR \-ge ,\ \-\-gid\-effective \ \fIeffective-group-id\fP Search for an event with the given \fIeffective group ID\fP or group name. .TP .BR \-gi ,\ \-\-gid \ \fIgroup-id\fP Search for an event with the given \fIgroup ID\fP or group name. .TP .BR \-h ,\ \-\-help Help .TP .BR \-hn ,\ \-\-host \ \fIhost-name\fP Search for an event with the given \fIhost name\fP. The hostname can be either a hostname, fully qualified domain name, or numeric network address. No attempt is made to resolve numeric addresses to domain names or aliases. .TP .BR \-i ,\ \-\-interpret Interpret numeric entities into text. For example, uid is converted to account name. The conversion is done using the current resources of the machine where the search is being run. If you have renamed the accounts, or don't have the same accounts on your machine, you could get misleading results. .TP .BR \-if ,\ \-\-input \ \fIfile-name\fP Use the given \fIfile\fP instead of the logs. This is to aid analysis where the logs have been moved to another machine or only part of a log was saved. .TP .BR \-\-input\-logs Use the log file location from auditd.conf as input for searching. This is needed if you are using ausearch from a cron job. .TP .BR \-\-just\-one Stop after emitting the first event that matches the search criteria. .TP .BR \-k ,\ \-\-key \ \fIkey-string\fP Search for an event based on the given \fIkey string\fP. .TP .BR \-l ,\ \-\-line\-buffered Flush output on every line. Most useful when stdout is connected to a pipe and the default block buffering strategy is undesirable. May impose a performance penalty. .TP .BR \-m ,\ \-\-message \ \fImessage-type\fP\ |\ \fIcomma-sep-message-type-list\fP Search for an event matching the given \fImessage type\fP. You may also enter a \fIcomma separated list of message types\fP. There is an \fBALL\fP message type that doesn't exist in the actual logs. It allows you to get all messages in the system. The list of valid messages types is long. The program will display the list whenever no message type is passed with this parameter. The message type can be either text or numeric. If you enter a list, there can be only commas and no spaces separating the list. .TP .BR \-n ,\ \-\-node \ \fInode-name\fP Search for events originating from \fInode name\fP string. Multiple nodes are allowed, and if any nodes match, the event is matched. .TP .BR \-o ,\ \-\-object \ \fISE-Linux-context-string\fP Search for event with \fItcontext\fP (object) matching the string. .TP .BR \-p ,\ \-\-pid \ \fIprocess-id\fP Search for an event matching the given \fIprocess ID\fP. .TP .BR \-pp ,\ \-\-ppid \ \fIparent-process-id\fP Search for an event matching the given \fIparent process ID\fP. .TP .BR \-r ,\ \-\-raw Output is completely unformatted. This is useful for extracting records that can still be interpretted by audit tools. .TP .BR \-sc ,\ \-\-syscall \ \fIsyscall-name-or-value\fP Search for an event matching the given \fIsyscall\fP. You may either give the numeric syscall value or the syscall name. If you give the syscall name, it will use the syscall table for the machine that you are using. .TP .BR \-se ,\ \-\-context \ \fISE-Linux-context-string\fP Search for event with either \fIscontext\fP/subject or \fItcontext\fP/object matching the string. .TP .BR \-\-session \ \fILogin-Session-ID\fP Search for events matching the given Login Session ID. This process attribute is set when a user logs in and can tie any process to a particular user login. .TP .BR \-su ,\ \-\-subject \ \fISE-Linux-context-string\fP Search for event with \fIscontext\fP (subject) matching the string. .TP .BR \-sv ,\ \-\-success \ \fIsuccess-value\fP Search for an event matching the given \fIsuccess value\fP. Legal values are .B yes and .BR no . .TP .BR \-te ,\ \-\-end \ [\fIend-date\fP]\ [\fIend-time\fP] Search for events with time stamps equal to or before the given end time. The format of end time depends on your locale. If the date is omitted, .B today is assumed. If the time is omitted, .B now is assumed. Use 24 hour clock time rather than AM or PM to specify time. An example date using the en_US.utf8 locale is 09/03/2009. An example of time is 18:00:00. The date format accepted is influenced by the LC_TIME environmental variab le. You may also use the word: \fBnow\fP, \fBrecent\fP, \fBtoday\fP, \fByesterday\fP, \fBthis\-week\fP, \fBweek\-ago\fP, \fBthis\-month\fP, \fBthis\-year\fP. \fBToday\fP means starting now. \fBRecent\fP is 10 minutes ago. \fBYesterday\fP is 1 second after midnight the previous day. \fBThis\-week\fP means starting 1 second after midnight on day 0 of the week determined by your locale (see \fBlocaltime\fP). \fBThis\-month\fP means 1 second after midnight on day 1 of the month. \fBThis\-year\fP means the 1 second after midnight on the first day of the first month. .TP .BR \-ts ,\ \-\-start \ [\fIstart-date\fP]\ [\fIstart-time\fP] Search for events with time stamps equal to or after the given end time. The format of end time depends on your locale. If the date is omitted, .B today is assumed. If the time is omitted, .B midnight is assumed. Use 24 hour clock time rather than AM or PM to specify time. An example date using the en_US.utf8 locale is 09/03/2009. An example of time is 18:00:00. The date format accepted is influenced by the LC_TIME environmental variable. You may also use the word: \fBnow\fP, \fBrecent\fP, \fBtoday\fP, \fByesterday\fP, \fBthis\-week\fP, \fBthis\-month\fP, \fBthis\-year\fP. \fBToday\fP means starting at 1 second after midnight. \fBRecent\fP is 10 minutes ago. \fBYesterday\fP is 1 second after midnight the previous day. \fBThis\-week\fP means starting 1 second after midnight on day 0 of the week determined by your locale (see \fBlocaltime\fP). \fBThis\-month\fP means 1 second after midnight on day 1 of the month. \fBThis\-year\fP means the 1 second after midnight on the first day of the first month. .TP .BR \-tm ,\ \-\-terminal \ \fIterminal\fP Search for an event matching the given \fIterminal\fP value. Some daemons such as cron and atd use the daemon name for the terminal. .TP .BR \-ua ,\ \-\-uid\-all \ \fIall-user-id\fP Search for an event with either user ID, effective user ID, or login user ID (auid) matching the given \fIuser ID\fP. .TP .BR \-ue ,\ \-\-uid\-effective \ \fIeffective-user-id\fP Search for an event with the given \fIeffective user ID\fP. .TP .BR \-ui ,\ \-\-uid \ \fIuser-id\fP Search for an event with the given \fIuser ID\fP. .TP .BR \-ul ,\ \-\-loginuid \ \fIlogin-id\fP Search for an event with the given \fIlogin user ID\fP. All entry point programs that are pamified need to be configured with pam_loginuid required for the session for searching on loginuid (auid) to be accurate. .TP .BR \-v ,\ \-\-version Print the version and exit .TP .BR \-w ,\ \-\-word String based matches must match the whole word. This category of matches include: filename, hostname, terminal, and SE Linux context. .TP .BR \-x ,\ \-\-executable \ \fIexecutable\fP Search for an event matching the given \fIexecutable\fP name. .SH "SEE ALSO" .BR auditd (8), .BR pam_loginuid (8).