Dear all,
i have tons of messages coming from a Firepower Management Center that i need to parse. here is one example
<113>Apr 12 09:34:04 aus-fmc01 firepoweralert: [133:27:2] dcerpc2: Connection-oriented DCE/RPC - Invalid major version [Impact: Potentially Vulnerable] From "AUS-IPS-FPR-01" at Fri Apr 12 09:29:37 2019 UTC [Classification: Potentially Bad Traffic] [Priority: 2] {tcp} 10.163.52.36:53624 (unknown)->10.163.50.116:49156 (unknown)
I’m able to successfully do it with a grok extractor that looks like this
%{SYSLOGTIMESTAMP:timestamp} %{HOSTNAME:hostname} %{WORD:tag}: \[%{NUMBER:UNWANTED}:%{NUMBER:UNWANTED}:%{NUMBER:UNWANTED}\] %{WORD:app_protocol}: %{DATA:message_firepower} \[Impact: %{FIREPOWER_IMPACT:impact}\] From \"%{DATA:sensor_IP_or_name}\" at %{DAY:UNWANTED} %{MONTH:UNWANTED} %{MONTHDAY:UNWANTED} %{TIME:UNWANTED} %{YEAR:UNWANTED} %{WORD:UNWANTED} \[Classification: %{FIREPOWER_CLASSIFICATION:classification}\] \[Priority: %{NUMBER:priority}\] \{%{FIREPOWER_PROTOCOL:transport_prot}\} %{IPV4:src_IP}:%{NUMBER:src_port} \(%{FIREPOWER_COUNTRY:src_country}\)->%{IPV4:dst_IP}:%{NUMBER:dst_port} \(%{FIREPOWER_COUNTRY:dst_country}\)
the problem with the grok extractors eat a lot of CPU which causes the load on it to go close to 100%
Now i’m trying to write a pipeline for parsing these messages but i’m having issues with the rule creation, it gives plenty of errors specially for characters like [ , ", } and so on…
my current rule that i’m trying to write looks like this
rule "FMC rule 2"
when
has_field("message")
then
let message_field = to_string($message.message);
let fmc0 = grok(pattern: "%{SYSLOGTIMESTAMP:timestamp} %{HOSTNAME:hostname} %{WORD:tag}: \[%{NUMBER:UNWANTED}:%{NUMBER:UNWANTED}:%{NUMBER:UNWANTED}\] %{WORD:app_protocol}: %{DATA:message_firepower} \[Impact: %{FIREPOWER_IMPACT:impact}\] From \"%{DATA:sensor_IP_or_name}\" at %{DAY:UNWANTED} %{MONTH:UNWANTED} %{MONTHDAY:UNWANTED} %{TIME:UNWANTED} %{YEAR:UNWANTED} %{WORD:UNWANTED} \[Classification: %{FIREPOWER_CLASSIFICATION:classification}\] \[Priority: %{NUMBER:priority}\] \{%{FIREPOWER_PROTOCOL:transport_prot}\} %{IPV4:src_IP}:%{NUMBER:src_port} \(%{FIREPOWER_COUNTRY:src_country}\)->%{IPV4:dst_IP}:%{NUMBER:dst_port} \(%{FIREPOWER_COUNTRY:dst_country}\)", value: message_field, only_named_captures: true);
set_fields(fmc0);
end
does anyone know how i can write the rule in such a way that i’d be able to parse the message and have no errors?
Thanks,
Marius.