Getting Data In

Filter messages based on string in array in JSON

azudet
New Member

I am looking at filtering Kafka messages in Splunk. For that I need to be able to filter which messages show up in my search. However, since I am new to Splunk, I have no idea how to filter the way I want and 2 days of tutorials, reading and messing about haven't brought me any closer to the solution. My even data looks like this:

2020-04-01 13:59:55:803 INFO [messageCoordinator] Sent Kafka message {
"body":{
    "id":"messageID",
    "name":"messageName",
    "channels":"affectedChannels",
    "order":messageOrder, 
    ... 
 },
"headers":{
    "deltaFields":[
        "status",
        "otherString"
    ],
    "level":"messageLevel",
    "operationType":"UPDATE",
    "messageType":"messageType",
    "timestamp":1585746000000,
    "trackingId":6651814029
}

}

Now I need to filter based on headers.deltaFields, which is always present, always a string array but can have multiple values (up to 8 strings) in the array.

I only want the event to show up in my search if certain strings are within the deltaFields. Any help would be highly appreciated.

0 Karma

to4kawa
Ultra Champion
index=your_index sourcetype=yours (otherString AND deltaFields)

Just search with strings

0 Karma

to4kawa
Ultra Champion

what's your wanted fields?

0 Karma

azudet
New Member

I only want to see the event in the search when I have headers.deltafields contains 'otherString'

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...