Splunk Search

I am trying to run CLI searches and output it to a file but its only giving 100 results.

jsuryaprakash
Path Finder

Hello Everyone,

I am trying to run below query everyday at 6AM through CLI and output the result to new text file. But it's returning only 100 results. I also tried maxout but its not working and giving me some error, I might be missing something here . Can someone help me to get unlimited results for the query below.

/opt/splunk/bin/splunk search 'index =main sourcetype=employee_data_hcprd earliest=-24h@h latest=now |search HR_STATUS="I" | table EMPLID' > /opt/jobdata.txt

Thanks.
Surya

Tags (1)
0 Karma

jowenssi
Path Finder

The new query would be:

/opt/splunk/bin/splunk search "index =main sourcetype=employee_data_hcprd earliest=-24h@h latest=now |search HR_STATUS=\"I\" | table EMPLID"  -maxout 0 > /opt/jobdata.txt

Ayn
Legend

You need the -maxout switch. By default the CLI will only output 100 results but by using this switch you change that. Set it to 0 if you want to output unlimited results.

https://docs.splunk.com/Documentation/Splunk/7.1.0/Search/ExportdatausingCLI

jsuryaprakash
Path Finder

Hi Ayn,

I tried it but its but still its returning the 100 results. Can you modify my above query where exactly to add -maxout switch .

0 Karma

jsuryaprakash
Path Finder

Thanks , got it working.

0 Karma

jowenssi
Path Finder

The new query would be:

/opt/splunk/bin/splunk search "index =main sourcetype=employee_data_hcprd earliest=-24h@h latest=now |search HR_STATUS="I" | table EMPLID"  -maxout 0 > /opt/jobdata.txt
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...