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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...