filebeat -> logstash -> elasticsearch ->kibana
filebeat(多台) -> logstash 通过正则提取有效数据 -> elastic ->kibana
如果需要扩logstash的话,logstash前搭个负载均衡或者引入redis。
filebeat(多台) -> 负载均衡(或者redis) -> logstash 通过正则提取有效数据 -> elastic ->kibana
redis服务器说明:监听在127.0.0.1本机,设置密码为test1234
2: filebeat配置:/usr/local/filebeat-6.1.1/filebeat.yml
backoff: "1s" #every second check log file
- /usr/local/nginx/logs/kibana_access.log
3: logstash配置:/usr/local/logstash-6.1.1/config/logstash.conf
#125.119.2.71 - elk [17/Mar/2018:17:40:11 +0800] "POST /elasticsearch/_msearch HTTP/1.1" 200 9550 "http://144.202.123.228:5609/app/kibana" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36" "-"
"message" => '(?<source_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - [a-zA-Z0-9-]+ \[(?<nginx_time>[^ ]+) \+\d+\] "(?<method>[A-Z]+) (?<request_url>[^ ]+) HTTP/\d.\d" (?<status>\d+) \d+ "(?<referer>[^"]+)" "(?<agent>[^"]+)" ".*"'
match => ["nginx_time", "dd/MMM/yyyy:HH:mm:ss"]
hosts => ["http://127.0.0.1:9200"]