Getting Data In

collect command wouldn't save to an index

sintjm
Path Finder

i have a search in my query where i spool data from an API but then the collect command does not allow me to save the search into my index. Any ideas?

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sintjm,

I suppose that you created the index and it has the correct grants.

did you explicit the index name in the search?

<your_search>
| table ............
| collect index=your_index

Ciao.

Giuseppe

0 Karma

sintjm
Path Finder

sintjm_0-1720694163221.pngsintjm_1-1720694190377.png

yes please, I did as such

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You appear to be doing spath on data, then only keeping data which makes the spath redundant! What timestamps are in the events returned by the curl command?

0 Karma

sintjm
Path Finder

Because i don't see the events in from searching the index I created, I can't tell the timestamp. I added 

| eval _time=now()

to the query so that it would put the recent time when the endpoint was reached

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Another possibility is to try

| table data

instead of fields

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

So, with the spath removed and the _time field added, do you events now show up in the index (after the collect command)? If not, what does the search log say for the search with the collect command?

0 Karma

sintjm
Path Finder

I tried using

| table data


but there is still no data when searching the index.

 With the spath removed and the _time field added there are still no events in the index and the search log can be seen below. There is still data coming through the search.

sintjm_0-1720701350487.png

 

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

This is not the search log. You get a search log when you click the "Job" button and pick "Inspect Job". On top of the screen you'll have a link to search log.

0 Karma

sintjm
Path Finder

search 1.PNG

search 2.PNG

  The search log

0 Karma

PickleRick
SplunkTrust
SplunkTrust

There's no point doing spath if in the next step you leave only the original data field. But that's beside the point.

First step in debugging this would be to remove the collect command from your pipeline and see what the results look like.

 

0 Karma

sintjm
Path Finder

so there is a field in the log named data and that's where i need my log from. I also removed spath command from the query. Removing the collect command still shows the log curled from the endpoint.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

"does not allow" is a bit vague - what errors do you get? what shows up in the log? what other information do you have?

0 Karma

sintjm
Path Finder

There was no logs showing after i searched the index, sorry

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What about the logs after the collect?

0 Karma

sintjm
Path Finder

sintjm_1-1720695110555.png

 

 

0 Karma
Get Updates on the Splunk Community!

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...

Application management with Targeted Application Install for Victoria Experience

Experience a new era of flexibility in managing your Splunk Cloud Platform apps! With Targeted Application ...