-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.conf
54 lines (47 loc) · 1.49 KB
/
example.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
input {
tcp {
port => 5140
type => syslog
}
udp {
port => 5140
type => syslog
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
grok {
match => { "message" => "%{SYSLOGTIMESTAMP} %{SYSLOGHOST} %{DATA}(?:\[%{POSINT}\])?: LOGIN: USER: %{USERNAME:user}, HOSTNAME: %{IPORHOST:hostname}, FROM: %{IPORHOST:from_host}, FINGERPRINT: %{NOTSPACE:fingerprint}, SSH_USER: %{NOTSPACE:ssh_user}:" }
add_tag => [ "%{user}", "login_event" ]
tag_on_failure => []
}
grok {
match => { "message" => "%{SYSLOGTIMESTAMP} %{SYSLOGHOST} %{DATA}(?:\[%{POSINT}\])?: BASHLOG: USER: %{USERNAME:user}, HOSTNAME: %{IPORHOST:hostname}, FINGERPRINT: %{NOTSPACE:fingerprint}, SSH_USER: %{NOTSPACE:ssh_user}, CMD: %{GREEDYDATA:command}" }
add_tag => [ "bashlog", "%{user}" ]
tag_on_failure => []
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
if [type] == "syslog" {
if "_grokparsefailure" not in [tags] {
elasticsearch {
host => localhost
}
}
if "_grokparsefailure" in [tags] {
file {
path => '/var/log/logstash/grokfailures.log'
}
}
}
}