nginx 配置:
http {
include mime.types;
default_type application/octet-stream;
log_format main '$http_host $server_addr $remote_addr [$time_local] "$request" '
'$request_body $status $body_bytes_sent "$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time';
#send the log to syslog and file.
access_log /var/log/nginx/access.log main; # pre 1.5.x
error_log /var/log/nginx/error.log; nginx 服务器rsyslog配置:
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
module(load="imfile" PollingInterval="5")
$ModLoad imtcp
$InputTCPServerRun 514
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.none;local5.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
uucp,news.crit /var/log/spooler
local7.* /var/log/boot.log
input(type="imfile"
File="/var/log/nginx/access.log"
Tag="uat-frontend01-access"
Severity="info"
Facility="local5")
input(type="imfile"
File="/var/log/nginx/error.log"
Tag="uat-frontend01-error"
Severity="info"
Facility="local5")
local5.* @@xx:514 logstash 配置;
zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat loguat.cof
input {
file {
type => "uat_nginx_access"
path => ["/rsyslog/data/nginx/uat/nginx_access0*_log.*"]
}
}
filter {
grok {
match => {
"message" => "%{IPORHOST:clientip} \[%{HTTPDATE:time}\] \"%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:http_status_code} %{NUMBER:bytes} \"(?<http_referer>\S+)\" \"(?<http_user_agent>\S+)\" \"(?<http_x_forwarded_for>\S+)\""
}
}
} output {
elasticsearch {
hosts => "192.168.32.80:9200"
index => "logstash-uat-test"
}
stdout {
codec => rubydebug
}
} logstash 输出;
zjtest7-frontend:/usr/local/logstash-2.3.4/config# ../bin/logstash -f loguat.cof
Settings: Default pipeline workers: 1
Pipeline main started
{
"message" => " uatest.winfae.com 121.40.189.90 121.40.205.143 [29/Aug/2016:09:42:25 +0800] \"GET /wechat/css/wechat.2a00a782.css HTTP/1.1\" - 304 0 \"https://uatest.winfae.com/wechat/account.html\" \"Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/37.0.0.0 Mobile MQQBrowser/6.2 TBS/036558 Safari/537.36 MicroMessenger/6.3.25.861 NetType/WIFI Language/zh_CN\" 0.000 -",
"@version" => "1",
"@timestamp" => "2016-08-29T01:45:09.748Z",
"path" => "/rsyslog/data/nginx/uat/nginx_access01_log.2016-08-29",
"host" => "0.0.0.0",
"type" => "uat_nginx_access",
"tags" => [
[0] "_grokparsefailure"
]
} elasticsearch 输出; { "_index": "logstash-uat-test",
"_type": "uat_nginx_access",
"_id": "AVbT-JPMEY-onx06xYf_",
"_version": 1,
"_score": 1,
"_source": {
"message": " uatest.winfae.com 121.40.189.90 121.40.205.143 [29/Aug/2016:09:42:25 +0800] "GET /wechat/js/libs/dialog-min.88247f5e.js HTTP/1.1" - 304 0 "https://uatest.winfae.com/wechat/account.html" "Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/37.0.0.0 Mobile MQQBrowser/6.2 TBS/036558 Safari/537.36 MicroMessenger/6.3.25.861 NetType/WIFI Language/zh_CN" 0.000 -",
"@version": "1",
"@timestamp": "2016-08-29T01:45:10.220Z",
"path": "/rsyslog/data/nginx/uat/nginx_access01_log.2016-08-29",
"host": "0.0.0.0",
"type": "uat_nginx_access",
"tags": [
"_grokparsefailure"
]
} <img src="http://img.blog.csdn.net/20160829100135123?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />

nginx grok 正则错误的输出情况的更多相关文章

  1. nginx location正则写法

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  2. nginx location正则写法(转载)

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  3. 如何解决Nginx php 50x 错误

    SEO反馈百度爬虫经常504,一般情况下是由nginx默认的fastcgi进程响应慢引起的,但也有其他情况,这里我总结了一些解决办法供大家参考.   方法/步骤 一般50x状态码问题分析: Nginx ...

  4. nginx location正则

    nginx location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # ...

  5. NGINX 配置404错误页面转向

    什么是404页面 如果碰巧网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是 ...

  6. Nginx_HTTP 499 状态码 nginx下 499错误

    日志记录中HTTP状态码出现499错误有多种情况,我遇到的一种情况是nginx反代到一个永远打不开的后端,就这样了,日志状态记录是499.发送字节数是0. 老是有用户反映网站系统时好时坏,因为线上的产 ...

  7. grok 正则解析日志例子<1>

    <pre name="code" class="html">下面是日志的样子 55.3.244.1 GET /index.html 15824 0. ...

  8. NGINX 配置404错误页面转向

    什么是404页面 如果碰巧网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是 ...

  9. HTTP 499 状态码 nginx下 499错误[转]

    日志记录中HTTP状态码出现499错误有多种情况,我遇到的一种情况是nginx反代到一个永远打不开的后端,就这样了,日志状态记录是499.发送字节数是0. 老是有用户反映网站系统时好时坏,因为线上的产 ...

随机推荐

  1. poj 1095 Trees Made to Order

    http://poj.org/problem?id=1095 先求出n个节点数的二叉树的形态有多少种.卡特兰数f[n]=f[n-1]*(4*n-2)/(n+1);再递归求. #include < ...

  2. 【ASP.NET MVC路由测试+性能调试工具】

    http://getglimpse.com https://github.com/Glimpse/Glimpse 百度网盘: http://pan.baidu.com/s/1jHuTtKa

  3. Linux系统编程(4)——文件与IO之ioctl函数

    ioctl是设备驱动程序中对设备的I/O通道进行管理的函数.所谓对I/O通道进行管理,就是对设备的一些特性进行控制,例如串口的传输波特率.马达的转速等等.它的参数个数如下:int ioctl(int ...

  4. JVM命令行选项及GC日志

    转:http://blog.csdn.net/q291611265/article/details/48028189 一.设置参数 在使用eclipse编译器的时候,可以采用以下的运行方式来设置虚拟机 ...

  5. UESTC_韩爷的情书 2015 UESTC Training for Graph Theory<Problem H>

    H - 韩爷的情书 Time Limit: 6000/2000MS (Java/Others)     Memory Limit: 262144/262144KB (Java/Others) Subm ...

  6. POJ1094 Sorting It All Out(拓扑排序)

    Sorting It All Out Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 30110   Accepted: 10 ...

  7. 【转】android 物理按键

    关键词:android   按键  矩阵按键 AD按键  平台信息: 内核:linux2.6/linux3.0 系统:android/android4.0 平台:S5PV310(samsung exy ...

  8. IOS 下雪动画

    #define SNOW_IMAGENAME @"snow" #define IMAGE_X arc4random()%(int)Main_Screen_Width #define ...

  9. AJAX最简单的原理以及应用

    Ajax是创建快速动态网页的技术,通过后台与服务器少量的数据交互,是网页实现异步更新.也就是在不整个刷新页面的情况下,可以更新网页中的局部区域. 在原始web应用的模式中: 浏览器       以 h ...

  10. 如何统一删除word中的超链接

    [摘要] 我们从别处拷贝文字,或从网上复制的文字,里面有很多超级链接,如何可以批量删除这些链接呢?这里介绍两种批量删除链接的方法. [正文] 方法一:使用快捷键删除超链接 有个神奇的快捷键,可以帮我们 ...