Support TXT uploads and extend XigmaNAS event parsing
This commit is contained in:
22
internal/parser/vendors/xigmanas/parser_test.go
vendored
22
internal/parser/vendors/xigmanas/parser_test.go
vendored
@@ -91,4 +91,26 @@ func TestParserParseExample(t *testing.T) {
|
||||
if len(result.Events) == 0 {
|
||||
t.Fatal("expected events from uptime/zfs sections")
|
||||
}
|
||||
|
||||
var hasSystemLog, hasSmartdLog, hasDaemonLog, hasLoginFailure bool
|
||||
for _, ev := range result.Events {
|
||||
if ev.EventType == "System Log" {
|
||||
hasSystemLog = true
|
||||
}
|
||||
if ev.EventType == "SMARTD Log" {
|
||||
hasSmartdLog = true
|
||||
}
|
||||
if ev.EventType == "Daemon Log" {
|
||||
hasDaemonLog = true
|
||||
}
|
||||
if strings.Contains(strings.ToLower(ev.Description), "login failure") {
|
||||
hasLoginFailure = true
|
||||
}
|
||||
}
|
||||
if !hasSystemLog || !hasSmartdLog || !hasDaemonLog {
|
||||
t.Fatalf("expected events from System/SMARTD/Daemon sections, got system=%v smartd=%v daemon=%v", hasSystemLog, hasSmartdLog, hasDaemonLog)
|
||||
}
|
||||
if !hasLoginFailure {
|
||||
t.Fatal("expected to parse login failure event from system log section")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user