美文网首页ELK集锦
ELK - SSH 登陆日志分析

ELK - SSH 登陆日志分析

作者: 浅色的嗥啸 | 来源:发表于2016-12-14 16:07 被阅读101次

正则表达式
91221.elk.node1.com<2016-12-14 16:06:15> /opt/logstash-2.4.1/patterns
root># cat syslog
SECURELOG %{WORD:program}[%{DATA:pid}]: %{WORD:status} password for ?(invalid user)? %{WORD:USER} from %{DATA:IP} port

logstash配置文件
91221.elk.node1.com<2016-12-14 16:07:07> /opt/logstash-2.4.1/conf
root># cat sys_log.conf
input {
file {
type => "seclog"
path => "/var/log/secure"
}
}
filter {
if [type] == "seclog" {
grok {
match => { "message" => "%{SYSLOGPAMSESSION}" }
match => { "message" => "%{SECURELOG}" }
match => { "message" => "%{SYSLOGBASE2}" }
}
geoip {
source => "IP"
fields => ["city_name"]
database => "/opt/logstash-2.4.1/conf/GeoLiteCity.dat"
}
if ([status] == "Accepted") {
mutate {
add_tag => ["Success"]
}
}
else if ([status] == "Failed") {
mutate {
add_tag => ["Failed"]
}
}

}

}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["192.168.91.221:9200", "192.168.91.222:9200", "192.168.91.223:9200"]
#hosts => ["192.168.91.221:9200"]
index => "sshd_log-%{+YYYY.MM}"
}
}

相关文章

网友评论

    本文标题:ELK - SSH 登陆日志分析

    本文链接:https://www.haomeiwen.com/subject/ghgimttx.html