Splunk Search

parsing json and sending as search command

CorpusCallosum
Explorer

Hi Guys

I have a json with 75 elements. Normally i can put them in macro and run in search but that means 75 macro search which is not efficient.

I would like to parse json data rule, description, tags and impact values from json file and use those as search

Sample JSON is below

{
 "filters":{
  "filter":[
   {
    "id":"1",
    "rule":"(?:\"[^\"]*[^-]?>)|(?:[^\\w\\s]\\s*\\\/>)|(?:>\")",
    "description":"Finds html breaking injections including whitespace attacks",
    "tags":{
      "tag":[
        "xss",
        "csrf"
      ]
    },
    "impact":"4"
  },

What would be the efficient way to use thos element in search?

Thanks in advance

Tags (2)
1 Solution

dshpritz
SplunkTrust
SplunkTrust

There are two things you might want to look into. If the whole event is JSON, then you should look into the KV_MODE = json configuration in props.conf:

http://docs.splunk.com/Documentation/Splunk/6.1.2/Admin/Propsconf

If this is the value of a field, then you can look into the spath command:

http://docs.splunk.com/Documentation/Splunk/6.1.2/SearchReference/Spath

View solution in original post

dshpritz
SplunkTrust
SplunkTrust

There are two things you might want to look into. If the whole event is JSON, then you should look into the KV_MODE = json configuration in props.conf:

http://docs.splunk.com/Documentation/Splunk/6.1.2/Admin/Propsconf

If this is the value of a field, then you can look into the spath command:

http://docs.splunk.com/Documentation/Splunk/6.1.2/SearchReference/Spath

CorpusCallosum
Explorer

this JSON file is actually kind of search db for me. not the list of events. My logs are in syslog format. i just want to parse this json and search in the logs.

0 Karma

CorpusCallosum
Explorer

macro i manually copy paste the regex and description. nothing special 🙂

0 Karma

somesoni2
Revered Legend

can you share how you're parsing them in macro?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...