ELK采集之nginx 之高德地图出城市IP分布图.pdfVIP

  • 57
  • 0
  • 约1.04万字
  • 约 8页
  • 2017-06-05 发布于河南
  • 举报

ELK采集之nginx 之高德地图出城市IP分布图.pdf

ELK采集之nginx 之高德地图出城市IP分布图

ELK 采集之nginx 之高德地图出城市IP 分布图 1、 采用拓扑: agent redis indexer es 角色扮演: Agent:采用 logstash,IP: Redis 队列: IP:00 Indexer:logstash,IP:05 Es+kibana:放在00 (大的日志环境可以单独存放) 说明:由于可能我线上环境跟大家的日志生成格式不一样,这里主要列举大概配置,后续添 加统一配置: log_format backend $http_x_forwarded_for [$time_local] $host $request $status $body_bytes_sent $http_referer $http_user_agent Agent 配置: [luohui@BJ-huasuan-h-web-07 ~]$ cat /home/luohui/logstash-5.0.0/etc/logstash- nginx.conf input { file { path = [/home/data/logs/access.log] type = nginx_access } } output { if [type] == nginx_access{ redis { host = [00:6379] data_type =list key = nginx } } } ##说明:这里的agent 只是做日志发送,对性能影响不大,读取access.log 日志文件,并且 发送到远端redis。 Indexer 配置: [root@mail etc]# cat logstash_nginx.conf input { redis { host = 00 port = 6379 data_type = list key = nginx } } filter { grok { match = {message = %{IPORHOST:clientip} \[%{HTTPDATE:timestam p}\] %{NOTSPACE:http_name} \(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMB ER:httpversion})?|%{DATA:rawrequest})\ %{NUMBER:response} (?:%{NUMBER:bytes:fl oat}|-) %{QS:referrer} %{QS:agent} } } date { match = [ timestamp , dd/MMM/YYYY:HH:mm:ss Z ] } geoip { source = clientip target = geoip database = /test/logstash-5.0.0/GeoLite2-City.mmdb add_field = [ [geoip][coordinates], %{[geoip][longitude]} ] add_field = [ [geoip][coordinates], %{[geoip][latitude]} ] } mutate { convert = [ [geoip][coordinates], float] } } output { elasticsearch { action = index hosts =00:9200 index = logstash-nginx-%{+yyyy.MM.dd} }

文档评论(0)

1亿VIP精品文档

相关文档