Last active
March 10, 2016 23:08
-
-
Save nicholasblexrud/df15a2be7f3519514046 to your computer and use it in GitHub Desktop.
logstash file for converting multiline mixpanel events into elasticsearch
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
{ | |
event: { | |
"name": "event_test", | |
"properties": { | |
"color": "red", | |
"size": "medium", | |
"texture": "flannel" | |
} | |
} | |
},{ | |
event: { | |
"name": "event_test", | |
"properties": { | |
"color": "blue", | |
"size": "large", | |
"texture": "plaid" | |
} | |
} | |
} |
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
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