description: Pipeline for parsing logstash slow logs
processors:
- set:
    field: event.ingested
    value: '{{_ingest.timestamp}}'
- 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:
      - first_char
on_failure:
  - set:
      field: error.message
      value: '{{ _ingest.on_failure_message }}'
