logstasher icon indicating copy to clipboard operation
logstasher copied to clipboard

Logging / not logging controller params hash

Open tamouse opened this issue 10 years ago • 1 comments

In https://github.com/shadabahmed/logstasher/pull/20 and the README indicating there might be issues with logging the params hash, I'm a bit concerned, as most of the problems I encounter have needed the params hash to discover the source of the errors. I don't want to explode my logs OR lose log records, neither is useful.

Is there an alternative I can use that let's me still view the params hash, but doesn't cause either of those problems to show up? For example, could I somehow have them logged simply as a custom value converted to a string?

tamouse avatar Aug 10 '15 17:08 tamouse

I think one potential solution is to not enable parameter logging, but instead do something like this in your initializer: (ref #66)

fields[:params] = request.filtered_parameters.to_json

That should give you a json string instead of nested fields. But I'm not 100% sure if logstash won't try to parse that JSON, but my guess is that it shouldn't, because the second layer of JSON encoding should entity-ify the params JSON.

ibrahima avatar Apr 06 '16 18:04 ibrahima