-
Notifications
You must be signed in to change notification settings - Fork 259
Nginx Parser
Sun Jianbo edited this page Jul 18, 2017
·
10 revisions
Nginx Parser 是专门解析Nginx日志的解析器。仅需指定nginx的配置文件地址,即可进行nginx日志解析。
"parser":{
"name":"nginx_parser",
"type":"nginx",
"nginx_log_format_path":"/opt/nginx/conf/nginx.conf",
"nginx_log_format_name":"main",
"nginx_schema":"time_local date,bytes_sent long,request_time float,body_bytes_sent long",
"labels":"machine xxx123, team pandora"
},
- Nginx Parser是根据您Nginx配置文件自动生成配置正则表达式解析日志的方式,字段名称和Nginx配置文件中
log_format
定义的名称一致。 -
nginx_log_format_path
填写nginx配置文件,配置文件中需要包含log_format
格式,如图1. -
nginx_log_format_name
实际access log使用的格式名称,如图2 -
nginx_schema
默认情况下nginx日志都被解析为string,指定该格式可以设置为float、long、date等三种类型。指定范式为逗号分隔每个字段和类型,每个字段和类型用空格分隔,左边为字段名称,右边为类型。 - labels中定义的标签如果跟数据有冲突,labels中的标签会被舍弃
http://op26gaeek.bkt.clouddn.com/logformat.png 图1
http://op26gaeek.bkt.clouddn.com/realnginxconfig.png
- 图2 *
快速开始 | Pandora | Readers | Parsers | Senders | Download | 七牛智能日志管理平台 | logkit-pro专业版