Divide
Synopsis
Performs division operations on numeric values.
Schema
- divide:
field: <ident>
left_operand: <string>
right_operand: <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 | - | Target field to store the division result |
left_operand | Y | - | Dividend (numerator) - can be a literal value or field reference |
right_operand | Y | - | Divisor (denominator) - can be a literal value or field reference |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if division fails |
ignore_missing | N | false | Skip if referenced fields don't exist |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
tag | N | - | Identifier |
Details
Performs a division operation between two numeric values and stores the result in a target field. The processor can use literal values or extract values from existing fields in the log entry.
Numeric values are automatically converted to appropriate types for calculation. The processor accepts both literal values and field references for operands.
The processor automatically handles type conversion for numeric values and provides proper error handling for division by zero and missing fields.
Division by zero will cause the processor to fail unless ignore_failure
is set to true
. Always validate input data or provide proper error handling for cases where the right operand might be zero.
Examples
Basic
Dividing two literal values... |
|
calculates and stores the result: |
|
Field-Based
Dividing values from existing fields... |
|
computes the ratio: |
|
Mixed Operands
Combining field value and literal... |
|
converts units: |
|
Error Handling
Handling potential errors gracefully... |
|
avoids raising exceptions: |
|