Logstash http output basic auth base64 encode not parsed

Hello i followed some guides on how to do basic auth in logstash. However, when i check the outgoing packet from logstash, the HTTP protocol contains "Authorization: Basic %{password}" instead of "Authorization: Basic <base64 encoded string (user:pass)>"

here is my config

    input {
      beats {
    host => "localhost"
    port => 5044
      }
    }

    filter {
      mutate {
    remove_field =>  [ "host", "@timestamp", "@version", "tags", "input", "ecs", "agent", "log", "offset"]
      }
      grok {
    patterns_dir => ["C:\\logstash\\patterns"]
    match => { "message" => "%{COMMON_TIMESTAMP:timestamp}"}
      }
      ruby {
    	code => "
    		require 'base64';
    		event['password'] = Base64.encode64('root:root').sub(/\n/,'')
    	"
      }
    }

    output {
      stdout { codec => rubydebug }
      http {
    	headers => {"Authorization" => "Basic %{password}"}
    url => ["http://localhost:9999/api/v1/logs/data"]
    http_method => "post"
    	content_type => "application/json"
    format => json
      }
    }

Additionally i am using logstash-7.7.0

You can no longer reference the event as a hash. You have to use the Event API | Logstash Reference [7.12] | Elastic.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.