-
Notifications
You must be signed in to change notification settings - Fork 1
/
logstash-aemet.conf
54 lines (49 loc) · 1.93 KB
/
logstash-aemet.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
# This is the Logstash configuration file to get the AEMET data into Elasticserach
# An input, standard raw tcp, please specify a port of your liking
input {
tcp {
port => 11515
type => "aemet-new"
}
}
# Filter block to parse the incoming CSV
# Also takes care of setting some values to numbers and drops documents where the temperature is null, as these possibly have not been updated yet
filter {
if [type] == "aemet-new" {
csv {
columns =>["computed_id", "province", "stationid", "location", "geolocation", "dat etime", "temperature","wind_speed", "wind_direction", "wind_gust", "wind_gust_direction", "rain_mm", "pressure", "pressure_tendency", "humidity"]
separator => ","
skip_empty_columns => "true"
}
mutate {
convert => {
"temperature" => "float"
"wind_speed" => "float"
"wind_gust" => "float"
"humidity" => "float"
"pressure" => "float"
"rain_mm" => "float"
"pressure_tendency" => "float"
}
}
date {
match => [ "datetime", "dd/MM/yyyy HH:mm" ]
timezone => "Europe/Madrid"
target => "@timestamp"
}
if ![temperature] {
drop { }
}
}
}
# This output block will send all events of type "aemet-new" to Elasticsearch at the configured red
# host and port into monthly indices of the pattern, "aemer-new-YYYY.MM"
output {
if [type] == "aemet-new" {
elasticsearch {
hosts => [ "<your_elasticsearch_host:9200", "your_other_elasticserach_host:9200" ]
index => "aemet-new-%{+YYYY.MM}"
document_id => "%{computed_id}"
}
}
}