logstash-output-sentry
logstash-output-sentry copied to clipboard
Sending `ip_address` in the `user` property
My output looks like this:
sentry {
key => "..."
secret => "..."
project_id => "..."
user => "ip_address:%{clientip}"
message => "errorcode"
level => "[@metadata][sentry][level]"
}
Unfortunately, it seems like Sentry is ignoring the user value. I also tried:
user => { "ip_address" => "%{clientip}" }
No luck. This actually throws an error. But, really, user should take a hash ... so, what needs to happen to make this possible?
Actually trying to use a hash like the example shown is faced with this error message:
[2019-02-18T04:07:50,232][WARN ][logstash.outputs.sentry ] Unhandled exception {:exception=>java.lang.ClassCastException: Cannot cast org.jruby.specialized.RubyArrayTwoObject to org.jruby.RubyString}
Any ideas?
In case anyone comes along after me and has the same issue, I managed to get it to work using this filter:
ruby {
code => 'event.set("[@metadata][sentry][user]", { :ip_address => event.get("clientip") })'
}