导入旧数据需要 使用date插件
2016-09-12 21:52
190 查看
"@version" => "1", "@timestamp" => "2016-09-12T08:31:06.630Z", "path" => "/data01/applog_backup/winfae_log/wj-frontend01-access.2016-09-12", "host" => "dr-mysql01.zjcap.com", "type" => "wj_frontend_access", "clientip" => "10.168.255.134", "time" => "12/Sep/2016:16:30:40 +0800", "verb" => "GET", filters/date 插件可以用来转换你的日志记录中的时间字符串,变成 LogStash::Timestamp 对象,然后转存到 @timestamp 字段里。 [elk@zjtest7-frontend config]$ vim stdin02.conf input { stdin { } } filter { grok { match => ["message", "%{HTTPDATE:logdate}"] } date { match => ["logdate", "dd/MMM/yyyy:HH:mm:ss Z"] add_field =>["response_time","%{logdate}"] } } output { stdout { codec=>rubydebug{} } [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf Settings: Default pipeline workers: 1 Pipeline main started 12/Sep/2016:21:32:33 +0800 { "message" => "12/Sep/2016:21:32:33 +0800", "@version" => "1", "@timestamp" => "2016-09-12T13:32:33.000Z", "host" => "0.0.0.0", "logdate" => "12/Sep/2016:21:32:33 +0800", "response_time" => "12/Sep/2016:21:32:33 +0800" } -------------------------------------------------------- 这在导入旧数据的时候固然非常有用,而在实时数据处理的时候同样有效,因为一般情况下数据流程中我们都会有缓冲区,导致最终的实际处理时间跟事件产生时间略有偏差。 input { stdin { } } filter { grok { match => ["message", "%{HTTPDATE:logdate}"] } # date { # match => ["logdate", "dd/MMM/yyyy:HH:mm:ss Z"] # add_field =>["response_time","%{logdate}"] # } } output { stdout { codec=>rubydebug{} } } ~ ~ ~ [elk@zjtest7-frontend config]$ ../bin/logstash -f stdin02.conf Settings: Default pipeline workers: 1 Pipeline main started 12/Sep/2016:21:32:33 +0800 { "message" => "12/Sep/2016:21:32:33 +0800", "@version" => "1", "@timestamp" => "2016-09-12T13:47:08.611Z", "host" => "0.0.0.0", "logdate" => "12/Sep/2016:21:32:33 +0800" }
相关文章推荐
- 导入旧数据需要 使用date插件
- Android 使用notepad++ 格式化本地Json数据需要的对比安装插件
- [Step By Step]在SAP Business Objects Data Services中使用Date Generation生成日期维度数据并导入到SAP HANA中(Date Generation)
- PHPExcel插件的使用2——基本数据导入
- yii2.0中使用Goodby/csv插件,实现数据的导入导出
- 使用ODBC, 将CSV文件里的数据导入DataSet
- Oracle中Date数据类型的操作和使用
- mysql数据导入导出使用
- 如何使用VB调用DTS进行数据的导入、导出
- [导入]使用事务与锁,实现一个用户取过的数据不被其他用户取到
- SQL2000中BCP轻松使用导入导出数据
- JSP设计模式基础:View Helper模式——学习如何使用View Helper模式使得Model数据适应表现层的需要(3)
- 完成了WF工作流持久化和对持久化介质数据的加载, 但是仅仅用持久化,不能够保存工作流当前的执行状态,需要跟踪服务支持,怎样使用Tracing 服务呢?
- 使用OLEDB将数据库的数据导入Excel文件
- MySQL5.0的三种数据类型:DATETIME, DATE和TIMESTAMP的使用
- [导入]使用 SQL Server 时需要经常用到的几个设置选项!
- 使用ODBC, 将CSV文件里的数据导入DataSet
- 使用ODBC, 将CSV文件里的数据导入DataSet
- 在C#中使用正则表达式自动匹配并获取所需要的数据
- C#中使用DTS来导入数据及相关问题