This documentation does not apply to the most recent version of Splunk.
This documentation applies to the following versions of Splunk: 3.0 , 3.0.1 , 3.0.2 , 3.1 , 3.1.1 , 3.1.2 , 3.1.3 , 3.1.4
Search modifiers are used in the search command, and allow you to modify the results of a search based on time constraints, and other factors. Modifiers are explicitly used within the context of the search command.
There are two types of search modifiers. Search modifiers allow you to specify criteria to narrow your search, and time modifiers that adjust start/stop times and time ranges of your search.
| Time modifiers = | daysago, enddaysago, endhoursago, endminutesago, endmonthsago, endtime, endtimeeu, hoursago, minutesago, monthsago, searchtimespandays, searchtimespanhours, searchtimespanminutes, searchtimespanmonths, startdaysago, starthoursago, startminutesago, startmonthsago, starttime, starttimeeu, timeformat | |
| Search modifiers = | eventtypetag, hosttag, index, maxresults, readlevel, readlimit, related |
In versions 3.0.x modifiers take the format of:
In versions 3.1.x and above, modifiers take the formats:
Most modifiers do not have default values. Modifiers may appear anywhere in a Splunk command before, after, or in between keywords and logical expressions. If a search has conflicting modifiers, the first one from left to right will take precedence.
command argument ... [argument] ...
| argument=syntax and value(default value) | Description, and usage. |
./splunk search "foo | top"
Search events within the last N days.
daysago=integer
Set an end time (in days) that is = now - number specified.
enddaysago=integer
Set an end time (in hours) that is = now - number specified.
endhoursago=integer
Set an end time (in minutes) that is = now - number specified.
endminutesago=integer
Set an end time (in months) that is = now - number specified.
endmonthsago=integer
All events must be before the specified time. Use timeformat to set the time format to use. For example: if timeformat=%m/%d/%Y:%H:%M:%S, then endtime=09/07/1978:09:00:00, and all results are before that time.
endtime=string
Search for events that have hosts that have a matching host tag string.
hosttag=string
Search events within the last N hours.
hoursago=integer
Specifies an index to search (main, default, history, splunklogger, or another admin defined index). If there is more than one index modifier in a search command argument, only the first declaration will be evaluated.
index= "name of index" | name of index
Limit the number of results that your search returns by specifying a maximum number of results. The default number of events for any search to return is 10,000.
maxresults=integer(10000)
Search events within the last N minutes.
minutesago=integer
Search events within the last N months.
monthsago=integer
Specifies how much detail is read from events returned from the search processor. This modifier is only useful in command line searches.
readlevel=level
| level= 0 | 1 | 2 | Different read levels to specify. |
| 0 | Specifies that only the top indexed fields (host,source, sourcetype) get read. |
| 1 | Specifies to read raw data and 2nd order fields in addition to top indexed fields (read level 0). |
| 2 | Specifies a full read of event types in addition to all of the above data. |
Specify the starting point of events within your results to read and return. By default this is set to 0 (to read all events).
readlimit=integer | "integer range"
readlimit="20-29" - Reads events 20-29.
Specifies events that are related to the event of id event_id. The value assigned to a related search is a hash value that only makes sense to the server. Related results are sorted by relevance rather than by time.
related=hash value
related="0:12345"
Search for events that would be found by the specified saved search.
savedsearch=name_of_saved_search
Search within a specified range of minutes (expressed as an integer).
searchtimespanminutes=integer
Search within a specified range of hours (expressed as an integer).
searchtimespanhours=integer
Search within a specified range of days (expressed as an integer).
searchtimespandays=integer
Search within a specified range of months (expressed as an integer).
searchtimespanmonths=integer
Search the specified number of minutes ago from the present time (expressed as an integer).
minutesago=integer
Search the specified number of hours ago from the present time (expressed as an integer).
hoursago=integer
Search the specified number of days ago from the present time (expressed as an integer).
daysago=integer
Search the specified number of months ago from the present time (expressed as an integer).
monthsago=integer
Change the format for the starttime and endtime modifiers. All Splunk searches have the default time format of: %m/%d/%Y:%H:%M:%S.
timeformat=string
| string = | %m/%d/%Y:%H:%M:%S (default = %m/%d/%Y:%H:%M:%S). |