Line charts are useful for displaying how data changes over time, where the Y axis of a line chart displays the count of an item, and the X axis is a timeline.
To create a line chart, you need to use a query that provides more than one data point in the Aggregates tab, see aggregate operators for details. Then the line is drawn between the data points to show the change.
For example, you could use the following query to create a Line chart:
error | timeslice 1m | count by _timeslice
which would produce results such as:
Create a line chart
To add a panel with a line chart:
- Create or open a Dashboard (New) and click on Add Panel > Time Series.
- Provide a Metric or Log query and press Enter for it to run.
You can create Log and Metric queries on the same panel.
Enter your aggregate search query in the input field and press enter. Only search results that have been aggregated using a group or aggregate operator can be charted. See Group or Aggregate Operators for a list. By default, the query builder is set to Logs.
Click the left-most dropdown option and select Metrics. You should be familiar with the basics of creating metrics queries and alerts to ensure successful results. By default, the query builder is set to Logs.
To create a metrics query utilize the Metrics Explorer.
To add another query to a panel click the plus + icon on the last query row. Each query is assigned a letter for reference.
- Once the query runs, ensure the chart type is set to Line.
- Modify the chart as desired.
- Click the Add to Dashboard button on the top right of the window to add the panel to your dashboard.