Splunk Search

What can be the query so that i can display the field " API.V1.WEBS_ENTITLED_PRODUCTS" and not its value?

payyachamy
Observer

I have the logs in this way :

   measures: { 
     API.V1.WEBS_ENTITLED_PRODUCTS296
     success300

   }

what can be the query so that i can display the field " API.V1.WEBS_ENTITLED_PRODUCTS" and not its value.

I want the output as  "API.V1.WEBS_ENTITLED_PRODUCTS"

Labels (4)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @payyachamy,

you could use a regex like the following:

your_search
| rex "measures:\s+\{\s+(?<your_field>[^:]+)"

that you can test at https://regex101.com/r/0uOTvQ/1

Ciao.

Giuseppe

0 Karma

payyachamy
Observer
your_search
| rex "measures:\s+\{\s+(?<your_field>[^:]+)"

but the issue with this query is this particular field keeps on changing,  so the query should be dynamic to pick the field which is coming in.

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

And what would be the criteria for selecting this particular event? Do you have this field parsed out of the event?

0 Karma

payyachamy
Observer

measures: { 
     API.V1.WEBS_ENTITLED_PRODUCTS296
     success300

   }

   metadata: { 
     downlink10
     effectiveType4g

   }

   name: WIDGET_LOAD.PIU

the thing here is I need a query which shows the API that is responsible for a widget load.

so I need a table which shows : 

WIDGET.                           |                      API

-------------------------------------------------------------------       

WIDGET_LOAD.PIU     |.       API.V1.WEBS_ENTITLED_PRODUCTS

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Unfortunately, splunk has very limited event-level introspection capacities so you have to parse out the field name from the raw event on your own. If your event structure is relatively strict, it should be possible with regexes similarily to what @gcusello showed.

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...