Format a duration into a human readable string.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
as | string | false | The output name of the field to set (defaults to the same as the input field). | |
field | string | true | The name of the input field. [a] | |
from | string | false | ms | Magnitude of the input field. |
Valid Values | d | Days | ||
h | Hours | |||
m | Minutes | |||
ms | Milliseconds | |||
ns | Nanoseconds | |||
s | Seconds | |||
us | Microseconds | |||
precision | number | false | 0 | Number of units to use in the output. |
formatDuration()
Examples
Formats a duration into a string. An input event with the field duration
with the value 23452553
results in the
field duration having the value
6h30m52s553ms
.
logscale
formatDuration(duration)
Formats a duration into a string with limited precision. An input event
with the field duration with the value
23452553
results in the field duration
having the value 6h30m52s
.
logscale
formatDuration(duration, precision=3)