>> from zhuhaiqing.info

input {
file {
type =>> "nginx-access"
path =>> [ "/var/log/nginx/access.log" ]
tags =>> [ "nginx","access"]
start_position =>> beginning
}
file {
type =>> "nginx-error"
path =>> [ "/var/log/nginx/error.log" ]
tags =>> [ "nginx","error"]
start_position =>> beginning
}
}
filter {
if [type] == "nginx-access" {
grok{
match =>> ["message","%{IPORHOST:client_ip}\s{1,}\-\s\-\s\[%{HTTPDATE:time}\]\s{1,}\"(?:%{WORD:verb}\s{1,}%{NOTSPACE:request}(?:\s{1,}HTTP/%{NUMBER:http_version})?|-)\" %{NUMBER:response}\s{1,}(?:%{NUMBER:bytes}|-)\s{1,}%{QS:referrer}\s{1,}%{QS:agent}"]
}
date{
match =>> ["time","dd/MMM/yyyy:HH:mm:ss Z"]
target =>> "logdate"
}
ruby{
code =>> "event.set('logdateunix',event.get('logdate').to_i)"
}
}
else if [type] == "nginx-error" {
grok {
match =>> [
"message", "(?<time>\d{4}/\d{2}/\d{2}\s{1,}\d{2}:\d{2}:\d{2})\s{1,}\[%{DATA:err_severity}\]\s{1,}(%{NUMBER:pid:int}#%{NUMBER}:\s{1,}\*%{NUMBER}|\*%{NUMBER}) %{DATA:err_message}(?:,\s{1,}client:\s{1,}(?<client_ip>%{IP}|%{HOSTNAME}))(?:,\s{1,}server:\s{1,}%{IPORHOST:server})(?:, request: %{QS:request})?(?:, host: %{QS:client_ip})?(?:, referrer: \"%{URI:referrer})?",
"message", "(?<time>\d{4}/\d{2}/\d{2}\s{1,}\d{2}:\d{2}:\d{2})\s{1,}\[%{DATA:err_severity}\]\s{1,}%{GREEDYDATA:err_message}"
]
}
date{
match=>>["time","yyyy/MM/dd HH:mm:ss"]
target=>>"logdate"
}
ruby{
code =>> "event.set('logdateunix',event.get('logdate').to_i)"
}
}
}
output{
elasticsearch{
hosts =>> ["192.168.100.10:9200"]
index =>> "logstash-nginx-%{+YYYY.MM.dd}"
}
}

最新文章

  1. .html(),.text()和.val()的差异总结
  2. 【Beta】Daily Scrum
  3. Cadence16.6安装破解
  4. JSONArray.toCollection 封装 bean 失败
  5. 8月1日起,这些新政将影响移动互联网产业-b
  6. git撤销提交到remote的commit
  7. hdoj 3785 寻找大富翁【优先队列+sort排序】
  8. eclipse如何运行maven项目
  9. iOS常见异常Exec_Bad_Access问题解决办法
  10. centos, ubuntu 上docker 安装
  11. 【高速接口-RapidIO】1、RapidIO协议概述
  12. CodeForces512C-Pluses everywhere-模拟/数学/排列组合模板
  13. impala系列: 时间函数
  14. (转)Geth控制台使用及Web3.js使用实战
  15. kotlin-2(IdeaIU-2018.2汉化破解)
  16. RobotFramework基本用法(二)
  17. bzoj 1590: [Usaco2008 Dec]Secret Message 秘密信息
  18. 用phpstudy搭建的lnmp环境下mysql授权远程连接
  19. 网络安全部门的漏洞扫描让你头痛不已么——PHP环境选它就可以了
  20. 重写ListView解决ListView内部ViewPaper滑动事件冲突问题

热门文章

  1. 同步mysql数据到ElasticSearch的最佳实践
  2. 利用JavaScript打印出Fibonacci数(不使用全局变量)
  3. Netty源码学习(七)FastThreadLocal
  4. cl编译C文件的环境变量修改
  5. Python的程序结构[5] -&gt; 模块/Module[0] -&gt; 内建模块 builtins
  6. 差分【p3948】 数据结构
  7. NOIP2016_day1_No1玩具谜题
  8. 我学MSMQ(一)
  9. sql server 存储过程中使用变量表,临时表的分析(续)
  10. 【转】MySQL5.5的my.cnf 参数详解