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 (2)
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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...