What is Splunk Timechart?

The Splunk timechart command generates a table of summary statistics. This table can then be formatted as a chart visualization, where your data is plotted against an x-axis that is always a time field. Use the timechart command to display statistical trends over time You can split the data with another field as a separate series in the chart. Time chart visualizations are usually line, area, or column charts.

Use the timechart command, the x-axis represents time. The y-axis can be any other field value, count of values, or statistical calculation of a field value.

Syntax: timechart [sep=<string>] [partial=<bool>] [cont=<t|f>] [limit=<int>] [agg=<stats-agg-term>] [<bucketing-option> ]* (<single-agg> [by <split-by-clause>] ) | ( (<eval-expression>) by <split-by-clause> )

Required arguments

When specifying timechart arguments, either <single-agg> or <eval-expression> BY <split-by-clause> is required.


Syntax: <field> (<tc-option>)* [<where-clause>]

Description: Specifies a field to split by. If field is numerical, default discretization is applied; discretization is defined with tc-option.


Syntax: count|<stats-func>(<field>)

Description: A single aggregation applied to a single field (can be evaled field). No wildcards are allowed. The field must be specified, except when using the special 'count' aggregator that applies to events as a whole.


Syntax: <math-exp> | <concat-exp> | <compare-exp> | bool-exp> | <function-call>

Description: A combination of literals, fields, operators, and functions that represent the value of your destination field. The following are the basic operations you can perform with eval. For these evaluations to work, your values need to be valid for the type of operation. For example, with the exception of addition, arithmetic operations may not produce valid results if the values are not numerical. Additionally, Splunk can concatenate the two operands if they are both strings. When concatenating values with '.', Splunk treats both values as strings regardless of their actual type.


Syntax: <stats-agg-term>

Description: See the Stats functions section below. For a list of stats functions with descriptions and examples, see"Functions for stats, chart, and timechart".

Accelerate Your Career With Splunk Training and become expertise Splunk Developer.

bucketing option

Syntax: bins | minspan | span | <start-end>

Description: Discretization options. If a bucketing option is not supplied, timechart defaults to bins=100. bins sets the maximum number of bins, not the target number of bins.


Syntax: <stats-agg-term>

Description: See the Stats functions section below. For a list of stats functions with descriptions and examples, seeStatistical and charting functions in this manual.


Syntax: bins | minspan | span | <start-end>

Description: Options that you can use to specify discreet bins, or groups, to organize the information. The bin-optionsset the maximum number of bins, not the target number of bins. See the Bin options section in this topic.Default: bins=100


Syntax: fixedrange=<bool>

Description: (Not valid for 4.2) Specify whether or not to enforce the earliest and latest times of the search. Setting fixedrange=false allows the timechart command to constrict to just the time range with valid data.Default: true


Syntax: format=<string>

Description: Used to construct output field names when multiple data series are used in conjunction with a split-by-field. format takes precedence over sep and allows you to specify a parameterized expression with the stats aggregator and function ($AGG$) and the value of the split-by-field ($VALUE$).


Syntax: limit=<int>

Description: Specifies a limit for the number of distinct values of the split-by field to return. If set to limit=0, all distinct values are used. Setting limit=N keeps the N highest scoring distinct values of the split-by field. All other values are grouped into 'OTHER', as long as useother is not set to false.

-The scoring is determined as follows:

  • If a single aggregation is specified, the score is based on the sum of the values in the aggregation for that split-by value. For example, for timechart avg(foo) BY <field> the avg(foo) values are added up for each value of <field> to determine the scores.
  • If multiple aggregations are specified, the score is based on the frequency of each value of <field>. For example, for timechart avg(foo) max(bar) BY <field>, the top scoring values for <field> are the most common values of <field>.

    1. Ties in scoring are broken lexicographically, based on the value of the


    field. For example, 'BAR' take precedence over 'bar', which takes precedence over 'foo'.


Syntax: partial=<bool>

Description: Controls if partial time bins should be retained or not. Only the first and last bin can be partial.

Default: True. Partial time bins are retained.


Syntax: sep=<string>

Description: Used to construct output field names when multiple data series are used in conjunctions with a split-by field. This is equivalent to setting format to $AGG$<sep>$VALUE$.

Stats options


Syntax: <stats-func> ( <evaled-field> | <wc-field> ) [AS <wc-field>]

Description: A statistical aggregation function. Use the AS clause to place the result into a new field with a name that you specify. The function can be applied to an eval expression, or to a field or set of fields. You can use wild card characters in field names.


Syntax: avg() | c() | count() | dc() | distinct_count() | earliest() | estdc() | estdc_error() | exactperc<int>() | first() | last() | latest() | list() | max() | median() | min() | mode() | p<in>() | perc<int>() | per_day() | per_hour() | per_minute() | per_second() |range() | stdev() | stdevp() | sum() | sumsq() | upperperc<int>() | values() | var() | varp()

Description: Functions you can use with the timechart command. Each time you invoke the timechart command, you can specify more than one function.

Bin options


Syntax: bins=<int>

Description: Sets the maximum number of bins to discretize into. This does not set the target number of bins. It finds the smallest bin size that results in no more than N distinct bins. Even though you specify a number such as 300, the resulting number of bins might be much lower.

Default: 100


Syntax: minspan=<span-length>

Description: Specifies the smallest span granularity to use automatically inferring span from the data time range.


Syntax: span=<log-span> | span=<span-length>

Description: Sets the size of each bin, using a span length based on time or log-based span.


Syntax: end=<num> | start=<num>

Description:Sets the minimum and maximum extents for numerical bins. Data outside of the [start, end] range is discarded.

Span options


Syntax: [<num>]log[<num>]

Description: Sets to log-based span. The first number is a coefficient. The second number is the base. If the first number is supplied, it must be a real number >= 1.0 and < base. Base, if supplied, must be real number > 1.0 (strictly greater than 1).


Syntax: <int>[<timescale>]

Description: A span of each bin, based on time. If the timescale is provided, this is used as a time range. If not, this is an absolute bin length.


Syntax: <sec> | <min> | <hr> | <day> | <week> | <month> | <subseconds>

Description: Time scale units.

Time scaleSyntaxDescription
<sec>s | sec | secs | second | secondsTime scale in seconds.
<min>m | min | mins | minute | minutesTime scale in minutes.
<hr>h | hr | hrs | hour | hoursTime scale in hours.
<day>d | day | daysTime scale in days.
<month>mon | month | monthsTime scale in months.
<subseconds>us | ms | cs | dsTime scale in microseconds (us), milliseconds (ms), centiseconds (cs), or deciseconds (ds)

tc options

The <tc-option> is part of the <split-by-clause>.


Syntax: <bin-options> | usenull=<bool> | useother=<bool> | nullstr=<string> | otherstr=<string>

Description: Options for controlling the behavior of splitting by a field.


See the Bin options section in this topic.


Syntax: nullstr=<string>

Description: If usenull is true, this series is labeled by the value of the nullstr option.

Default: NULL


Syntax: otherstr=<string>

Description: If useother is True, this series is labeled by the value of the otherstr option.

Default: OTHER


Syntax: usenull=<bool>

Description: Controls whether or not a series is created for events that do not contain the split-by field.


Syntax: useother=<bool>

Description: Specifies if a series should be added for data series not included in the graph because they did not meet the criteria of the <where-clause>.

Default: True

where clause

The <where-clause> is part of the <split-by-clause>.

where clause

Syntax: <single-agg> <where-comp>

Description: Specifies the criteria for including particular data series when a field is given in the tc-by-clause. The most common use of this option is to select for spikes rather than overall mass of distribution in series selection. The default value finds the top ten series by area under the curve. Alternately one could replace sum with max to find the series with the ten highest spikes.This has no relation to the where command.


Syntax: <wherein-comp> | <wherethresh-comp>

Description: A criteria for the where clause.


Syntax: (in | notin) (top | bottom)<int>

Description: A where-clause criteria that requires the aggregated series value be in or not in some top or bottom grouping.


Syntax: (< | >)( )?<num>

Description: A where-clause criteria that requires the aggregated series value be greater than or less than some numeric threshold.


bins and span arguments

The timechart command accepts either the bins argument OR the span argument. If you do not specify either binsor span, the timechart command uses the default bins=100.

Default time spans

It you use the predefined time ranges in the time range picker, and do not specify the span argument, the following table shows the default span that is used.

Time rangeDefault span
Last 15 minutes10 seconds
Last 60 minutes1 minute
Last 4 hours5 minutes
Last 24 hours30 minutes
Last 7 days1 day
Last 30 days1 day
Previous year1 month

For an Indepth knowledge on Splunk, click on below