Skip to content

Instantly share code, notes, and snippets.

@pauloconnor
Last active December 1, 2022 09:33
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauloconnor/4707710 to your computer and use it in GitHub Desktop.
Save pauloconnor/4707710 to your computer and use it in GitHub Desktop.
Logstash Mutate Filter for stripping Linux color codes from log files
# Get rid of color codes
mutate {
gsub => ["message", "\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", ""]
}
@ns-smehra
Copy link

How does this work though ?

@konart
Copy link

konart commented May 8, 2020

How does this work though ?

Well it literally removes ANSI color codes from the message field with gsub.

@abhinav1107
Copy link

works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment