Splunk Enterprise

Work with fieldnames that contains {}. +PRTG

maaneeel
Explorer

Hi,

I'm using the PRTG app to get logs from this monitoring tool and build clean reports about our servers health.

The API is returning a JSON and the automatic field extraction gets fields like sensors{}.sensor.

How could I build a query referencing to this fields? If I try something like this fails:

index=prtg "sensors{}.sensor"=Ping

Thanks

Labels (3)
0 Karma

maaneeel
Explorer

I also tried use eval and filter by the new result without success

 

eval.png

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It looks like sensors{}.sensor is a multi-value field - try extracting the collection (spath) and separate each element into different events (mvexpand), then extract the fields you are interested in (spath again).

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Hi
as your event is json, you should try spath with it.
r. Ismo
0 Karma

maaneeel
Explorer

Thanks

 

I didn't know spath command, but after try it I have the same problem with the new field...

spath.png

Any idea?

Thanks

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=prtg
| spath output=sensors path=sensors{}
| mvexpand sensors
| search Ping
| spath input=sensors
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try with single quotes not double

index=prtg 'sensors{}.sensor'=Ping

0 Karma

maaneeel
Explorer

splunk_query.png

Hello again, It's not working,

Thanks for your help

@isoutamo 

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Exactly that way. Usually single quote means field and double means value (of field).
0 Karma
Get Updates on the Splunk Community!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...