Splunk Search

Using the Splunk SDK for PHP, how do I output a search result in a CSV file?

ektasiwani
Communicator

Hi,

I want to get results of a search in a CSV file.
I tried this, but its giving me error HTTP 400 Invalid output mode specified (CSV).

$searchParams = array(
    'output_mode' => 'CSV',
    'earliest_time' => '-60m@m',    
    'latest_time' => 'now'

    );

If I remove the output_mode parameter, I am getting a normal result (I mean result on browser screen) and I am using wamp for this.
I tried with oneshot search and blocking search, but both result in the same error.

Thanks

0 Karma
1 Solution

goodsellt
Contributor

Hey, you've probably figured this out, however it does not recognize any of the "output_mode" parameters in anything other than all lowercase, so you'll get that error until you change it to "csv" and so on for the others.

View solution in original post

goodsellt
Contributor

Hey, you've probably figured this out, however it does not recognize any of the "output_mode" parameters in anything other than all lowercase, so you'll get that error until you change it to "csv" and so on for the others.

_smp_
Builder

Bingo, thanks for this response.

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