Rounds a numeric input field to the nearest integer, with an optional method to set the rounding type.

ParameterTypeRequiredDefaultDescription
asstringfalse The output name of the field to round. Defaults to the same as the input field.
fieldstringtrue The names of the field to round. [a]
howstringfalseroundMethod used to round the number.
  Valid ValuesceilRound up to the nearest whole number
   floorRound down to the nearest whole number
  Valid ValuesroundStandard rules; i.e. <0.5 rounds down, >0.5 rounds up

[a] When you provide only one parameter, the implied parameter is field

Examples

Basic Rounding

Round a number to the nearest decimal

humio
round(myvalue)

In detail:

  • Rounds the number in myvalue

    humio
    round(myvalue)
Rounding to n Decimal Places

To round a number to a specific number of decimal points, use format() rather than round()

humio
format("%.2", value))

In detail:

  • Round the field value to two decimal places.

    humio
    format("%.2", value))

When using format() rounding, rounding is performed using standard math rules.

Rounding within a Timechart

Round a field and display using a timechart

humio
timechart(function=max(value))

| round(_max, how=floor)

In detail:

  • Create a Time Chart using max() as the aggregate function for the value field.

    humio
    timechart(function=max(value))
  • Round the implied field from the aggregate max() using the floor option to round down the value.

    humio
    | round(_max, how=floor)