td-agentにてBigQuery投入時のエラー

td-agentから fluent-plugin-bigquery を使用してBigQueryにデータを投入しようとしたらこのようなエラーが出てしまいました。

2017-12-03 16:36:06 +0900 [warn]: #0 failed to flush the buffer. retry_time=0 next_retry_seconds=2017-12-03 16:36:07 +0900 chunk="xxxxxxxxxxxxxxxxxxxxxxx" error_class=Signet::AuthorizationError error="Authorization failed.  Server message:\n{\n \"error\": \"invalid_grant\",\n \"error_description\": \"Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.\"\n}"
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/signet-0.8.1/lib/signet/oauth_2/client.rb:988:in `fetch_access_token'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/signet-0.8.1/lib/signet/oauth_2/client.rb:1005:in `fetch_access_token!'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/googleauth-0.6.2/lib/googleauth/signet.rb:69:in `fetch_access_token!'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/googleauth-0.6.2/lib/googleauth/signet.rb:45:in `apply!'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/googleauth-0.6.2/lib/googleauth/service_account.rb:93:in `apply!'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/http_command.rb:313:in `apply_request_options'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/http_command.rb:289:in `execute_once'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/http_command.rb:104:in `block (2 levels) in execute'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:61:in `block in retriable'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:57:in `times'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:57:in `retriable'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/http_command.rb:101:in `block in execute'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:61:in `block in retriable'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:57:in `times'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/retriable-3.1.1/lib/retriable.rb:57:in `retriable'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/http_command.rb:93:in `execute'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/google-api-client-0.17.1/generated/google/apis/bigquery_v2/service.rb:701:in `insert_all_table_data'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-bigquery-1.1.0/lib/fluent/plugin/bigquery/writer.rb:97:in `insert_rows'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-bigquery-1.1.0/lib/fluent/plugin/out_bigquery.rb:402:in `insert'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-bigquery-1.1.0/lib/fluent/plugin/out_bigquery.rb:398:in `_write'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-bigquery-1.1.0/lib/fluent/plugin/out_bigquery.rb:336:in `write'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-0.14.16/lib/fluent/plugin/output.rb:1043:in `try_flush'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-0.14.16/lib/fluent/plugin/output.rb:1268:in `flush_thread_run'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-0.14.16/lib/fluent/plugin/output.rb:420:in `block (2 levels) in start'
  2017-12-03 16:36:06 +0900 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-0.14.16/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'

時間がずれすぎていたのが原因のようだったので、ntpdateで時刻合わせをしたら解決しました。

sudo ntpdate ntp.nict.jp