The Gauge widget displays a single number, useful for displaying the number of errors per day or the number of active connections to a system.
The Gauge widget can display any data with at least one field containing a number. If there are multiple rows with numeric fields, or there are multiple numeric fields in a row, the widget will present an error.
The Gauge widget is often used in conjunction with functions such as
which produce a single row with a single field like
_sum. The widget can also be used on data where you have produced a single row with only one numeric field in it yourself, should you have numbers that are already displayable as-is. The
functions are very useful for this.
Using the widget’s Style editor, you can configure the widget to assume different colors for different value ranges. For example, you could make the background yellow if the value is >100, and red if it is >500.
If we wanted to show the number of errors in a system, we could count them using:
loglevel = /error/i | count()
This produces a single result with a field
_count. If the Gauge widget is selected, it will automatically select the first numeric field it sees and use it as the value to display.
If you use Humio to monitor how your software is building, your build pipeline might already output the numbers you want, like the number of failed tests. Instead of calculating this number based on the failed tests that have been logged, you can display the number the system has given you:
commit = 67686a1 | /Tests failed: (?<tests_failed>\d+)/ | select(tests_failed)
Assuming there is only one build per commit, this search extracts the number of tests that failed in the build, and uses the
to remove extraneous fields from the row. Without calling
, the row might contain multiple numeric fields, and the Gauge widget would not know what to display.