Skip to content

Commit

Permalink
add tests + log in/out adjustement
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoely86 committed Jun 6, 2024
1 parent 33a4d93 commit 4542cf0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion files/pixiu
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ PIXIU_USER_INODE_ALARM %{PIXIU_ALARM_PREFIX} %{PIXIU_ALARM_COMMON} reaches (?:or
PIXIU_USER_SPACE_ALARM %{PIXIU_ALARM_PREFIX} %{PIXIU_ALARM_COMMON} reaches (?:or approaches )?to the (:?(?<quota_limit_type>%{WORD}) space(?: quantity)? quota of|space(?: quantity)? (?<quota_limit_type>%{WORD}) quota of) \((?<quota_space_limit>%{PIXIU_BYTES})\)\..*

PIXIU_LOGIN_STATUS failed|succeeded
PIXIU_LOGIN_ACTION in|out

PIXIU_LOGIN_ALARM %{PIXIU_ALARM_PREFIX} User \(user name %{USERNAME:username}\) %{PIXIU_LOGIN_STATUS:state} (?:to log in|in logging in) from source \(%{IPORHOST:source_ip}\)\..*

PIXIU_LOGIN_ALARM %{PIXIU_ALARM_PREFIX} User \(user name %{USERNAME:username}\) %{PIXIU_LOGIN_STATUS:state} (?:to log %{PIXIU_LOGIN_ACTION:action}|in logging %{PIXIU_LOGIN_ACTION:action})(?: upon timeout)? from source \(%{IPORHOST:source_ip}\)\..*

PIXIU_ALARM %{PIXIU_USER_INODE_ALARM}|%{PIXIU_USER_SPACE_ALARM}|%{PIXIU_LOGIN_ALARM}
28 changes: 28 additions & 0 deletions tests/data/pixiu
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ data = [
"username": "bsdfsdf",
"source_ip": "172.18.124.113",
"state": "failed",
"action": "in",
},
},
{
Expand All @@ -218,4 +219,31 @@ data = [
"path": "/108",
},
},
{
"raw": "<187>Jun 5 10:19:28 HKSTO03-Node1 alarm[2003199]: <186>2024-06-05 10:19:26 DST 172.19.96.130 OceanStor-Distributed-Storage 908704 0xFEA6A000E Major(1): The used space (18MB) of quota (type directory quota) of dtree (name --, ID 0) at / in namespace (name zzzzbucket, ID 242) reaches to the space soft quota of (15MB).",
"expected": {
"program": "alarm",
"quota_used_type": "directory",
"namespace": "zzzzbucket",
"namespace_id": 242,
"dtree": "--",
"dtree_id": 0,
"used_space": 18000000,
"quota_used_type": "space",
"quota_type": "directory",
"quota_limit_type": "soft",
"quota_space_limit": 15000000,
"path": "/",
},
},
{
"raw": "<190>Jun 5 11:19:57 C4STO01-Node1 alarm[4162768]: <189>2024-06-05 11:19:57 DST 172.19.104.10 OceanStor-Distributed-Storage 1140981 0x100F00C90022 Informational(9): User (user name adm_CV000080) succeeded in logging out upon timeout from source (172.18.252.67).",
"expected": {
"program": "alarm",
"username": "adm_CV000080",
"source_ip": "172.18.252.67",
"state": "succeeded",
"action": "out",
},
},
]
2 changes: 1 addition & 1 deletion tests/logstash_7.6.2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ filter {
}

date {
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" ]
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 d HH:mm:ss", "MMM d HH:mm:ss" ]
}

if ("exclude_tags" not in [tags]) {
Expand Down

0 comments on commit 4542cf0

Please sign in to comment.