lograge
lograge copied to clipboard
Cannot filter based on log message
We need to filter this Rails message from our logs (I know what I am doing):
Can't verify CSRF token authenticity.
I have used this:
config.lograge.ignore_custom = lambda do |event|
return true if event.payload[:message] == "Can't verify CSRF token authenticity."
return false
end
The problem is that the above code is not working, it doesn't remove those messages from logs.
The lambda is not triggered for the above message. The lambda is only invoked in general for the controller action (and in that case event.payload[:message] is always nil and there is no other way to access message from event).