Skip to content

Instantly share code, notes, and snippets.

@nicholasblexrud
Last active March 10, 2016 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholasblexrud/df15a2be7f3519514046 to your computer and use it in GitHub Desktop.
Save nicholasblexrud/df15a2be7f3519514046 to your computer and use it in GitHub Desktop.
logstash file for converting multiline mixpanel events into elasticsearch
{
event: {
"name": "event_test",
"properties": {
"color": "red",
"size": "medium",
"texture": "flannel"
}
}
},{
event: {
"name": "event_test",
"properties": {
"color": "blue",
"size": "large",
"texture": "plaid"
}
}
}
input {
file {
codec => multiline {
pattern => "^\{"
negate => true
what => next
}
path => [path_to_json]
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
mutate {
gsub => ["message", "\n", ""]
remove_field => ["@timestamp", "host", "path", "@version", "tags"]
}
if [message] =~ /^{.*}$/ {
json {source => message}
}
}
output {
stdout { codec => rubydebug }
elasticsearch{
hosts =>[]
index => logstash_year_month_date
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment