Humanize
Synopsis
Converts numbers to human-readable format with metric prefixes.
Schema
- humanize:
field: <ident>
target_field: <string>
format: <string>
precision: <integer>
binary: <boolean>
suffix: <string>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing numeric value to humanize |
target_field | N | Same as field | Target field to store humanized result |
format | N | size | Format type: size , number , time , frequency |
precision | N | 1 | Decimal places to show in result |
binary | N | false | Use binary (1024) instead of decimal (1000) base |
suffix | N | - | Custom suffix to append to result |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if conversion fails |
ignore_missing | N | false | Skip processing if referenced field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
Converts numeric values to human-readable format using appropriate metric prefixes (K, M, G, T) or time units. The processor makes large numbers more readable by automatically selecting the appropriate scale and unit.
The processor supports different format types including data sizes, general numbers, time durations, and frequencies, each with appropriate unit conventions.
The processor automatically selects the most appropriate unit based on the magnitude of the input number. For example, 1500000 becomes "1.5M" and 2048 becomes "2.0K" (or "2.0Ki" in binary mode).
When binary
is enabled, the processor uses 1024-based calculations (Ki, Mi, Gi, Ti) instead of 1000-based (K, M, G, T), which is common for memory and storage sizes.
Non-numeric input values will cause the processor to fail unless ignore_failure
is set to true
. Ensure the source field contains valid numeric data.
Examples
Basic Number Humanization
Converting large number to readable format... |
|
creates human-readable size: |
|
Binary Format
Using binary (1024-based) formatting... |
|
formats with binary units: |
|
Time Format
Humanizing time duration in milliseconds... |
|
converts to time units: |
|
Custom Precision
Setting specific decimal precision... |
|
formats with 3 decimal places: |
|
With Custom Suffix
Adding custom suffix to humanized value... |
|
includes custom suffix: |
|