-
Notifications
You must be signed in to change notification settings - Fork 0
/
logstash.conf
executable file
·87 lines (70 loc) · 2.08 KB
/
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
input {
stdin {}
}
filter {
csv {
columns => ["id","case_number","date","block","iucr","primary_type","description","location_description","arrest","domestic","beat","district","ward","community_area","fbi_code","x_coord","y_coord","year","updated_on","latitude","longitude","location"]
}
# Perform lookup against mapping file to get community names
translate {
field => "community_area"
dictionary_path => "/Users/peter/source/chicago_crime_2/community_areas.yml"
destination => "community_area_name"
}
# Perform lookup against mapping file to get names of current aldermen
translate {
field => "ward"
dictionary_path => "/Users/peter/source/chicago_crime_2/wards.yml"
destination => "ward_alderman"
}
if [latitude] and [longitude] {
mutate {
add_field => {
"coords" => ["%{longitude}", "%{latitude}"]
}
}
mutate {
convert => [ "coords", "float" ]
}
}
grok {
match => { "date" => "%{DATE_US:date_part} %{HOUR:hour_part}:%{MINUTE:min_part}:%{SECOND:sec_part} (?<ampm_part>AM|PM)" }
}
date {
match => [ "date", "MM/dd/YYYY hh:mm:ss aa"]
timezone => "America/Chicago"
}
# adjust for invalid times during DST transition
if "_dateparsefailure" in [tags] and [hour_part] == "02" and [ampm_part] == "AM" {
mutate {
replace => ["hour_part", "03"]
}
mutate {
replace => ["date", "%{date_part} %{hour_part}:%{min_part}:%{sec_part} %{ampm_part}"]
}
mutate {
remove_field => ["tags"]
}
date {
match => [ "date", "MM/dd/YYYY hh:mm:ss aa"]
timezone => "America/Chicago"
}
}
# remove unnecessary fields
mutate {
remove_field => ["latitude", "longitude", "location", "message", "hour_part", "date_part", "min_part", "sec_part", "ampm_part", "x_coord", "y_coord"]
}
}
output {
# stdout { codec => rubydebug }
stdout { codec => dots }
elasticsearch {
protocol => http
host => "localhost"
index => "chicago_crime"
document_type => "crime"
template => "index_template.json"
template_name => "chicrime"
template_overwrite => true
}
}