I have 2 dockers set up as follows:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.6.0
volumes:
- ./config/elasticsearch/esdata:/usr/share/elasticsearch/data
- ./config/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
stdin_open: true # docker run -i
tty: true # docker run -t
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx1024m -Xms1024m"
healthcheck:
test: curl -s http://elasticsearch:9200 >/dev/null || exit 1
interval: 30s
timeout: 10s
retries: 50
networks:
- elk
logstash:
image: docker.elastic.co/logstash/logstash:8.6.0
volumes:
- ./config/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./config/logstash/pipeline:/usr/share/logstash/pipeline:ro
- /var/log/GDPR/myapplication:/var/log/GDPR/myapplication:ro
ports:
- "5000:5000"
- "4320:4320"
- "4321:4321"
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
networks:
- elk
depends_on:
elasticsearch:
condition: service_healthy
links:
- elasticsearch
networks:
elk:
driver: bridge
and I have a pipeline setup with output as follows:
output {
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "syslog-%{[hostname]}"
user => "logstash_writer"
password => "xxxxx"
}
rabbitmq {
host => "rabbitmq"
exchange => "CloudMapper"
exchange_type => "fanout"
}
stdout { codec => rubydebug }
}
However, I get this error in logstash:
logstash_1 | [2023-03-23T09:51:55,427][WARN ][logstash.outputs.elasticsearchmonitoring][.monitoring-logstash] Elasticsearch Output configured with `ecs_compatibility => v8`, which resolved to an UNRELEASED preview of version 8.0.0 of the Elastic Common Schema. Once ECS v8 and an updated release of this plugin are publicly available, you will need to update this plugin to resolve this warning.
logstash_1 | [2023-03-23T09:51:55,428][WARN ][logstash.javapipeline ][.monitoring-logstash] 'pipeline.ordered' is enabled and is likely less efficient, consider disabling if preserving event order is not necessary
logstash_1 | [2023-03-23T09:51:55,434][INFO ][logstash.javapipeline ][.monitoring-logstash] Starting pipeline {:pipeline_id=>".monitoring-logstash", "pipeline.workers"=>1, "pipeline.batch.size"=>2, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>2, "pipeline.sources"=>["monitoring pipeline"], :thread=>"#<Thread:0x75ae70aa@/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:131 run>"}
logstash_1 | [2023-03-23T09:51:55,655][INFO ][logstash.codecs.jsonlines] ECS compatibility is enabled but `target` option was not specified. This may cause fields to be set at the top-level of the event where they are likely to clash with the Elastic Common Schema. It is recommended to set the `target` option to avoid potential schema conflicts (if your data is ECS compliant or non-conflicting, feel free to ignore this message)
logstash_1 | [2023-03-23T09:51:56,372][INFO ][logstash.codecs.json ] ECS compatibility is enabled but `target` option was not specified. This may cause fields to be set at the top-level of the event where they are likely to clash with the Elastic Common Schema. It is recommended to set the `target` option to avoid potential schema conflicts (if your data is ECS compliant or non-conflicting, feel free to ignore this message)
logstash_1 | [2023-03-23T09:51:56,422][INFO ][logstash.javapipeline ] Pipeline `main` is configured with `pipeline.ecs_compatibility: v8` setting. All plugins in this pipeline will default to `ecs_compatibility => v8` unless explicitly configured otherwise.
logstash_1 | [2023-03-23T09:51:56,448][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//elasticsearch:9200"]}
logstash_1 | [2023-03-23T09:51:56,453][INFO ][logstash.javapipeline ][.monitoring-logstash] Pipeline Java execution initialization time {"seconds"=>1.02}
logstash_1 | [2023-03-23T09:51:56,470][INFO ][logstash.javapipeline ][.monitoring-logstash] Pipeline started {"pipeline.id"=>".monitoring-logstash"}
logstash_1 | [2023-03-23T09:51:56,464][INFO ][logstash.outputs.elasticsearch][main] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://logstash_writer:xxxxxx@elasticsearch:9200/]}}
logstash_1 | [2023-03-23T09:51:57,740][WARN ][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=>"http://logstash_writer:xxxxxx@elasticsearch:9200/"}
logstash_1 | [2023-03-23T09:51:57,753][INFO ][logstash.outputs.elasticsearch][main] Elasticsearch version determined (8.6.0) {:es_version=>8}
logstash_1 | [2023-03-23T09:51:57,753][WARN ][logstash.outputs.elasticsearch][main] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>8}
logstash_1 | [2023-03-23T09:51:57,782][INFO ][logstash.outputs.elasticsearch][main] Config is not compliant with data streams. `data_stream => auto` resolved to `false`
logstash_1 | [2023-03-23T09:51:57,782][INFO ][logstash.outputs.elasticsearch][main] Config is not compliant with data streams. `data_stream => auto` resolved to `false`
logstash_1 | [2023-03-23T09:51:57,782][WARN ][logstash.outputs.elasticsearch][main] Elasticsearch Output configured with `ecs_compatibility => v8`, which resolved to an UNRELEASED preview of version 8.0.0 of the Elastic Common Schema. Once ECS v8 and an updated release of this plugin are publicly available, you will need to update this plugin to resolve this warning.
logstash_1 | [2023-03-23T09:51:57,782][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//elasticsearch:9200"]}
logstash_1 | [2023-03-23T09:51:57,791][INFO ][logstash.outputs.elasticsearch][main] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elasticsearch:9200/]}}
logstash_1 | [2023-03-23T09:51:57,795][INFO ][logstash.outputs.elasticsearch][main] Using a default mapping template {:es_version=>8, :ecs_compatibility=>:v8}
logstash_1 | [2023-03-23T09:51:57,819][WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elasticsearch:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'http://elasticsearch:9200/'"}
logstash_1 | [2023-03-23T09:51:57,832][INFO ][logstash.outputs.elasticsearch][main] Config is not compliant with data streams. `data_stream => auto` resolved to `false`
logstash_1 | [2023-03-23T09:51:57,832][WARN ][logstash.outputs.elasticsearch][main] Elasticsearch Output configured with `ecs_compatibility => v8`, which resolved to an UNRELEASED preview of version 8.0.0 of the Elastic Common Schema. Once ECS v8 and an updated release of this plugin are publicly available, you will need to update this plugin to resolve this warning.
logstash_1 | [2023-03-23T09:51:57,941][INFO ][logstash.outputs.rabbitmq][main] Connected to RabbitMQ {:url=>"amqp://guest:XXXXXX@localhost:5672/"}
logstash_1 | [2023-03-23T09:51:57,979][WARN ][logstash.filters.grok ][main] ECS v8 support is a preview of the unreleased ECS v8, and uses the v1 patterns. When Version 8 of the Elastic Common Schema becomes available, this plugin will need to be updated
logstash_1 | [2023-03-23T09:51:58,135][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>500, "pipeline.sources"=>["/usr/share/logstash/pipeline/dlm_json.conf", "/usr/share/logstash/pipeline/tcp_line.conf"], :thread=>"#<Thread:0x40c1b968@/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:131 run>"}
logstash_1 | [2023-03-23T09:51:58,853][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {"seconds"=>0.72}
logstash_1 | [2023-03-23T09:51:58,955][INFO ][logstash.inputs.tcp ][main][400345d7c05181a57b0233ba5138aadb7696643ede494e3146418e21e00c4124] Starting tcp input listener {:address=>"0.0.0.0:4321", :ssl_enable=>false}
logstash_1 | [2023-03-23T09:51:58,961][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"}
logstash_1 | [2023-03-23T09:51:58,964][INFO ][logstash.inputs.tcp ][main][67ca90918584d8281f37765ed46ff82e5a3db0a18361dd79579bf9607a3678b8] Starting tcp input listener {:address=>"0.0.0.0:4320", :ssl_enable=>false}
logstash_1 | [2023-03-23T09:51:58,975][INFO ][logstash.agent ] Pipelines running {:count=>2, :running_pipelines=>[:".monitoring-logstash", :main], :non_running_pipelines=>[]}
logstash_1 | [2023-03-23T09:52:02,827][WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elasticsearch:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'http://elasticsearch:9200/'"}
logstash_1 | [2023-03-23T09:52:07,834][WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elasticsearch:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'http://elasticsearch:9200/'"}
This is the user setup and his role
When I get onto the logstash docker and do the follow though, I can log in.
$ curl elasticsearch:9200
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}},"status":401}$ ^C
$ ^[[A^C
$ curl logstash_writer:xxxxx@elasticsearch:9200
{
"name" : "e82b58f667db",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "_-n6mq__T7issVWVXUGL9g",
"version" : {
"number" : "8.6.0",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "f67ef2df40237445caa70e2fef79471cc608d70d",
"build_date" : "2023-01-04T09:35:21.782467981Z",
"build_snapshot" : false,
"lucene_version" : "9.4.2",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
Please help!