-
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中的标签会被舍弃
{
"name":"nginx_runner",
"reader":{
"mode":"file",
"meta_path":"meta",
"log_path":"/opt/nginx_logs/logs/access.log"
},
"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"
},
"senders":[{
"name":"pandora_sender",
"sender_type":"pandora",
"pandora_ak":"your_ak",
"pandora_sk":"your_sk",
"pandora_host":"https://pipeline.qiniu.com",
"pandora_repo_name":"my_nginx_log",
"pandora_region":"nb",
"pandora_schema_free":"true",
"pandora_gzip": "true",
"pandora_enable_logdb":"true",
"fault_tolerant":"true",
"ft_save_log_path":"./ft_log",
"ft_strategy":"always_save",
"ft_procs":"2"
}]
}
快速开始 | Pandora | Readers | Parsers | Senders | Download | 七牛智能日志管理平台 | logkit-pro专业版