-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3_filter.app.logstash.conf
64 lines (51 loc) · 1.43 KB
/
3_filter.app.logstash.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
filter {
# apply filters only on 'app-log'
if [type] == "app-log" {
# parse app-log line
grok {
patterns_dir => "/etc/logstash/patterns"
match => ["message","%{LOG_DATE:log_date} \[%{NOTSPACE:thread}\] %{LOGLEVEL:log_level} %{NOTSPACE:classname} - %{GREEDYDATA:msg}"]
}
# use log_date field as @timestamp
date {
match => ["log_date","dd-MM-YYYY HH:mm:ss.SSS"]
}
# split msg field with '&' separator
kv {
field_split => "&"
source => "msg"
}
# tag 'sell' or 'search'
if [classname] =~ /SellRequest$/ {
mutate { add_tag => "sell" }
} else if [classname] =~ /SearchRequest$/ {
mutate { add_tag => "search" }
}
# remove msg field
mutate {
remove_field => [ "msg" ]
}
# convert id as integer
mutate {
convert => [ "id", "integer" ]
}
# convert price as float
mutate {
convert => [ "price", "float" ]
}
# transform options as an array
mutate {
split => [ "options", "|" ]
}
# geoloc ip with GeoLiteCity database
geoip {
source => "ip"
#database => "./GeoLiteCity.dat"
}
# parse user agent
useragent {
source => "ua"
target => "useragent"
}
}
}