Dropping some log messages with specific field value

(Mehmet Ali Buyukkarakas) #1

Dear all,

I would like to drop some syslog messages before wring to indexes.
Some log records contains particular IP addresses and I want to write a rule like

IF source=“xxx” AND IF ip= THEN drop.

I cant find a good resource which explains this. Graylog documentation about pipelines wasnt good enough.

Thank you.

(Philipp Ruland) #2

Hey @Mbuyukkarakas,

you actually can just use a pipeline to do that.

rule "dropOnIP"
  $message.source = "xxx" AND
  $message.ip = ""

You can either use multiple rules for every IP you want to drop on, or if you are willing to go onto the newest snapshot you can use the new lookup function explained here:

Greetings - Phil

(Mehmet Ali Buyukkarakas) #3

Phil, thank you. I will try all of these and will write back here.


(Mehmet Ali Buyukkarakas) #4

Bad news. I couldnt use this config.
The raw log is an apache access log. I used some grok patterns to parse the IP addresses.
What I need is to write something like this

if log_source_server = XXX and IP=y.y.y.y then drop.

I need this because I want to drop most of logs which are about local IP addresses. I just need the public IP’s.
I remarked the local IP’s are one or two different but %90 of logs are about these IP’s. Basically I need to drop them.

Thank you.

(Philipp Ruland) #5


is your source field the hostname of your server? If yes, then use the field gl2_remote_ip instead.

Greetings - Phil

(Mehmet Ali Buyukkarakas) #6


The source field is not the graylog server. One of my linux servers is sending the logs.


graylog srv :
web srv . :
The IP that I want to discard :

IF source = AND IP= then discard.

Exactly what I need.

Thank you.

(Philipp Ruland) #7


gl2_remote_ip is the value of the remote ip that send the message to Graylog, so it is your web server ip ( So, from my understanding this is what you need:

rule "dropOnIP"
  $message.gl2_remote_ip = "" AND
  $message.ip = "" // I assume that you extract the ip-to-be-dropped-on into the field ip

Add this rule to a pipeline and connect that pipeline to a stream the message is running through, that should work.

If I get access to my environment I can test this, but this will not be before saturday…

Greetings - Phil

(system) closed #8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.