Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp in logs ? #46

Open
c0ze opened this issue Jun 29, 2018 · 0 comments
Open

Timestamp in logs ? #46

c0ze opened this issue Jun 29, 2018 · 0 comments

Comments

@c0ze
Copy link

c0ze commented Jun 29, 2018

I'm using Rails 5, my configuration is :

    config.log_level = :info
    config.logger = ActFluentLoggerRails::Logger.new(
      settings: {
        host: ENV['FLUENTD_HOST'],
        port: 24224,
        tag: "myApp-#{Rails.env}",
        messages_type: 'string',
        severity_key: 'level'
      },
      log_tags: {
        ip: :ip,
        ua: :user_agent
      })
    # buggy for now
    # https://github.com/actindi/act-fluent-logger-rails/issues/41
    # uid: ->(request) { request.session[:uid] }
    config.lograge.enabled = true
    config.lograge.formatter = Lograge::Formatters::Json.new

The logs I get follows :

{"method":"GET","path":"/health","format":"html","controller":"ApplicationController","action":"health","status":200,"duration":2.53,"view":0.0,"db":0.76}
{"method":"GET","path":"/health","format":"html","controller":"ApplicationController","action":"health","status":200,"duration":2.16,"view":0.0,"db":0.71}
{"method":"GET","path":"/health","format":"html","controller":"ApplicationController","action":"health","status":200,"duration":2.02,"view":0.0,"db":0.65}

It seems it is ignoring ua and ip. What could be the issue ?

Also, how can I add timestamps to the logs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant