Before you post: Your responses to these questions will help the community help you. Please complete this template if you’re asking a support question.
Don’t forget to select tags to help index your topic!
1. Describe your incident:
I would like to implement https://www.graylog.org/post/how-to-set-up-graylog-geoip-configuration/ but I dont have dest_ip or src_ip available - how can I extract them from the message, please?
2. Describe your environment:
- OS Information:
Ubuntu 20.04
Graylog 4.3.11
MongoDB 4.0.28
3. What steps have you already taken to try and solve the problem?
So the setup is that we have Suricata listening to the network traffic and if anything comes up as susipicous it sends a message to the Graylog server as Beats input. There we have an extractor which splits the message into key / value pairs and it’s being processed later on.
Now I tried to implement https://www.graylog.org/post/how-to-set-up-graylog-geoip-configuration/ and it didnt work. Further investigations (playing with the rules) I figured out that I dont have dest_ip and src_ip available when the rule kicks in even though both are available in the message… so I guess the rules are processed before the extractor.
Here you can see a message and that the key / value pairs of the message are being added to the message by the extractor:
But if I use a simple rule like this the rule isnt triggered:
rule "Test"
when
has_field("src_ip")
then
set_field("Test","Test123");
end
4. How can the community help?
So I thought that it should be possible to extract the key_value pairs from the message and add them as additional fields (would also save the extractor). I used the key_value function together with set_fields but that doesnt seem to have any impact:
rule "Test"
when
has_field("message")
then
set_fields(key_value(to_string($message.message)),",",":");
end
Or maybe my thought process was wrong because I thought I would be able to access the fields in the next stage of my pipeline?
rule "Test"
when
has_field("message")
then
set_fields(key_value(to_string($message.message)),",",":");
end
when
has_field("src_ip")
then
set_field("Test","Test123");
end
What am I doing wrong here, please?
Cheers,
Fili