nginx访问日志 logstash 配置文件实例2
发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,日志格式:log_format elk "$http_clientip | $http_x_forwarded_for | $time_local | $request | $status | $bo
千家信息网最后更新 2025年12月03日nginx访问日志 logstash 配置文件实例2
日志格式:log_format elk "$http_clientip | $http_x_forwarded_for | $time_local | $request | $status | $body_bytes_sent | " " $request_body | $content_length | $http_referer | $http_user_agent | " "$http_cookie | $remote_addr | $hostname | $upstream_addr | $upstream_response_time | $request_time";日志实例:36.110.211.42 | 10.10.130.101 | 23/Jun/2017:17:51:01 +0800 | GET /lvyou/dongjing/ HTTP/1.1 | 200 | 73181 | - | 0 | - | Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 | JSESSION_O2O=0000F0jMLw1MnT6SFCvhcqW3oP9:19h7oe5dr; SessionID=10.10.130.101.1498210484146456; sCityCode=SZX; sCityName=%E6%B7%B1%E5%9C%B3; vac_ss_sid=4441002; vac_ss_uid=4441 | 10.10.130.100 | www1-n01 | 10.10.130.237:80 | 0.808 | 0.809logstash实例:input { file { type => "www1_access" path => ["/usr/local/elk/elklog/nginxlog/log0/www1.log","/usr/local/elk/elklog/nginxlog/log1/www1.log"] } file { type => "flight1_access" path => ["/usr/local/elk/elklog/nginxlog/log0/flight1.log","/usr/local/elk/elklog/nginxlog/log1/flight1.log"] } file { type => "m_access" path => ["/usr/local/elk/elklog/nginxlog/log0/m.log"] }} filter {ruby {init => "@kname = ['http_clientip','http_x_forwarded_for','time_local','request','status','body_bytes_sent','request_body','content_length','http_referer','http_user_agent','http_cookie','remote_addr','hostname','upstream_addr','upstream_response_time','request_time']"code => "new_event = LogStash::Event.new(Hash[@kname.zip(event.get('message').split(' | '))])new_event.remove('@timestamp')event.append(new_event)"}if [request] {ruby {init => "@kname = ['method','uri','verb']"code => "new_event = LogStash::Event.new(Hash[@kname.zip(event.get('request').split(' '))])new_event.remove('@timestamp')event.append(new_event)"}if [uri] {ruby {init => "@kname = ['url_path','url_args']"code => "new_event = LogStash::Event.new(Hash[@kname.zip(event.get('uri').split('?'))])new_event.remove('@timestamp')event.append(new_event)"}kv {prefix => "url_"source => "url_args"field_split => "& "remove_field => [ "url_args","uri","request" ]}}}mutate {convert => ["body_bytes_sent" , "integer", "content_length", "integer", "upstream_response_time", "float","request_time", "float"]} grok { match => [ "message", "%{IP:clientip} \| %{USER} \| %{HTTPDATE:timestamp}" ]}date {match => [ "timestamp", "dd/MMM/YYYY:HH:mm:ss Z" ]locale => "en"} geoip { source => "clientip" }mutate { remove_field => "timestamp" remove_field => "http_clientip" }useragent { source => "http_user_agent" target => "useragent" } }output { redis { host => "10.10.45.200" data_type => "list" key => "elk_frontend_access:redis" port=>"5379" } }注意:分隔符为"空格+table+空格"
实例
日志
空格
分隔符
格式
文件
配置
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
来电信息数据库无法更新
网络安全审查办法是什么性质
航天长峰属于网络安全的股票吗
网络安全模式不能读u盘
用与管理服务器
湖南微商城软件开发
网络安全来源于受保护对象的什么
昆山诚信软件开发优惠吗
魔兽世界服务器状态在哪看
人保财险软件开发加班
首届国家网络安全周在哪举行
近期发生的网络安全攻击事件
英雄联盟手游服务器卡怎么办
2020网络安全手抄报边框
通过堡垒机服务器不能复制粘贴
滨州到济南经过什么服务器
沃顿网络安全
网络安全团日活动总结优缺点
仙境传说装备数据库
建议服务器
未来网络技术教学
好耶服务器
网络安全模式怎么打开
部队数据库人员
网络安全 知识体系
哪些是it软件开发
c 连接到数据库的字符串
护苗网络安全绘画简单好看
吉林省统祥科技互联网
软件开发文档批量生成