Splunk Search

curl fields order on export csv

sloshburch
Splunk Employee
Splunk Employee

When running a curl for servicesNS/-/-/search/jobs/export -d search="savedsearch temp" -d output_mode=csv

I see that the fields do not output in the order as defined by the underlying search.

Conversely, when running the same curl, but removing the -d output_mode=csv, I see the fields output in the correct order.

Before opening a bug, I figured I'd check with the community. Has anyone seen this before? Known issue or by design?

Tags (3)
1 Solution

sloshburch
Splunk Employee
Splunk Employee

Oh, yes! So the answer is that the cosmetics of the search, in this case the field ordering, happen on the search UI. So it turns out the command line search doesn't do this formatting and therefore the field order is disregarded.

I highlighted that this is misleading. There is no warning to the user that they are attempting to use a command (fields, table) which will not have expected behavior.

I have case 190546 open for a feature request to "So that the order when using output=csv and the default xml output mode are consistent."

View solution in original post

sloshburch
Splunk Employee
Splunk Employee

Oh, yes! So the answer is that the cosmetics of the search, in this case the field ordering, happen on the search UI. So it turns out the command line search doesn't do this formatting and therefore the field order is disregarded.

I highlighted that this is misleading. There is no warning to the user that they are attempting to use a command (fields, table) which will not have expected behavior.

I have case 190546 open for a feature request to "So that the order when using output=csv and the default xml output mode are consistent."

cphair
Builder

Good to know. Thanks.

0 Karma

cphair
Builder

@SloshBurch, did you get an answer from Splunk on this? I'm seeing a similar behavior.

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...