This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path10-logstash-syslog.conf
82 lines (65 loc) · 2.21 KB
/
10-logstash-syslog.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
input {
# Listen on TCP/UDP port 5514 for CPPM messages
tcp {
port => 5514
type => syslog
}
udp {
port => 5514
type => syslog
}
}
filter {
# if message contains CPPM message
if [type] == "syslog" and [message] =~ "CPPM" {
# Parse out SYSLOG stuff (facility, level, etc)
syslog_pri{}
# Parse out SYSLOG message into compoents
grok {
match => { "message" => "<%{POSINT:syslog_pri}>%{TIMESTAMP_ISO8601:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program} %{POSINT:syslog_pid} %{NONNEGINT:num_of_msgs} %{NONNEGINT:msg_num} %{GREEDYDATA:syslog_message}" }
}
# Parse out key-value pairs (fields separated by commas, data separated from fields by "=")
kv {
source => "syslog_message"
field_split => ","
prefix => "CPPM_"
add_tag => "CPPM_msg_grokkd"
}
# Replace timestamp with timestamp from CPPM timestamp field
date {
match => [ "CPPM_timestamp", "yyyy-MM-dd HH:mm:ss.SSSSSS", "ISO8601" ]
add_tag => "CPPM_timestamp_grokkd"
}
# The "Endpoint_Profile" message uses "updated_at" field instead of "timestamp"
if [syslog_program] == "CPPM_to_ELK_Endpoint_Profile" {
date {
match => [ "CPPM_updated_at", "yyyy-MM-dd HH:mm:ss.SSSSSS", "ISO8601" ]
add_tag => "CPPM_updated_at_grokkd"
}
}
# Don't need to store syslog_message and message, so delete syslog_message field
mutate {
remove_field => [ "syslog_message" ]
}
}
# Process normal syslog message
else if [type] == "syslog" {
# Parse out SYSLOG stuff (facility, level, etc)
syslog_pri{}
# Parse SYSLOG message into compoents
grok {
match => { "message" => "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_tag => "reg_syslog_grokkd"
}
}
}
output {
# if parsing fails, write out messages to file
if [type] == "syslog" and "_grokparsefailure" in [tags] {
file { path => "/tmp/failed_syslog_events-%{+YYYY-MM-dd}" }
}
# Send rest to elasticsearch cluster
else {
elasticsearch { host => "localhost" cluster => "wlandata" }
}
}