Syslog流利的无效时间格式

时间:2019-10-21 21:03:13

标签: syslog fluentd stackdriver

我正在尝试使用Bindplane将Java开发人员创建的“ syslog”上传到Google的Stackdriver。 Bindplane是基于流畅设计而成的。

我使用的是尾巴的来源类型。 Bindplane能够读取日志文件并将其推送到Stackdriver,但是它始终在JSON消息的正文中附加以下错误:

 error: "invalid time format: value = 2019-10-21 16:52:29.588 EDT, error_class = ArgumentError, error = invalid strptime format - `%Y-%m-%d %H:%M:%S.%L%z'"

日志显示的格式与大多数syslog格式略有不同:

2019-10-21 13:15:02.439 EDT main TRACE Processor.init()

这是我流畅的配置中的内容:

<source>
  @type tail
  path C:/Test/Connect_Test/Log/**TestDL**.txt
  pos_file C:/BlueMedora/BindplaneLogAgent/config/449c6ffb-1a29-4172-9058-e19de236d712.tail.log.pos
  tag 449c6ffb-1a29-4172-9058-e19de236d712.1st_auto_policy
  format syslog
  time_format %Y-%m-%d %H:%M:%S.%L%z
</source>

有没有一种方法可以避免此错误而不更改日志?由于类/方法属于另一个开发人员,因此我无法更改日志的编写方式。

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

Eddie-

我为Blue Medora工作,BindPlane是我们的产品。这样可以解决您的问题,如果不能解决,请告诉我们,我们可以帮助您正确配置它。

尝试time_format %Y-%m-%d %H:%M:%S.%L %Z

  1. 小写字母z表示“时区是相对于UTC的小时偏移量” (例如+0400)
  2. 大写Z代表“时区名称”,看起来像 您的日志文件中有什么。
  3. 看起来毫秒和毫秒之间还有一个空格 时区。因此,还应该添加空间。

这是指向documentation on the strptime() options的链接,其中显示了%z和%Z之间的差异

再次,如果这对您不起作用,请告诉我们。