Getting Data In

search/jobs/export does not return results with empty column headers

testingteam
Engager

I using the following command to retrieve a particular macro search result.

curl -k -u admin:admin https://:8089/services/search/jobs/export --data search="search `network_macro(index_name,report_name,server_name,1h)`" -d output_mode=csv

Expected result:
"_time",ServerName,Freq,Bandwidth
"2013-06-03 06:00:00.000 UTC",server1,"74.730000",""
"2013-06-03 07:00:00.000 UTC",server2,"74.730000",""

But the actual result is :
"_time",ServerName,Freq
"2013-06-03 06:00:00.000 UTC",server1,"74.730000"
"2013-06-03 07:00:00.000 UTC",server2,"74.730000"

The column that have empty result has not been returned.

But it is worked well while using
search/jobs/{search_id}
search/jobs/{search_id}/results commands.
I am using Splunk 4.3.1 .

How can we get those empty result columns by using the search/jobs/export url.

Tags (2)
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi testingteam

try to use your search with the fillnull command, read more here http://docs.splunk.com/Documentation/Splunk/5.0.3/SearchReference/Fillnull

hope this helps, MuS

testingteam
Engager

Thanks Mus,for your answer.
I have 'n'number of columns.Adding 'fillnull' with all the Columnn names for each query, its hard.

Same macro in 'Search Head' thru Web GUI,the macro result contains all the column names (if data not exist,it displays empty).But in rest api(specifically /jobs/export) why its not returning all the columns.

/jobs/{search_id}/results url gives the expected results then why /jobs/export suppress the columns which not have data.

I expected all the column names(heading) should be returned with the result even it have data or not.

Is there any other way ? Plz help me.

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 ...