Other Usage

How to filter events with exporttool?

sam
Explorer

Hi I'm attempting to export a subset of events from an index, but no matter what option I put in the export_search portion of the command line I get nothing exported. Below is a simple example of that I have tried that doesn't work. I get the same results on 4.3.1 and 4.2.5.

 # $SPLUNK_HOME/splunk cmd exporttool \
    $SPLUNK_HOME/var/lib/splunk/_internaldb/db/db_1332952458_1332950725_3/ \
    /tmp/test.csv -csv 'search index=_internal source!="*/splunk-0/var/log/splunk/web_service.log"'
Using logging configuration at $SPLUNK_HOME/etc/log-cmdline.cfg.
no events
Tags (2)

hnorvik
Explorer

This is an old thread, but maybe someone gets some help from this....

It looks like you can't search in the _raw record of the data, however it is possible to filter on host or some of the other fields created at index time. 

If you look in a non-filtered CSV you will see the syntax for host. The filter for export_search would then be 'host::<hostname>'

Note that exporttool is unsupported, so a better alternative may be ./splunk export which may filter on other terms.

0 Karma

jt_splunk
Explorer

If you paste your search directly into the splunk web interface, do you get the expected results? If so, have you tried running "splunk search" from the cmd line instead of "exporttool"? Do you get the same results as in the GUI?

sam
Explorer

When I remove 'search' from the beginning of the query, yes the GUI and command line both return the same results. But searching with or without 'search' at the start I still get no results from exporttool.

0 Karma
Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...