Skip to content

The time difference hours has disappeared with TIMESTAMP WITHOUT TIME ZONE #140

@susumuf

Description

@susumuf

I tried to record nginx access logs in local time(asia/tokyo, UTC+9), but when I wrote to 'TIMESTAMP WITHOUT TIME ZONE', the time difference disappeared.
On the other hand, if you write to TIMESTAMP WITH TIME ZONE, the time difference will be reflected and the data will be recorded correctly.
image

Would someone expert help me out ? or any escape ?

I used this env and config as blow;
fluent.conf

<source>
  @type             tail
  path              /var/log/nginx/access.log
  pos_file          /var/log/nginx/nginx-access.log.pos
  tag               nginx-access
  <parse>
    @type           nginx
  </parse>
</source>
<match nginx-access>
  @type             sql
  host              db
  port              5432
  database          fluentd
  adapter           postgresql
  username          fluentd_rw
  password          fluentd
  <inject>
    time_key        time
    time_type       string
    timezone        Asia/Tokyo
  </inject>
  <table>
    table           nginx_access
    column_mapping  'time:stamp,remote:remote,host:host,method:method,path:path,code:code,size:size,referer:referer,agent:agent,http_x_forwarded_for:http_x_forwarded_for'
  </table>
</match>

env:
fluent-gem list as below;
fluent-config-regexp-type (1.0.0)
fluent-plugin-rewrite-tag-filter (2.4.0)
fluent-plugin-sql (2.3.0)
fluentd (1.16.2)
pg (1.5.4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions