我目前有以下设置:
syslog-ng 服务器 --> Logstash --> ElasticSearch
syslog-ng 服务器是负载平衡的,并写入到 SAN 位置,Logstash 只是在该位置跟踪文件并将它们发送到 ES。我目前正在接收大约 1,300 个事件/秒到 syslog 集群的网络日志。我遇到的问题是日志在 ES 中实际可搜索的时间逐渐延迟。当我启动集群(4 个节点)时,它已经死了。然后落后几分钟,现在 4 天后落后了约 35 分钟。我可以确认日志正在 syslog-ng 服务器上实时写入,我还可以确认我的 4 个使用相同概念但不同 Logstash 实例的其他索引保持最新。但是,它们要低得多(约 500 个事件/秒)。
似乎正在读取平面文件的 Logstash 实例无法跟上。我已经将这些文件分离了一次并生成了 2 个 Logstash 实例以提供帮助,但我仍然落后。
任何帮助将不胜感激。
--
典型的输入是 ASA 日志,主要是拒绝和 VPN 连接
Jan 7 00:00:00 firewall1.domain.com Jan 06 2016 23:00:00 firewall1 : %ASA-1-106023: Deny udp src outside:192.168.1.1/22245 dst DMZ_1:10.5.1.1/33434 by access-group "acl_out" [0x0, 0x0]
Jan 7 00:00:00 firewall2.domain.com %ASA-1-106023: Deny udp src console_1:10.1.1.2/28134 dst CUSTOMER_094:2.2.2.2/514 by access-group "acl_2569" [0x0, 0x0]
这是我的 Logstash 配置。
input {
file {
type => "network-syslog"
exclude => ["*.gz"]
start_position => "end"
path => [ "/location1/*.log","/location2/*.log","/location2/*.log"]
sincedb_path => "/etc/logstash/.sincedb-network"
}
}
filter {
grok {
overwrite => [ "message", "host" ]
patterns_dir => "/etc/logstash/logstash-2.1.1/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-2.0.2/patterns"
match => [
"message", "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:host} %%{CISCOTAG:ciscotag}: %{GREEDYDATA:message}",
"message", "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:host} %{GREEDYDATA:message}"
]
}
grok {
match => [
"message", "%{CISCOFW106001}",
"message", "%{CISCOFW106006_106007_106010}",
"message", "%{CISCOFW106014}",
"message", "%{CISCOFW106015}",
"message", "%{CISCOFW106021}",
"message", "%{CISCOFW106023}",
"message", "%{CISCOFW106100}",
"message", "%{CISCOFW110002}",
"message", "%{CISCOFW302010}",
"message", "%{CISCOFW302013_302014_302015_302016}",
"message", "%{CISCOFW302020_302021}",
"message", "%{CISCOFW305011}",
"message", "%{CISCOFW313001_313004_313008}",
"message", "%{CISCOFW313005}",
"message", "%{CISCOFW402117}",
"message", "%{CISCOFW402119}",
"message", "%{CISCOFW419001}",
"message", "%{CISCOFW419002}",
"message", "%{CISCOFW500004}",
"message", "%{CISCOFW602303_602304}",
"message", "%{CISCOFW710001_710002_710003_710005_710006}",
"message", "%{CISCOFW713172}",
"message", "%{CISCOFW733100}",
"message", "%{GREEDYDATA}"
]
}
syslog_pri { }
date {
"match" => [ "syslog_timestamp", "MMM d HH:mm:ss",
"MMM dd HH:mm:ss" ]
target => "@timestamp"
}
mutate {
remove_field => [ "syslog_facility", "syslog_facility_code", "syslog_severity", "syslog_severity_code"]
}
}
output {
elasticsearch {
hosts => ["server1","server2","server3"]
index => "network-%{+YYYY.MM.dd}"
template => "/etc/logstash/logstash-2.1.1/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.2.0-java/lib/logstash/outputs/elasticsearch/elasticsearch-network.json"
template_name => "network"
}
}
-w N
可以使用命令行选项告诉 LS 为每个实例启动更多工作程序,其中 N 是一个数字。这应该会大大增加您的事件吞吐量。
我不知道你的确切服务器布局,但启动一半的工作人员可能是安全的,因为你的 LS 盒子上有核心,但要根据它执行的其他功能进行调整。