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 | Magnitude of the input field. Accepted values: ns, us, ms, s, m, h, d. Defaults to ms. | |
precision | number | false | Number of units to use in the output. If zero (default), all units are used. | |
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)