timewrap command overview
timewrap command displays, or wraps, the output of the
timechart command so that every period of time is a different series.
timewrap command to compare data over specific time period, such as day-over-day or month-over-month. You can also use the
timewrap command to compare multiple time periods, such as a two week period over another two week period. See timewrap command syntax details.
The required syntax is in bold.
- [align=now | end]
How the timewrap command works
timewrap command is used with the
timechart command, let's start with that.
The following search counts the number of earthquakes in Alaska where the magnitude is greater than or equal to 5.3. The results are organized in spans of 1 day.
|search source=all_month.csv place=*alaska* mag>=5.3 | timechart count() span=1d
The results look something like this:
|The results continue through 2019-09-23 but are truncated in this example.|
Combining the timewrap and timechart commands
Now let's add the
timewrap command to the search and specify a <timewrap-span> of
|search source=all_month.csv place=*alaska* mag>=5.3 | timechart count() span=1d | timewrap 1week
The results are organized based on the day you run the search, which in this example 2019-10-02. Going back in 1 week increments to the week that the data starts (2019-09-08), the results look something like this:
Using the <timewrap-span> argument
The <timewrap-span> you specify controls how many rows are returned in the results and the ranges for the counts displayed in the columns. The <timewrap-span> specified is
1week so there are 7 rows in the output. Counting back from 2019-10-02, there are 3 weeks between 2019-10-02 and 2019-09-08, which is why the column headings refer to 3 weeks, 2 weeks, and 1 week before.
The first date in the output is 2019-09-26. Counting back 3 weeks is 2019-09-05. There are no events for that date, which is why the output contains no value in the column
3weeks_before for 2019-09-26.
Look at the date 2019-09-29. Counting back 3 weeks is 2019-09-08. There is 1 earthquake for that date, as shown in the results for the first search.
This pattern continues for the rest of the results.
- Related information
- timechart command overview
timechart command examples
timewrap command syntax details
This documentation applies to the following versions of Splunk® Cloud Services: current