Skip to content

Commit

Permalink
support websocket.log; idaholab#593
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Oct 11, 2024
1 parent 5040313 commit f59ff49
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions logstash/pipelines/zeek/1069_zeek_websocket.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,27 @@ filter {
}
}

# zeek says it's a vector, but I'm seeing semicolon-separated as well
mutate { id => "mutate_split_zeek_websocket_commas"
split => { "[zeek_cols][client_protocols]" => ","
"[zeek_cols][server_extensions]" => ","
"[zeek_cols][client_extensions]" => "," } }
mutate { id => "mutate_split_zeek_websocket_semicolons"
split => { "[zeek_cols][client_protocols]" => ";"
"[zeek_cols][server_extensions]" => ";"
"[zeek_cols][client_extensions]" => ";" } }
mutate { id => "mutate_strip_zeek_websocket"
strip => [ "[zeek_cols][client_protocols]",
"[zeek_cols][server_extensions]",
"[zeek_cols][client_extensions]" ] }
# split some vector fields (on , and ;) a few fields and trim spaces
ruby {
id => "ruby_websocket_split_and_clean"
code => "
if (client_protocols = event.get('[zeek_cols][client_protocols]')) then
client_protocols = client_protocols.split(/[,;]/)
client_protocols.collect{ |e| e ? e.strip : e }
event.set('[zeek_cols][client_protocols]', client_protocols)
end
if (server_extensions = event.get('[zeek_cols][server_extensions]')) then
server_extensions = server_extensions.split(/[,;]/)
server_extensions.collect{ |e| e ? e.strip : e }
event.set('[zeek_cols][server_extensions]', server_extensions)
end
if (client_extensions = event.get('[zeek_cols][client_extensions]')) then
client_extensions = client_extensions.split(/[,;]/)
client_extensions.collect{ |e| e ? e.strip : e }
event.set('[zeek_cols][client_extensions]', client_extensions)
end
"
}

mutate {
id => "mutate_add_field_zeek_service_websocket"
Expand Down

0 comments on commit f59ff49

Please sign in to comment.