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

Custom fields are not being added to Request statements in logstasher log #123

Open
cyndefromva opened this issue Oct 19, 2016 · 2 comments

Comments

@cyndefromva
Copy link

I have added a config/logstasher.yml file to my project to enable logstasher. Here is its contents:

controller_enabled: true
mailer_enabled: false
record_enabled: false
job_enabled: true
view_enabled: true
suppress_app_log: false
development:
enabled: true
record_enabled: true
production:
enabled: true
mailer_enabled: true
view_enabled: false
suppress_app_log: true

And the following initializer (config/initializers/logstasher.rb):

LogStasher.add_custom_fields do |fields|
fields[:user_login] = "somevalue"
fields[:user_email] = "somevalue"
end

LogStasher.add_custom_fields_to_request_context do |fields|
fields[:user_login] = "somevalue"
fields[:user_email] = "somevalue"
end

As you can see I have added two customized fields (user_login and user_email); and both appear in the logstasher log file for view statements:

{"identifier":"people/in_work.html.erb","layout":null,"name":"render_template.action_view","transaction_id":"6488c45585e6c0f95da8","duration":1124.35,"request_id":"5e9f149b-029d-45da-8082-26e1075aa08f","user_login":"somevalue","user_email":"somevalue","source":"unknown","tags":[],"@timestamp":"2016-10-19T13:16:53Z","@Version":"1"}

However, they do not appear in request statements:

{"method":"GET","path":"/people/in_work","format":"/","controller":"people","action":"in_work","status":200,"duration":1182.23,"view":684.49,"db":0.0,"source":"unknown","tags":["request"],"@timestamp":"2016-10-19T13:16:53Z","@Version":"1"}

I am using rails 4.2.3 and the latest version of logstasher (v1.0.1). What am I missing?

@cyndefromva cyndefromva changed the title Custom fields are not being added to Controller Request Custom fields are not being added to Request statements in logstasher log Oct 19, 2016
@schechter
Copy link

We are having the same issue with Logstasher 1.0.1 and rails 5.0.0.1.

Custom fields are being added for record and view, but not for controller.

@ernetas
Copy link

ernetas commented Mar 2, 2017

Any chance somevalue is not available (e.g. using something like context.user_login? Does it work when you set it to actually static value?

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

3 participants