-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathlogstash.conf
More file actions
70 lines (60 loc) · 1.54 KB
/
Copy pathlogstash.conf
File metadata and controls
70 lines (60 loc) · 1.54 KB
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
input {
tcp {
port => 3333
type => "apache_access"
}
beats {
port => 5044
}
}
filter {
mutate {
add_field => [ "host_ip", "%{host}" ]
}
# Uncomment the remainder of the line to allow the "datadumpbeat" to
# be managed in a similar way to normal Apache logs
if [type] == "apache_access" # or [type] == "datadumpbeat"
{
grok {
match => {
message => "%{IPORHOST:remote_addr} - - \[%{HTTPDATE:timestamp}\] \"%{WORD:http_method} %{NOTSPACE:request} HTTP/%{NUMBER:http_version}\" %{NUMBER:status} (?:%{NUMBER:bytes}|-) \"(?:%{URI:referrer}|-)\" %{QS:user_agent}"
}
}
date {
locale => "en"
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
}
mutate {
remove_field => "timestamp"
gsub => [
"user_agent", "(^\"|\"$)", ""
]
}
useragent {
source => "user_agent"
prefix => "user_agent_"
}
geoip {
source => "remote_addr"
target => "geoip"
database =>"/usr/local/share/data/GeoLite2-City.mmdb"
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float" ]
}
}
}
# Uncomment for detailed logstash mapping information
# which can be viewed via `docker-compose logs -f logstash`
#
# output {
# stdout { codec => rubydebug }
# }
output {
elasticsearch {
hosts => ["elastic1", "elastic2", "elastic3"]
template => "/config-dir/logstash-es-template.json"
}
}