Skip to main content
Version: 1.4.0

Min

Arithmetic Data Analysis

Synopsis

Calculates the minimum value between two numeric operands.

Schema

- min:
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:

FieldRequiredDefaultDescription
fieldY-Target field to store the minimum value
left_operandY-First value to compare - can be a literal value or field reference
right_operandY-Second value to compare - can be a literal value or field reference
descriptionN-Explanatory note
ifN-Condition to run
ignore_failureNfalseContinue processing if comparison fails
ignore_missingNfalseSkip if referenced fields don't exist
on_failureN-Error handling processors
on_successN-Success handling processors
tagN-Identifier

Details

Compares two numeric values and stores the smaller value in the target field. The processor can use literal values or extract values from existing fields in the log entry.

note

Numeric values are automatically converted to appropriate types for comparison. The processor accepts both literal values and field references for operands.

The processor is useful for finding minimum values, implementing floor functions, and ensuring values don't exceed maximum thresholds.

warning

If either operand cannot be converted to a number, the processor will fail unless ignore_failure is set to true. Always ensure inputs are valid numbers or provide proper error handling.

Examples

Basic

Comparing two literal values...

{
"values": {}
}
- min:
field: values.min_value
left_operand: "42"
right_operand: "17"

stores the smaller value:

{
"values": {
"min_value": 17
}
}

Field-Based

Finding minimum between field values...

{
"temperature": {
"morning": 15.2,
"afternoon": 23.8,
"evening": 18.5
}
}
- min:
field: temperature.min_morning_afternoon
left_operand: "temperature.morning"
right_operand: "temperature.afternoon"
- min:
field: temperature.daily_min
left_operand: "temperature.min_morning_afternoon"
right_operand: "temperature.evening"

finds lowest temperature of the day:

{
"temperature": {
"morning": 15.2,
"afternoon": 23.8,
"evening": 18.5,
"min_morning_afternoon": 15.2,
"daily_min": 15.2
}
}

Thresholds

Ensuring value doesn't exceed threshold...

{
"bandwidth": {
"requested": 2000
},
"limits": {
"max_bandwidth": 1500
}
}
- min:
field: bandwidth.allocated
left_operand: "bandwidth.requested"
right_operand: "limits.max_bandwidth"

enforces maximum limit:

{
"bandwidth": {
"requested": 2000,
"allocated": 1500
},
"limits": {
"max_bandwidth": 1500
}
}

Resource Allocation

Allocating resources based on availability...

{
"process": {
"requested_memory": 8192,
"requested_cpu": 4
},
"system": {
"available_memory": 4096,
"available_cpu": 8
}
}
- min:
field: process.allocated_memory
left_operand: "process.requested_memory"
right_operand: "system.available_memory"
- min:
field: process.allocated_cpu
left_operand: "process.requested_cpu"
right_operand: "system.available_cpu"

uses minimum of requested vs. available:

{
"process": {
"requested_memory": 8192,
"requested_cpu": 4,
"allocated_memory": 4096,
"allocated_cpu": 4
},
"system": {
"available_memory": 4096,
"available_cpu": 8
}
}