Skip to content

Substitue Processor

orbenharosh edited this page Nov 3, 2022 · 12 revisions

Substitue [gsub]

This processor allows you to search a field for a value based on a regex and then replace it with another value.

  • field
  • pattern
  • replacement

Examples

Removing an array:

{
  "steps": [
    {
      "gsub": {
        "config": {
          "field": "message",
          "pattern": "(\\(|\\)|\\[|\\])",
          "replacement": ""
        }
      }
    }
  ]
}

Removing slashs

{
  "steps": [
    {
      "gsub": {
        "config": {
          "field": "message",
          "pattren": "\\\\",
          "replacement": ""
        }
      }
    }
  ]
}

Change json_key to "_":

{
  "steps": [
    {
      "gsub": {
        "config": {
          "field": "parsed_json_key",
          "pattern": "[\\s/\\\\?#-\\.]",
          "replacement": "_"
        }
      }
    }
  ]
}
Clone this wiki locally