Splunk Dev

How to query extracted field using SplunkJS

AshChakor
Path Finder

Hi I have extracted few fields using Regex from logs in Splunk. I can do search on those fields successfully in Splunk WebUI. I want to use the same queries uisng SplunkJS in my Webapp. Every time I add the extracted fields in the SearchManager's search query on my page, I get No result found.
How can I resolve this issue and continue to use SplunkJS in my webapp?

0 Karma

AshChakor
Path Finder

Ok I found a work around for this. I used regex expression to extract fields and its producing the same output just as in splunkUI with extracted or transformed fields.
Splunk UI Extracted field : EXTRACT-TransUID Inline ^[^[\n]*[(?P[^]]+)

SplunkUI search: index="myindex" host="myhost" | transaction TransUID

When I used the above search in my webapplication uisng SplunkJS, it wouldn't work.
So I used regex as below in the search and its working just as it did in SplunkUI
'index="myindex" host="myhost" | rex field=_raw "^[^[\n]*\[(?P<TransUIDTest>[^]]+)" | transaction TransUIDTest'

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...