shadabahmed / logstasher

Awesome rails logs
MIT License
817 stars 136 forks source link

Default message for log lines #154

Open hashwin opened 3 years ago

hashwin commented 3 years ago

When using filebeat, if I specify a message, it shows up in the log stream, otherwise it shows up as failed to find message

Lograge specifes a default message like this: https://github.com/roidrage/lograge/blob/master/lib/lograge/formatters/logstash.rb#L10

I am able to set it for controller methods like this:

LogStasher.add_custom_fields do |fields|
  fields[:message] = "[#{status}] #{fields[:controller]}##{fields[:action]}"
end

But when using ActiveJob and views, this is never called. Ideally, there should be some default messages here because Rails is pretty standard that way, but I should at least be able to configure it. Is there a provision where I could set this up?