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!

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

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...