I want to use logstash to collect a log file, and the format of the file was like this:
type=USER_START msg=audit(1404170401.294:157): user pid=29228 uid=0 auid=0 ses=7972 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Which filter should i use to match the line? or there is another way to handle it.
Any help would be appreciated.
Used the pattern below to match the line with grok debugger , but still got a No matches
message.
type=%{WORD:audit_type} msg=audit\(%{NUMBER:audit_epoch}:%{NUMBER:audit_counter}\): user pid=%{NUMBER:audit_pid} uid=%{NUMBER:audit_uid} auid=%{NUMBER:audit_audid} subj=%{WORD:audit_subject} msg=%{GREEDYDATA:audit_message}
But when i removed subj=%{WORD:audit_subject} msg=%{GREEDYDATA:audit_message}
, it successed and got a JSON object like this.
{
"audit_type": [
[
"USER_END"
]
],
"audit_epoch": [
[
"1404175981.491"
]
],
"BASE10NUM": [
[
"1404175981.491",
"524",
"1465",
"0",
"0"
]
],
"audit_counter": [
[
"524"
]
],
"audit_pid": [
[
"1465"
]
],
"audit_uid": [
[
"0"
]
],
"audit_audid": [
[
"0"
]
]
}
Don't know why subj
and msg
can't work on.