{
    "description": "Pipeline for parsing elasticsearch deprecation logs",
    "processors": [
        {
            "rename": {
                "field": "@timestamp",
                "target_field": "event.created"
            }
        },
        {
            "grok": {
                "field": "message",
                "patterns": [
                    "^%{CHAR:first_char}"
                ],
                "pattern_definitions": {
                    "CHAR": "."
                }
            }
        },
        {
            "pipeline": {
                "if": "ctx.first_char != '{'",
                "name": "{< IngestPipeline "pipeline-plaintext" >}"
            }
        },
        {
            "pipeline": {
                "if": "ctx.first_char == '{'",
                "name": "{< IngestPipeline "pipeline-json" >}"
            }
        },
        {
            "remove": {
                "field": "elasticsearch.deprecation.timestamp"
            }
        },
        {
            "remove": {
                "field": [
                    "first_char"
                ]
            }
        }
    ],
    "on_failure": [
        {
            "set": {
                "field": "error.message",
                "value": "{{ _ingest.on_failure_message }}"
            }
        }
    ]
}
