fluentd 过滤器正则表达式模式给出无效的 strptime 格式错误

fluentd filter regex pattern gives an invalid strptime format error

我正在尝试使用正则表达式过滤器来解析我的日志 我的正则表达式和示例字符串如下 正则表达式:

/^(?<logtime>[^\|]*)\S +(?<cpu-usr>\S+) +(?<cpu-sys>\S+) +(?<cpu-idl>\S+) +(?<cpu-wai>\S+) +(?<cpu-hiq>\S+) +(?<cpu-siq>[^|]+)\S +(?<mem-used>\S+) +(?<mem-buff>\S+) +(?<mem-cach>\S+) +(?<mem-free>\S+)/

示例字符串:

07-07 17:18:12|  0   0 100   0   0   0| 197M 48.9M  182M  546M

所以我将以下过滤器写入我的 fluent.conf 文件

#filter dstat log into fields. 
#----system---- ----total-cpu-usage---- ------memory-usage-----
#  date/time   |usr sys idl wai hiq siq| used  buff  cach  free
<filter input.dstat>
  @type parser
  format /^(?<logtime>[^\|]*)\S +(?<cpu-usr>\S+) +(?<cpu-sys>\S+) +(?<cpu-idl>\S+) +(?<cpu-wai>\S+) +(?<cpu-hiq>\S+) +(?<cpu-siq>[^|]+)\S +(?<mem-used>\S+) +(?<mem-buff>\S+) +(?<mem-cach>\S+) +(?<mem-free>\S+)/
  time_format %d-%m %H:%M:%S
  time_key logtime
  keep_time_key true
  key_name log
</filter>

但是,我收到此过滤器的以下错误。

fluentd_1 | 2017-07-07 05:42:36 +0000 [warn]: invalid time format: value = 07-0, error_class = ArgumentError, error = invalid strptime format - `%d-%m %H:%M:%S'

我已经使用 http://fluentular.herokuapp.com/ 检查了正则表达式和时间格式,据此似乎没问题。我该如何处理?我目前的假设是错误是由于时间格式中缺少 %Y 或年份。但是我的日志不包含年份信息。

问题是我在名称中使用了“-”而不是“_” 更换后,一切正常