Created
February 7, 2015 05:56
-
-
Save jordansissel/47481e795dd28094ad6d to your computer and use it in GitHub Desktop.
Parsing tshark -V output with logstash
This file contains 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 { stdin { } } | |
output { | |
stdout { | |
#codec => rubydebug | |
codec => dots | |
} | |
elasticsearch { | |
protocol => http | |
index_type => "pcap1" | |
} | |
} | |
filter { | |
grok { | |
match => { | |
"message" => [ | |
#"Frame %{NUMBER:frame:int}: %{NUMBER:bytes:int) bytes on wire \(%{NUMBER} bits\), %{NUMBER} bytes captured \(%{NUMBER} bits\) on interface %{NUMBER} \(%{WORD:direction}\)", "^Frame %{NUMBER:frame:int}:" | |
] | |
} | |
} | |
if [message] !~ /^Frame \d+/ and [message] =~ /\b\w+\b:/ { | |
ruby { | |
code => 'key,value = event["message"].split(/: +/, 2); key = key.strip.downcase.gsub(/ /,"_"); event[key] = value.strip if key =~ /^[a-z_-]+$/' | |
} | |
} | |
multiline { | |
what => previous pattern => "^$" negate => true | |
} | |
if [epoch_time] { | |
mutate { | |
gsub => [ "epoch_time", " seconds", "" ] | |
} | |
date { | |
match => [ "epoch_time", "UNIX" ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment