Skip to content

Commit fc64377

Browse files
authored
Merge pull request #17 from wpoely86/pixiu
Add patterns for pixiu (AB#14630)
2 parents 92fde40 + 7d58896 commit fc64377

File tree

5 files changed

+83
-2
lines changed

5 files changed

+83
-2
lines changed

files/pixiu

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PIXIU_BASH \s*%{IPORHOST:syslog_hostname} \[%{PROG:program}\]: \[%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} %{USERNAME} %{GREEDYDATA:command}\] return code=\[%{INT:return_code:int}\], execute (success|failed) by \[%{USERNAME:username}\(uid=%{INT:uid:int}\)\] from \[%{DATA:terminal} \(%{IPORHOST:source_ip}\)\]
2+
3+
PIXIU_APACHE \[%{HTTPDATE:timestamp}\] %{IPORHOST:clientip} %{HTTPDUSER:auth} %{WORD:verb} %{NOTSPACE:request} %{GREEDYDATA:other}
4+
5+
PIXIU_NGINX \s*%{IPORHOST:syslog_hostname} %{SYSLOGPROG} %{IPORHOST:clientip} - %{HTTPDUSER:auth}\s+\[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response:int} %{GREEDYDATA:other}
6+
7+
PIXIU_TOMCAT \s*%{IPORHOST:syslog_hostname} %{SYSLOGPROG} \[%{HTTPDATE:timestamp}\]\^%{IPORHOST:clientip}\^%{HTTPDUSER:auth}\^%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\^%{GREEDYDATA:other}

tests/data/pixiu

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
data = [
2+
{
3+
# LogFormat "%t %a %u %m %U %{User-Agent}i %{Referer}i %{X-Forwarded-For}i %{Content-Type}i %{Accept-Language}i %{Accept}i %{Accept-Encoding}i %>s %b %T" syslog
4+
"raw": "<85>Oct 17 12:48:49 C4STO01-Node2 apache[3984033]: [17/Oct/2022:12:48:49 +0200] 127.0.0.1 - GET /api/v2/aa/current_session curl/7.69.1 - - - - */* - 200 201 0",
5+
"expected": {
6+
"@source_host": "C4STO01-Node2",
7+
"program": "apache",
8+
"clientip": "127.0.0.1",
9+
"verb": "GET",
10+
"request": "/api/v2/aa/current_session",
11+
},
12+
},
13+
{
14+
# log_format main '$remote_addr - $log_remote_user [$time_local] "$log_request" $status "$request_time" '
15+
# '$body_bytes_sent "$log_http_referer" "$log_http_user_agent" "$log_http_x_forwarded_for" '
16+
# '$upstream_addr $upstream_status "$upstream_response_time" '
17+
# '"$log_x_auth_token" "$log_x_csrf_token" "$log_cookie_x_auth_token" "$x_real_ip" '
18+
# '"$log_content_type" "$log_http_accept_language" "$log_http_accept" "$log_http_accept_encoding" ';
19+
"raw": '<174>Oct 17 12:50:42 HKSTO03-Node1 nginx 127.0.0.1 - - [17/Oct/2022:12:50:42 +0200] "GET /dsware/service/cluster/storagepool/query*** HTTP/1.1" 200 "0.062" 924 "-" "Apache-HttpClient/5.1 (Java/1.8.0_322)" "-" 127.0.0.1:9527 200 "0.064" "********" "********" "********" "127.0.0.1" "application/json;charset=UTF-8" "-" "-" "gzip, x-gzip, deflate"',
20+
"expected": {
21+
"@source_host": "HKSTO03-Node1",
22+
"program": "nginx",
23+
"clientip": "127.0.0.1",
24+
"verb": "GET",
25+
"request": "/dsware/service/cluster/storagepool/query***",
26+
"response": 200,
27+
},
28+
},
29+
{
30+
"raw": "<174>Oct 17 13:05:07 C4STO01-Node2 [/bin/bash]: [2022-10-17 13:05:07 root cat httpd.conf] return code=[0], execute success by [root(uid=0)] from [pts/0 (172.18.124.57)]",
31+
"expected": {
32+
"@source_host": "C4STO01-Node2",
33+
"program": "/bin/bash",
34+
"username": "root",
35+
"command": "cat httpd.conf",
36+
"return_code": 0,
37+
"uid": 0,
38+
"source_ip": "172.18.124.57",
39+
"terminal": "pts/0",
40+
},
41+
},
42+
{
43+
"raw": "<166>Oct 19 09:08:25 C4STO01-Node2 tomcat [19/Oct/2022:09:08:17 +0200]^127.0.0.1^-^GET /dsware/service/noAuth/managerStatus HTTP/1.1^curl/7.69.1^-^-^application/json^-^*/*^-^200^36^0.002^",
44+
"expected": {
45+
"@source_host": "C4STO01-Node2",
46+
"program": "tomcat",
47+
"clientip": "127.0.0.1",
48+
"verb": "GET",
49+
"request": "/dsware/service/noAuth/managerStatus",
50+
},
51+
},
52+
]

tests/data/su

+10
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,14 @@ data = [
6868
'su_user': 'vsc43020',
6969
}
7070
},
71+
{
72+
"raw": "<37>Oct 10 11:52:35 C4STO01-Node2 su[3984121]: (to storage) root on none",
73+
"expected": {
74+
'program': 'su',
75+
'@source_host': 'C4STO01-Node2',
76+
'su_user': 'root',
77+
'su_tty': 'none',
78+
'su_to': 'storage',
79+
}
80+
},
7181
]

tests/data/sudo

+12
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,16 @@ data = [
3333
"sudo_command": "/usr/bin/ls",
3434
},
3535
},
36+
{
37+
"raw": "<85>Oct 10 11:52:35 C4STO01-Node2 sudo[3984032]: ha_omm : TTY=unknown ; PWD=/opt/dfv/oam/oam-u/ha/ha/module/hacom/bin ; USER=root ; COMMAND=../../../module/harm/plugin/script/harm_mgr.sh floatIP.sh status active key1=value1; 0 ha2",
38+
"expected": {
39+
"@source_host": "C4STO01-Node2",
40+
"program": "sudo",
41+
"sudo_pwd": "/opt/dfv/oam/oam-u/ha/ha/module/hacom/bin",
42+
"sudo_runas": "root",
43+
"sudo_tty": "unknown",
44+
"sudo_user": "ha_omm",
45+
"sudo_command": "../../../module/harm/plugin/script/harm_mgr.sh floatIP.sh status active key1=value1; 0 ha2",
46+
},
47+
},
3648
]

tests/logstash_7.6.2.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ filter {
1616

1717
match => {
1818
# RSYSLOGCUSTOM always last (and no PREFIX)!
19-
"message" => ["%{RSYSLOGPREFIX}%{SU_MSG}", "%{RSYSLOGPREFIX}%{SUDO_MSG}", "%{RSYSLOGPREFIX}%{REFRAME_MSG}", "%{RSYSLOGPREFIX}%{BASH_MSG}", "%{RSYSLOGPREFIX}%{FAIL2BAN_MSG}", "%{RSYSLOGPREFIX}%{SINGULARITY_MSG}", "%{RSYSLOGPREFIX}%{DHCPD_MSG}", "%{RSYSLOGPREFIX}%{SSH_MSG}", "%{RSYSLOGPREFIX}%{MODULECMD_MSG}", "%{RSYSLOGPREFIX}%{LMOD_MSG}", "%{RSYSLOGPREFIX}%{NFS_MSG}", "%{RSYSLOGPREFIX}%{CEPH_MSG}", "%{RSYSLOGPREFIX}%{OPENNEBULA_MSG}", "%{RSYSLOGPREFIX}%{JUBE_MSG}", "%{RSYSLOGPREFIX}%{SHOREWALL_MSG}", "%{RSYSLOGPREFIX}%{KEYVALUE_MSG}", "%{RSYSLOGPREFIX}%{QUATTOR_MSG}", "%{RSYSLOGPREFIX}%{SNOOPY_MSG}", "%{RSYSLOGCUSTOM}"]
19+
"message" => ["%{RSYSLOGCUSTOMHEADER}%{PIXIU_BASH}", "%{RSYSLOGCUSTOMHEADER}%{PIXIU_NGINX}", "%{RSYSLOGCUSTOMHEADER}%{PIXIU_TOMCAT}", "%{RSYSLOGPREFIX}%{PIXIU_APACHE}", "%{RSYSLOGPREFIX}%{SU_MSG}", "%{RSYSLOGPREFIX}%{SUDO_MSG}", "%{RSYSLOGPREFIX}%{REFRAME_MSG}", "%{RSYSLOGPREFIX}%{BASH_MSG}", "%{RSYSLOGPREFIX}%{FAIL2BAN_MSG}", "%{RSYSLOGPREFIX}%{SINGULARITY_MSG}", "%{RSYSLOGPREFIX}%{DHCPD_MSG}", "%{RSYSLOGPREFIX}%{SSH_MSG}", "%{RSYSLOGPREFIX}%{MODULECMD_MSG}", "%{RSYSLOGPREFIX}%{LMOD_MSG}", "%{RSYSLOGPREFIX}%{NFS_MSG}", "%{RSYSLOGPREFIX}%{CEPH_MSG}", "%{RSYSLOGPREFIX}%{OPENNEBULA_MSG}", "%{RSYSLOGPREFIX}%{JUBE_MSG}", "%{RSYSLOGPREFIX}%{SHOREWALL_MSG}", "%{RSYSLOGPREFIX}%{KEYVALUE_MSG}", "%{RSYSLOGPREFIX}%{QUATTOR_MSG}", "%{RSYSLOGPREFIX}%{SNOOPY_MSG}", "%{RSYSLOGCUSTOM}"]
2020
}
2121
}
2222

@@ -25,7 +25,7 @@ filter {
2525
}
2626

2727
date {
28-
match => [ "syslog_timestamp", "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZ", "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd HH:mm:ss.SSSSSS" ]
28+
match => [ "syslog_timestamp", "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZ", "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd HH:mm:ss.SSSSSS", "MMM dd HH:mm:ss" ]
2929
}
3030

3131
if ("exclude_tags" not in [tags]) {

0 commit comments

Comments
 (0)