Snake Case
Synopsis
Converts strings to snake_case format.
Schema
- snakecase:
field: <ident>
target_field: <string>
fields: <array>
exclude: <array>
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 | N | - | Selects value mode: converts the value of this field to snake_case. The value must be a string or an array of strings. Mutually exclusive with fields — when field is set, fields and exclude are ignored |
target_field | N | Same as field | Where the converted value is written in value mode. Ignored in name mode |
fields | N | ["*"] | Selects name mode: glob patterns matching field names to rename to snake_case. The values are left untouched. a.* renames the keys inside object a, *.* those of every root object. Omitting both field and fields renames every root-level field name; names beginning with _ are never renamed |
exclude | N | - | Field names to leave alone in name mode. Has no effect in value mode |
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 |
disabled | N | false | When true, the processor is skipped and the event continues to the next one. Lets you take a processor out of the path without removing its configuration |
Details
Converts string values to snake_case format by replacing spaces, hyphens, dots, and other separators with underscores, then converting all characters to lowercase. This format is commonly used in programming languages like Python, Ruby, and database naming conventions.
The processor handles various input formats including camelCase, PascalCase, kebab-case, and space-separated words, normalizing them to the consistent snake_case style.
snake_case format uses underscores as separators and converts all text to lowercase, resulting in format like "user_name", "api_response_data", or "system_config_value". It's widely used in Python and database schemas.
The processor preserves the logical word boundaries from the input while standardizing the format for consistent usage in code and data storage.
Consecutive separators in the input may result in multiple consecutive underscores in the output. The processor does not automatically clean up redundant separators.
Examples
Basic Conversion
Converting camelCase to snake_case... | |
converts to snake_case: | |
Database Column Names
Creating database-friendly column names... | |
generates database column name: | |
Mixed Format Input
Normalizing mixed separators to snake_case... | |
standardizes all separators: | |
Multiple Fields
Renaming field names to snake_case, leaving values untouched... | |
renames the matched names; the values are unchanged: | |
Configuration Keys
Creating configuration key names... | |
generates configuration key: | |