logstash版本6.3.2,解决方式如下,不需要修改源码:

 input {
redis {
host => "127.0.0.1"
port => ""
password => "password"
db =>
key => "key_test" #队列名称
data_type => "list" #队列类型
threads =>
}
}
filter {
ruby {
code => "event.set('timestamp', event.get('@timestamp').time.localtime + 8*60*60)"
}
ruby {
code => "event.set('@timestamp',event.get('timestamp'))"
}
mutate {
remove_field => ["timestamp"]
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
action => index
index => "index_test" #es中的索引名称
document_id => "%{id}" #以数据中的哪个字段做es中的_id
document_type => "type_test" #es中的mapping名称
codec => json_lines
}
file {
path => "/root/data/%{+yyyyMMddHH}.txt"
}
}

logstash生成文件名中的日期是从@timestamp字段的值中获取,通过设置filter将timestamp中的时间转换成系统时间,问题解决。

logstash output时区差8个小时的更多相关文章

  1. 通过上一节部署出来的 Windows instance 有时候会发现操作系统时间总是慢 8 个小时,即使手工调整好时间和时区,下次 instance 重启后又会差 8 个小时

    这是 OpenStack 实施经验分享系列的第 3 篇. 问题描述 通过上一节部署出来的 Windows instance 有时候会发现操作系统时间总是慢 8 个小时,即使手工调整好时间和时区,下次 ...

  2. Filebeat之input和output(包含Elasticsearch Output 、Logstash Output、 Redis Output、 File Output和 Console Output)

    前提博客 https://i.cnblogs.com/posts?categoryid=972313 Filebeat啊,根据input来监控数据,根据output来使用数据!!! Filebeat的 ...

  3. docker 内时区和宿主机差8个小时,怎么办?

    docker run -d -it --name tt -e TZ=Asia/Shanghai -p : api 使用-e参数指定时区

  4. Logstash之时区问题的建议和修改---filter---and duplicate resolution.

    2. logstash es duplicate https://logstash.jira.com/browse/LOGSTASH-1875 https://logstash.jira.com/br ...

  5. 【spring boot】spring boot后台时间正确,返回给前台的时间不正确,和后台差8个小时

    后台打印的时间如下: 数据库存储时间如下: 接口返回给前台的时间如下: 相差8个小时. 原因如下: spring-boot中对于@RestController或者@Controller+@Respon ...

  6. ios 时间解析 差8个小时

    啥问题也有:小程序中web开发工具里显示时间正常,ios上显示的查8小时 原因: 使用 NSDate *date = [NSDate date]; 获取的时间是标注的UTC时间,和北京时间相差8小时. ...

  7. [java]察看两个日期间差多少秒/小时/天

    Java 中Date类getTime()的方法返回从1970-1-1以来的毫秒数,这是下面函数运行的基础. package com.example.demo; import java.text.Par ...

  8. logstash output到kafka记录与总结( No entry found for connection 2)

    简述 本文记录logstash的output配置为kafka的过程.这里是简单的例子,输入为stdin,本文主要目的是为了记录在这次配置过程中遇到的问题和解决的过程及总结. 关于kafka集群的搭建可 ...

  9. logstash output kafka ip 设置的坑

    原设置 output { kafka { acks => " enable_metric => false codec => "json" topic_ ...

随机推荐

  1. Flask restful源码分析

    Flask restful的代码量不大,功能比较简单 参见 http://note.youdao.com/noteshare?id=4ef343068763a56a10a2ada59a019484

  2. Python【day 14-2】递归遍历文件夹

    #需求 遍历文件夹中所有的子文件夹及子文件--用递归实现 '''''' ''' 伪代码 1.遍历根目录--listdir for 得到第一级子文件夹(不包含子文件夹的子文件)和文件 2.判断是文件还是 ...

  3. JPA使用Specification构建动态查询

    封装Specification查询条件,在Spring Data JPA 2.0以前使用 Specifications 这个辅助类来操作where.not.and和or连接,在2.0版本以后这个类会被 ...

  4. 高性能TcpServer(C#) - 4.文件通道(处理:文件分包,支持断点续传)

    高性能TcpServer(C#) - 1.网络通信协议 高性能TcpServer(C#) - 2.创建高性能Socket服务器SocketAsyncEventArgs的实现(IOCP) 高性能TcpS ...

  5. Python 爬虫之 Beautifulsoup4,爬网站图片

    安装: pip3 install beautifulsoup4 pip install beautifulsoup4 Beautifulsoup4 解析器使用 lxml,原因为,解析速度快,容错能力强 ...

  6. 基本SQL语句使用方法

    结构:增: create database 库名 charset 字符集: create table 表名称(字段名 类型 约束 ,字段名 类型 约束) not null 非空primary key ...

  7. Centos7 下安装Redis4.0.6

    一.安装redis 第一步:下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz [root@iZwz991stxd ...

  8. 安装教程-VMware 12 安装 Windows 10 企业版

    VMware 12 安装 Windows 10 企业版 1.实验描述 在虚拟机中,手动安装 Windows10 企业版操作系统,为一些实验提供平台,因此,有关系统激活问题不再演示.可自行百度,或者加入 ...

  9. 《SQL Server 2008 R2》 收缩数据库日志文件

    USE [master] GO /****** Object: StoredProcedure [dbo].[pro_Shrink_Log] Script Date: 2019/8/16 16:56: ...

  10. Arbitrage POJ - 2240

    题目链接:https://vjudge.net/problem/POJ-2240 思路:判正环,Bellman-ford和SPFA,floyd都可以,有正环就可以套利. 这里用SPFA,就是个板子题吧 ...