Skip to content

Instantly share code, notes, and snippets.

@phumpal
Created September 24, 2015 06:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phumpal/cc9d8fa428f2df6495e9 to your computer and use it in GitHub Desktop.
Save phumpal/cc9d8fa428f2df6495e9 to your computer and use it in GitHub Desktop.
Redis Logstash Filter
input {
file {
path => "/var/log/redis/redis-server.log"
start_position => "beginning"
type => "redis"
add_field => { "role" => "redis" }
}
}
filter {
if [type] == "redis" {
grok {
pattern => [ "%{POSINT:redis_pid}:[A-Z] %{MONTHDAY} %{MONTH} %{HOUR}:%{MINUTE}:%{SECOND} \* %{GREEDYDATA:redis_message}" ]
}
mutate {
remove_field => "message"
}
mutate {
rename => [ "redis_message", "message" ]
}
}
}
@gempir
Copy link

gempir commented Jan 3, 2022

Newer versions seem to include the year, also some messages have a # instead of a *

%{POSINT:redis_pid}:[A-Z] %{MONTHDAY} %{MONTH} %{YEAR} %{HOUR}:%{MINUTE}:%{SECOND} [#*] %{GREEDYDATA:log_message}

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