Is there a way to add cookie field to logstash http output plugin?โ€

With the following configuration, I just want to forward logs from a file to an http endpoint with cookie being set, but I always got the error "Unknown setting 'cookie' for http {:level=>:error}", looks like http output plugin doesn't support cookie setting? is there any work around?

input {
    file {
        path => "/home/ubuntu/test/input.log"
        start_position => "beginning"
    }
}
filter {
}
output {
    http {
            url => "http://test.com/logs"
            http_method => "post"
            mapping => [ "Body", "%{message}" ]
            cookies => true
            headers => [
                'x-token', '8xxxda92b2xxx5a3f'
            ]
            cookie => [
                'auth-openid', 'xxx6j76xxx9mBvxxxl0yyyqsldfkjOaUhHg'
            ]
            content_type => "application/json"
          }
}

Thanks!indent preformatted text by 4 spaces

Cookies are implemented using HTTP headers so you should be able to use the headers option.

1 Like

It works, thanks!