sometimes

Probabilistic pipeline execution

sometimes

Executes a pipeline probabilistically. Returns the pipeline's result if executed, or ignore if skipped.

Syntax

sometimes <probability> {
    actions...
} else {
    actions...
}

probability: Specify as percentage (10%) or ratio (1/10000 for fine-grained control)

The else block is optional and executes when the probability check fails.

Note: Plain numbers without % (e.g., 10) are supported for backwards compatibility but deprecated.

Example

Sample 10% of requests for detailed logging:

sometimes 10% {
    debug "User: %{aaa.identity} from %{radius.client.ip}";
} else {
    # Remaining 90% execute this
    debug "Skipped sampling";
}

See Also