-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.log.conf
47 lines (42 loc) · 1.61 KB
/
filter.log.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Filtre pour les logs non RFC (format rsys de base et ForwardFormat)
if "grokmatch" not in [tags] {
# Le paterne SYSLOGLINE ne peut pas matcher avec les logs de base
grok {
match => [
"message", "(?:%{SYSLOG5424PRI})?(?:%{SYSLOGTIMESTAMP:timestamp}|%{TIMESTAMP_ISO8601:timestamp8601}) %{SYSLOGHOST:logsource}+(?: %{SYSLOGPROG}:|) %{GREEDYDATA:message}"
]
overwrite => [ "message" ]
add_tag => ["grokmatch", "sysold"]
}
# Je ne met pas if "_grokparsefailure" not in [tags] car il peut très bien venir d'un autre filtre grok
if "sysold" in [tags]{
mutate {
rename => {
"logsource" => "hostname"
"syslog5424_msg" => "message"
"syslog5424_pri" => "priority"
}
# retire ce tag au cas ou le log aurait parcourue d'autre filtre grok
remove_tag => [ "_grokparsefailure" ]
}
# Si le champs priority existe, car les log de base n'ont pas cette information
if [priority] {
ruby {
code => 'event.set("severity", event.get("priority").to_i.modulo(8))'
}
ruby {
code => 'event.set("facility", (event.get("priority").to_i / 8).floor)'
}
}
# si date est au format haute précision
date {
match => [ "timestamp8601", "ISO8601" ]
remove_field => ["timestamp8601"]
}
# si date format classique
date {
match => [ "timestamp", "MMM dd HH:mm:ss", "MMM d HH:mm:ss"]
remove_field => ["timestamp"]
}
}
}