としたにあんの左脳

備忘録です.

fluentdでerror="argument out of range"というエラー

nginxからltsvでログはいてtd-agentでltsvで受けようとしたら,

error="argument out of range”

というエラーがでた.

2013-11-15 00:28:05 +0900 [warn]: "time:15/Nov/2013:00:28:05 +0900\thost:xxx.xxx.xxx.xxx\tforwardedfor:-\treq:GET /foo/bar HTTP/1.1\tstatus:304\tsize:0\treferer:http://xxx.xxx.xxx.xxx/foo/bar\tua:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.48 Safari/537.36\treqtime:0.000\tvhost:xxx.xxx.xxx.xxx" error="argument out of range"

confファイルは以下のようにしていた.

<source>
  type tail
  format ltsv
  path /var/log/nginx/access.log
  tag test.nginx.log
  pos_file /tmp/nginx.pos
</source>

原因は,time_formatを書いていなかったこと.正しくは,

<source>
  type tail
  format ltsv
  time_format %d/%b/%Y:%H:%M:%S %z
  path /var/log/nginx/access.log
  tag test.nginx.log
  pos_file /tmp/nginx.pos
</source>