Getting Data In

How to exclude JSON entries from the indexing?

craymore
New Member

Hello dear splunketeers !

I am seeking some advice.

The splunk architecture I currently manage is fairly simple :

  • one central splunk server
  • a few hundreds of universal splunk forwarder agents
  • each agent is monitoring JSON log files from our applications and sending them to our central splunk server

Everything is working fine, but I am trying to reduce the amount of data being indexed on our central splunk server

e.g :

  1. here's a log sample that is sent by the universal forwarder

    {
      "@timestamp": "2018-03-02T17:15:14.756+00:00",
      "@level": "INFO",
      "@message": "foobar"
    }
    {
      "@timestamp": "2018-03-02T17:15:15.800+00:00",
      "@level": "ERROR",
      "@message": "damnit !"
    }
    {
      "@timestamp": "2018-03-02T17:15:16.136+00:00",
      "@level": "INFO",
      "@message": "foobar"
    }
    
  2. here's the final log that I would like to see indexed on the central server

    {
      "@timestamp": "2018-03-02T17:15:15.800+00:00",
      "@level": "ERROR",
      "@message": "damnit !"
    }
    

    So basically, I would like to get rid of all the JSON entries which level is set to "INFO"

Does anyone how to perform this ( simple ? ) filtering?

Thanks beforehand for any answer

0 Karma
1 Solution

somesoni2
Revered Legend

You basically need to setup routing of specific events (events that contain @level as INFO) to nullQueue (drop from being indexed). The reference configuration could be found here: http://docs.splunk.com/Documentation/Splunk/7.0.2/Forwarding/Routeandfilterdatad#Discard_specific_ev...

So, in your case (all setting are done in your central Splunk server)

1) In props.conf, set the TRANSFORMS-null attribute:

[YourSourceTypeHere]
TRANSFORMS-null= drop_info_jsons

2) Create a corresponding stanza in transforms.conf. Set DEST_KEY to "queue" and FORMAT to "nullQueue":

[drop_info_jsons]
REGEX = \"\@level\"\:\s*\"INFO\"
DEST_KEY = queue
FORMAT = nullQueue

3) Restart Splunk Enterprise.

View solution in original post

0 Karma

somesoni2
Revered Legend

You basically need to setup routing of specific events (events that contain @level as INFO) to nullQueue (drop from being indexed). The reference configuration could be found here: http://docs.splunk.com/Documentation/Splunk/7.0.2/Forwarding/Routeandfilterdatad#Discard_specific_ev...

So, in your case (all setting are done in your central Splunk server)

1) In props.conf, set the TRANSFORMS-null attribute:

[YourSourceTypeHere]
TRANSFORMS-null= drop_info_jsons

2) Create a corresponding stanza in transforms.conf. Set DEST_KEY to "queue" and FORMAT to "nullQueue":

[drop_info_jsons]
REGEX = \"\@level\"\:\s*\"INFO\"
DEST_KEY = queue
FORMAT = nullQueue

3) Restart Splunk Enterprise.

0 Karma

craymore
New Member

I implemented the aformentionned settings in order to a have a redirect to the nullQueue for some entries and indeed it works as intended.

Thank you for advice !

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...