Substitue Processor - logzio/sawmill GitHub Wiki
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",
"pattern": "\\\\",
"replacement": ""
}
}
}
]
}
Change json_key to "_":
{
"steps": [
{
"gsub": {
"config": {
"field": "parsed_json_key",
"pattern": "[\\s/\\\\?#-\\.]",
"replacement": "_"
}
}
}
]
}