Error while creating a search request using Splunk JS SDK

260 Views Asked by At

For this example: https://github.com/splunk/splunk-sdk-javascript/blob/master/examples/node/helloworld/search_normal.js

When I modify line 53.

service.search("search index=_internal | head 3", {}, done);

To this new query

"index=comtech_np sourcetype=comtech_cdv_csv ENodeB=* "PSAP Name"=* "Calling Party Number"=* "Call Start Time"=* "Call End Time"=*"

I get errors. How would I rewrite this query in node to execute.

The error:

[SPLUNKD] Unknown search command 'index'.
C:\Users\shahrsu\test\s4.js:37
      console.log("Job SID: ", job.sid);

When I modify query to:

"ENodeB=* "PSAP Name"=* "Calling Party Number"=* "Call Start Time"=* "Call End Time"=*"

I get

[SPLUNKD] Unknown search command 'ENodeB'.
C:\Users\shahrsu\test\s4.js:37
      console.log("Job SID: ", job.sid);
1

There are 1 best solutions below

0
On

We can try adding search term infront of the splunk query as like below

"search index=comtech_np sourcetype=comtech_cdv_csv ENodeB=* "PSAP Name"=* "Calling Party Number"=* "Call Start Time"=* "Call End Time"=*"