본문 바로가기
개발일기/project

[Troubleshooting] #5 Docker로 띄운 Fluent-bit 에러

by 햄리뮤 2025. 3. 7.
반응형

 

https://www.jordan.network.global/en/troubleshooting.jsp




문제: fluent-bit 에서 elasticsearch 로 보낼때 나오는 time 값 관련 에러

[2025/02/26 08:31:22] [error] [output:es:es.0] error: Output 2025-02-26T08:31:22.255077650Z {"errors":true,"took":4,"items":[{"create":{"_index":"chat_message","_id":"L8VhQZUBlJUutjxyyMyK","status":400,"error":{"type":"strict_dynamic_mapping_exception","reason":"[1:15] mapping set to strict, dynamic introduction of [@timestamp] within [_doc] is not allowed"}}}]} 2025-02-26T08:31:22.255079421Z 
[2025/02/26 08:31:22] [debug] [upstream] KA connection #60 to elasticsearch1:9200 is now available 2025-02-26T08:31:22.255080401Z 
[2025/02/26 08:31:22] [debug] [out flush] cb_destroy coro_id=0 2025-02-26T08:31:22.255081298Z 
[2025/02/26 08:31:22] [debug] [retry] new retry created for task_id=0 attempts=1 2025-02-26T08:31:22.255082273Z 
[2025/02/26 08:31:22] [ warn] [engine] failed to flush chunk '1-1740558681.384622220.flb', retry in 10 seconds: task_id=0, input=http.0 > output=es.0 (out_id=0) 2025-02-26T08:31:32.248086444Z 
[2025/02/26 08:31:32] [debug] [output:es:es.0] task_id=0 assigned to thread #1 2025-02-26T08:31:32.248576041Z 
[2025/02/26 08:31:32] [debug] [upstream] KA connection #61 to elasticsearch1:9200 is connected 2025-02-26T08:31:32.248598728Z 
[2025/02/26 08:31:32] [debug] [http_client] not using http_proxy for header 2025-02-26T08:31:32.253506841Z 
[2025/02/26 08:31:32] [debug] [output:es:es.0] HTTP Status=200 URI=/_bulk 2025-02-26T08:31:32.253529052Z 
[2025/02/26 08:31:32] [debug] [output:es:es.0] error caused by: Input 2025-02-26T08:31:32.253530725Z {"create":{"_index":"chat_message"}} 2025-02-26T08:31:32.253531920Z {"@timestamp":"2025-02-26T08:31:21.384Z","created_at":"2025-02-26 17:31:21","edited_at":null,"is_deleted":false,"message":"1","message_id":"49d9796f-ac8c-4a80-997e-d86b538ce493","message_type":"text","receiver":"Bob","receiver_user_id":"Bob","room_name":"Room-1","room_id":"1","sender":"Alice","sender_user_id":"Alice","status":"sent"} 2025-02-26T08:31:32.253534089Z

에러 원인: 인덱스 생성시 dynamic: strict 로 설정 해놔서 추가 컬럼이 들어오면 에러가 나오게 했었다...

"dynamic": "strict",

해결: @timestamp 값을 각 인덱스에 추가해주었다... (추가 컬럼이 들어와도 허용하게하는 옵션으로 변경하거나)

[2025/02/26 09:27:01] [debug] [task] created task=0x7f0a55c36640 id=0 OK 2025-02-26T09:27:01.231477679Z 
[2025/02/26 09:27:01] [debug] [output:es:es.0] task_id=0 assigned to thread #0 2025-02-26T09:27:01.232816615Z 
[2025/02/26 09:27:01] [debug] [upstream] KA connection #60 to elasticsearch1:9200 is connected 2025-02-26T09:27:01.232834815Z 
[2025/02/26 09:27:01] [debug] [http_client] not using http_proxy for header 2025-02-26T09:27:01.244285862Z 
[2025/02/26 09:27:01] [debug] [output:es:es.0] HTTP Status=200 URI=/_bulk 2025-02-26T09:27:01.244308804Z 
[2025/02/26 09:27:01] [debug] [output:es:es.0] Elasticsearch response 2025-02-26T09:27:01.244310635Z {"errors":false,"took":9,"items":[{"create":{"_index":"chat_message","_id":"qaCUQZUBx3wnI7x0u3Fy","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"_seq_no":0,"_primary_term":1,"status":201}}]} 2025-02-26T09:27:01.244312647Z 
[2025/02/26 09:27:01] [debug] [upstream] KA connection #60 to elasticsearch1:9200 is now available 2025-02-26T09:27:01.244314059Z 
[2025/02/26 09:27:01] [debug] [out flush] cb_destroy coro_id=0 2025-02-26T09:27:01.244341488Z 
[2025/02/26 09:27:01] [debug] [task] destroy task=0x7f0a55c36640 (task_id=0)

 

추가로 fluent-bit.conf 설정도 아래처럼 바꾸었따. Filter 부분이 먹히지 않는건지 @timestamp가 계속 찍혔음 ㅠㅠ

[Service]
    Flush         1
    Log_Level     debug
    Daemon        Off
    Parsers_File  /fluent-bit/etc/parsers.conf

[Input]
    Name          http
    Listen        0.0.0.0
    Port          9880
    Tag           chat

[Filter]
    Name          modify
    Match         chat
    Remove        @timestamp
    Remove        hostname

[Output]
    Name          es
    Match         *
    Host          elasticsearch1
    Port          9200
    HTTP_User     elastic
    HTTP_Passwd   1016
    Index         chat_message
    Logstash_Format Off
    Suppress_Type_Name On
    Retry_Limit   False
    Trace_Error   On

 

** 그냥 하루하루 개인 공부한 것을 끄적 거리는 공간입니다.

이곳 저곳에서 구글링한 것과 강의 들은 내용이 정리가 되었습니다.

그림들은 그림밑에 출처표시를 해놓았습니다.

문제가 될시 말씀해주시면 해당 부분은 삭제 하도록하겠습니다. **

반응형

댓글