<pre name="code" class="html">日期格式转换:

/***** nginx 访问日志
[elk@zjtest7-frontend config]$ cat stdin02.conf
input {
stdin {
}
}
filter {
grok {
match => ["message", "%{IPORHOST:clientip} \[%{HTTPDATE:time}\]"]
}
#date {
# match => ["time", "dd/MMM/yyyy:HH:mm:ss Z"]
#}
}
output {
stdout {
codec=>rubydebug{}
}
} [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
10.171.246.184 [22/Sep/2016:00:13:59 +0800] "GET /resources/css/base.css?06212016 HTTP/1.1" - 200 12638 "https://www.zjcap.cn/"
{
"message" => " 10.171.246.184 [22/Sep/2016:00:13:59 +0800] \"GET /resources/css/base.css?06212016 HTTP/1.1\" - 200 12638 \"https://www.zjcap.cn/\" ",
"@version" => "1",
"@timestamp" => "2016-09-22T00:54:17.154Z",
"host" => "0.0.0.0",
"clientip" => "10.171.246.184",
"time" => "22/Sep/2016:00:13:59 +0800"
} 打开时间转换:
[elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
10.171.246.184 [22/Sep/2016:00:13:59 +0800] "GET /resources/css/base.css?06212016 HTTP/1.1" - 200 12638 "https://www.zjcap.cn/"
{
"message" => " 10.171.246.184 [22/Sep/2016:00:13:59 +0800] \"GET /resources/css/base.css?06212016 HTTP/1.1\" - 200 12638 \"https://www.zjcap.cn/\" ",
"@version" => "1",
"@timestamp" => "2016-09-21T16:13:59.000Z",
"host" => "0.0.0.0",
"clientip" => "10.171.246.184",
"time" => "22/Sep/2016:00:13:59 +0800"
} /***** nginx 错误日志
[elk@zjtest7-frontend config]$ cat stdin02.conf
input {
stdin {
}
}
filter {
grok {
match => ["message", "(?<time>%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME})"]
}
#date {
# match => ["time", "yyyy/MM/dd HH:mm:ss"]
#}
}
output {
stdout {
codec=>rubydebug{}
}
} 关闭date插件:
[elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
2016/09/22 08:36:55 [error] 14486#0: *55574 open() "/var/www/zjzc-web-frontEnd/apple-app-site-association"
{
"message" => " 2016/09/22 08:36:55 [error] 14486#0: *55574 open() \"/var/www/zjzc-web-frontEnd/apple-app-site-association\"",
"@version" => "1",
"@timestamp" => "2016-09-22T01:47:28.405Z",
"host" => "0.0.0.0",
"time" => "2016/09/22 08:36:55"
} 开启date插件: [elk@zjtest7-frontend config]$ cat stdin02.conf
input {
stdin {
}
}
filter {
grok {
match => ["message", "(?<time>%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME})"]
}
date {
match => ["time", "yyyy/MM/dd HH:mm:ss"]
}
}
output {
stdout {
codec=>rubydebug{}
}
} [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
2016/09/22 08:36:55 [error] 14486#0: *55574 open() "/var/www/zjzc-web-frontEnd/apple-app-site-association"
{
"message" => " 2016/09/22 08:36:55 [error] 14486#0: *55574 open() \"/var/www/zjzc-web-frontEnd/apple-app-site-association\"",
"@version" => "1",
"@timestamp" => "2016-09-22T00:36:55.000Z",
"host" => "0.0.0.0",
"time" => "2016/09/22 08:36:55"
} /******tomcat access 日志
[elk@zjtest7-frontend config]$ cat stdin02.conf
input {
stdin {
}
}
filter {
grok {
match => ["message", "\s*%{IPORHOST:clientip}\s+\-\s+\-\s+\[%{HTTPDATE:time}\]"]
}
date {
match => ["time", "dd/MMM/yyyy:HH:mm:ss Z"]
}
}
output {
stdout {
codec=>rubydebug{}
}
} [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
10.171.246.184 - - [22/Sep/2016:07:59:04 +0800] "POST /api/notice/page HTTP/1.1" 200 1194 0.055 121.40.169.62
{
"message" => "10.171.246.184 - - [22/Sep/2016:07:59:04 +0800] \"POST /api/notice/page HTTP/1.1\" 200 1194 0.055 121.40.169.62",
"@version" => "1",
"@timestamp" => "2016-09-21T23:59:04.000Z",
"host" => "0.0.0.0",
"clientip" => "10.171.246.184",
"time" => "22/Sep/2016:07:59:04 +0800"
} /**********tomcat catalina.out 日志 elk@zjtest7-frontend config]$ cat stdin02.conf
input {
stdin {
}
} filter {
grok {
match => ["message", "(?m)\s*%{TIMESTAMP_ISO8601:time}\s+(?<Level>(\S+)).*"]
}
date {
match => ["time", "yyyy-MM-dd HH:mm:ss,SSS"]
}
}
output {
stdout {
codec=>rubydebug{}
}
} [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf
Settings: Default pipeline workers: 1
Pipeline main started
2016-09-21 19:10:01,538 INFO com.zjzc.common.utils.HttpUtil
{
"message" => "2016-09-21 19:10:01,538 INFO com.zjzc.common.utils.HttpUtil",
"@version" => "1",
"@timestamp" => "2016-09-21T11:10:01.538Z",
"host" => "0.0.0.0",
"time" => "2016-09-21 19:10:01,538",
"Level" => "INFO"
} /************mysql slow log

												

最新文章

  1. ts 格式化日期输出
  2. 在Application中集成Microsoft Translator服务之优化
  3. iBatis简单入门教程
  4. html之页面元素印射
  5. Lazarus中Base64的操作
  6. Android DatePickerDialog TimepickerDialog
  7. sublime text 2 中文乱码解决办法
  8. JS学习笔记-1--基本知识和注意事项
  9. 企业级搜索引擎Solr 第三章 索引数据(Indexing Data)[1]
  10. nginx浏览pdf
  11. BufferedStream类 - 缓冲流
  12. MySQL 修改 root 密码命令
  13. 配置文件http://www.cnblogs.com/Jevon-ran/p/7112007.html
  14. 软考之路--从生活着手,看PV如何操作
  15. java的classpath路径中加点号 ‘.’ 的作用
  16. Oracle 连接查询
  17. pyinstaller-打包python程序为exe文件
  18. barcode(index)
  19. http和socket之长连接和短连接区别【转】
  20. hdu3829

热门文章

  1. [置顶] 【Git入门之十】Rebase操作
  2. UIWebView加载html 图片大小自适应的方法汇总
  3. CSS3:优雅地绘制不规则ICON
  4. nexus5 root教程
  5. 淘宝内部大量使用的开源系统监控工具--Tsar
  6. Swift补基础之Selector、条件编译、编译标记、NSObject
  7. C/C++中虚函数的调用
  8. 网络流初步——增广路算法(EK)模板
  9. math.h中的常量
  10. App轮播图