Documentation: 3.1.5
Print Version Contents
This page last updated: 10/16/07 01:10pm

CLI for search

Note: this page has not been fully updated for 3.0.

The command-line search API supports the exact same syntax as the Splunk box, with additonal parameters.

Actions

  • search

Default Argument

  • search-string (same format as Splunk box)

Parameters

  • -output
    • splunkui (default)
    • scheduler
    • rawevents
  • -format
    • normal (default)
    • xml
  • -get <type>::<range start>-<range end>
    • events (default)
    • types
    • hosts
    • sourcetypes
    • sources

where range is n items returned from the full results. Example:

splunk search 404 -get sources::0-9

returns the first 10 sources from the specified search.

  • future -get parameters (not yet implemented)
    • matching
    • timebuckets
    • report
    • samplesfortypes
    • eventtags
    • sourcetypetags
    • hosttags
    • report

Example

splunk search -get hosts "smtp NOT success hoursago::1"

By default only 100 events are returned when a search is done from the CLI. This can be changed by adding maxresults:: to your search. For large searches, we recommend you use the "raw" output type to reduce memory usage.

splunk search -output rawevents "meta::all minutesago::120 maxresults::100000" 
Previous: Customizing alert options    |    Next: TCP Output

Comments

No comments have been submitted.

Log in to comment.