Splunk Search

Retrieve result from list

Nidd
Path Finder

I have a field in log like:

"policies":["Test1"]

for which I am not able to search through the keyword when I have the query:

index=myindex host=myhost policies=Test1

 

Since policies is a list and I cant be able to directly search it.

Is there any specific way I can search for inputs available in a list?

Labels (1)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @Nidd,

Can you please try below;

index=myindex host=myhost policies{}=Test1
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

based on your example you probably have an event which is JSON or partially has JSON? Then you could do e.g.

index=_internal earliest=-1m
| head 1
| eval _raw = "{\"policies\":[\"Test1\"]}"
```previous generate example event```
| spath
| search policies{} = "Test1"

 

Your event is something like this in JSON format:

{"policies":[
  "Test1"
]}

 

0 Karma

Nidd
Path Finder

Thank you @isoutamo 

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @Nidd,

Can you please try below;

index=myindex host=myhost policies{}=Test1
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

Nidd
Path Finder

Thank you @scelikok 

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...