Splunk Search

Search Factory: Why am I getting unknown search command 'tag' only in Javascript while it works in classic Search?

seva98
Path Finder

My search starts with this:
tag=kpi earliest=1521504000 latest=1521849600 | table _time enterprise_id facility_id shop_id (there is more after)
If I run this search inside classic Search, I get results as excepted.

But if I run search with exactly the same query in javascript with
service.oneshotSearch(query, { "output_mode": "JSON" }, function(err, data) { ... }

I will receive following error message:
common.js:428 [SPLUNKD] Search Factory: Unknown search command 'tag'.

Are there some kind of limitation for oneshot search that doesn't allow using tags or do I need to pass any other config to oneshot search in order to make it work with tagin query?

0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@seva98

You need to prepend search to your search.

eg.

search tag=kpi earliest=1521504000 latest=1521849600 | table _time enterprise_id facility_id shop_id

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@seva98

You need to prepend search to your search.

eg.

search tag=kpi earliest=1521504000 latest=1521849600 | table _time enterprise_id facility_id shop_id

0 Karma

seva98
Path Finder

Thanks! Just found out that like seconds ago by searching in another project. Search was really missing and now it works.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Glad to help you @seva98 .
Can you please accept this answer to close this question?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...