时间戳 +5 小时 logstash

时间戳 +5 小时 logstash

我正在使用 logstash 将系统日志数据发送到 elasticsearch。除了 logstash 代理发送带有时间戳 +5 小时的数据外,一切正常。

这是我的配置:

input {
  file {
    type => "syslog"
    # modify to path to suit your local syslog configuration.   
    # The below will recursively grab all files in /var/log/rsyslog that end in .log
    path => ["/var/log/syslog", '/var/log/auth.log', '/var/log/faillog', '/var/log/mail.log', '/var/log/postgresql/postgresql-9.1-main.log']
    # comment out below after logstash has slurped in all of your existing logs otherwise
    # you risk it double indexing if you lose your sincedb file.
    #start_position => "beginning"
  }

  file {
    type => "jbosslog"
    path => [ "/data/jboss-4.2.3.GA/server/bla/log/server.log" ]
  }


}

output { 
  redis { 
    # change below to the hostname or ip address of your redis server.  can add more than one redis host.
    host => [ "192.168.117.39" ] 
    data_type => 'list' 
    key => 'logstash'
    batch => true
  }
  stdout { }
}

日志的标准输出如下所示:

2013-03-06T17:03:56.934Z file://bla/var/log/postgresql/postgresql-9.1-main.log: 2013-03-06 12:03:56 EST LOG:  archive command failed with exit code 12

答案1

您在示例中给出的时间戳似乎是正确的。大约在您发布此问题之前 18 分钟。

看来您的服务器(我猜您有充分的理由,但您可能没有)配置了美国/东部时区或类似的时区。但 logstash 使用 UTC 时间记录所有内容,以防止在存储和处理本地时间时发生各种问题。

相关内容