Pie charts are useful for visually comparing the percentage of events that have occurred, such as the type of error that occurs the most in your system. A pie chart will compare different values for the same field. If you want to compare values for different fields consider using a histogram.
To create a pie chart, use an aggregate query that provides at least a few results in the Aggregates tab.
For example, you could use the following simple query to get results from your logs:
(error OR fail*) AND exception | count by _sourceCategory | sort by _count
which would produce results such as:
Create a pie chart
- Create or open a Dashboard (New) and click on Add Panel > Categorical.
- Provide a Log or Metric 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. A few important things to note are:
- 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.
- Joining log queries in a separate query is not supported.
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 you’ll need to flip the chart type to Pie.
- 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.