Fluentd api key를 사용해서 elasticsearch 접속시, 401 에러
2025. 2. 1. 19:55ㆍEFK
에러
Could not communicate to Elasticsearch, resetting connection and trying again. [401] {"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate with provided credentials and anonymous access is not allowed for this request","additional_unsuccessful_credentials":"API key: invalid ApiKey value","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}}],"type":"security_exception","reason":"unable to authenticate with provided credentials and anonymous access is not allowed for this request","additional_unsuccessful_credentials":"API key: invalid ApiKey value","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","ApiKey"]}},"status":401}
api 전달하는 방식 변경: custom_headers 이게 중요함
# 수정전
<match test>
@type elasticsearch
# Specify your Elasticsearch host and port.
host [도메인]
port [포트]
scheme [http || https]
api_key [api key]
</match>
# 수정후
<match test>
@type elasticsearch
# Specify your Elasticsearch host and port.
host [도메인]
port [포트]
scheme [http || https]
custom_headers {"Authorization": "ApiKey [apk key]"}
</match>
'EFK' 카테고리의 다른 글
Elasticsearch 명령어 (0) | 2025.02.01 |
---|---|
Fluentd 서비스 종료하기 (0) | 2025.02.01 |
Fluetnd unexpected error error_class=Elastic::Transport::Transport::Error error="connect_write timeout reached" (0) | 2025.02.01 |
Fluentd unexpected error error_class=Elastic::Transport::Transport::Error error="no address for http (Resolv::ResolvError)" (0) | 2025.02.01 |
Metricbeat logging 변경 하기 (0) | 2025.02.01 |