Skip to content

Instantly share code, notes, and snippets.

@alappe
Created May 27, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alappe/5656509 to your computer and use it in GitHub Desktop.
Save alappe/5656509 to your computer and use it in GitHub Desktop.
filter {
grep {
match => ["message", "sshd"]
add_tag => ["sshd"]
}
grep {
match => ["message", "sshd.+Invalid user .+ from "]
add_tag => ["sshd_invalid_user"]
}
grep {
match => ["message", "sshd.+Received disconnect from "]
add_tag => ["sshd_disconnect"]
}
grep {
match => ["message", "sshd.+Accepted"]
add_tag => ["sshd_connect"]
}
grok {
tags => ["sshd_invalid_user"]
pattern => "%{MONTH:month} %{MONTHDAY:day} %{TIME} %{HOSTNAME:hostname} sshd\[%{INT:pid}\]: Invalid user %%{WORD:username} from %{IP:client}"
}
grok {
tags => ["sshd_disconnect"]
pattern => "%{MONTH:month} %{MONTHDAY:day} %{TIME} %{HOSTNAME:hostname} sshd\[%{INT:pid}\]: Received disconnect from %%{IP:client}.* \[%{WORD:method}\]"
}
grok {
tags => ["sshd_connect"]
pattern => "%{MONTH:month} %{MONTHDAY:day} %{TIME} %{HOSTNAME:hostname} sshd\[%{INT:pid}\]: Accepted %{WORD:method} for %%{WORD:username} from %{IP:client} port %{INT:port}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment