Created
June 20, 2018 19:53
-
-
Save spinscale/cb7ff76553fad5065e9168ffb374e752 to your computer and use it in GitHub Desktop.
logstash meetup.com stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl -s http://stream.meetup.com/2/rsvps | ./bin/logstash -f logstash-meetup.conf | |
input { | |
stdin { | |
codec => json_lines | |
} | |
} | |
# the lonlat array is needed for the map widget in kibana to work | |
# so we have to work a bit around the supplied data | |
filter { | |
if [venue][lat] and [venue][lon] { | |
# copy field, then merge to create array for bettermap | |
mutate { | |
add_field => [ "[venue][lonlat]", "%{[venue][lon]}", | |
"tmplat", "%{[venue][lat]}" ] | |
} | |
mutate { | |
merge => [ "[venue][lonlat]", "tmplat" ] | |
} | |
mutate { | |
convert => [ "[venue][lonlat]", "float" ] | |
remove_field => [ "tmplat" ] | |
} | |
} | |
# metrics, baby! | |
# lets see the distribution by country if possible | |
metrics { | |
meter => "meetup.country.%{[group][group_country]}" | |
meter => "meetup.country.total" | |
add_tag => "metric" | |
flush_interval => 60 | |
} | |
} | |
output { | |
if "metric" in [tags] { | |
stdout {} | |
elasticsearch { | |
index => "metrics-meetup-%{+YYYY.MM.dd}" | |
} | |
} | |
if "metric" not in [tags] { | |
elasticsearch { | |
# CHANGE THIS PATH! | |
template => '/Users/alr/elastic/presentations/2018/paderborn-technology-meetup/6.3.0/logstash-6.3.0/logstash-meetup.json' | |
template_name => 'meetup' | |
template_overwrite => true | |
index => "meetup-%{+YYYY.MM.dd}" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"index_patterns" : "meetup*", | |
"settings" : { | |
"number_of_shards" : 1 | |
}, | |
"mappings" : { | |
"doc" : { | |
"properties" : { | |
"venue" : { | |
"properties" : { | |
"lonlat" : { "type": "geo_point" }, | |
"lat" : { "type": "float" }, | |
"lon" : { "type": "float" } | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment