I have a scenario where I want to publish the log events to the rest API using logstash http output plugin. My rest API has Oauth 2.0 authorization enabled. I have placed the access token in header section of http output plugin but I am getting 401 from the API server. I have tested the same token with SOAPUI and it works fine. Below are my logstash out configs. Any help or idea will be a great favour.
output {
if [type] == "error" {
if "loglevelerror" in [tags] {
#*******************************************************************
# Sending Messages to EventAPI
#*******************************************************************
http {
url => "http://serverip:8281/events"
headers => {
"Authorization" => "Bearer c505e8f7-ecb3-346f-8216-f906965edc17"
"RequestSource" => "agent"
"Accept" => "application/json"
}
connect_timeout => 60
socket_timeout => 60
http_method => "post"
format => "json"
mapping => [my mappings]
}
}
}
}