Bytes
Synopsis
Converts string field values expressing size in byte units to their numeric value in bytes.
Schema
- bytes:
field: <ident>
description: <text>
if: <script>
ignore_missing: <boolean>
ignore_failure: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
target_field: <ident>
Configuration
The following fields are used to define the processor:
| Field | Required | Default | Description |
|---|---|---|---|
field | Y | The field containing the unit values | |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_missing | N | `false`` | If true and field does not exist or contains no value, exit quietly without making any modifications |
ignore_failure | N | - | |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
target_field | N | - | Field to assign the converted value to, if distinct from field |
Details
If the field contains multiple values, all of them are converted.
Allowed units are B, KB, MB, GB, TB, and PB, all case insensitive. Fractional values like "1.5KB" are also supported. If the string is not in one of the enumerated formats or exceeds $2^64-1$ in value, an error is raised.
Examples
Basic
Convert size with byte units... | |
to its value in bytes: | |
Unit Variations
The processor handles various unit formats and cases... | |
all converting to the same value: | |
Keep Original
Store the result in a different field... | |
keeping the original value: | |
Error Handling
With invalid formats... | |
errors can be ignored: | |
Missing Fields
When field is missing... | |
processing continues if configured: | |