logging - Parse logs with opentelemetry collector - Stack Overflow

admin2025-04-19  0

Im trying parse logs received in my opentelemetry collector from one application in spring boot using logback by grpc with otlp protoco and finally send to elasticsearch by collector opentelemetry-collector-contrib:0.117.0

My intention is from this example log:

2025-02-26T09:00:13.611503606+01:00 DEBUG [2025-02-26 09:00:13,610] [.springframework.kafka.KafkaListenerEndpointContainer#15-0-C-1] [] [UpdateSettingsListener] Handling command UpdateSettingsMessage[**context=SAAI-egypt**, additional={interval_canceled=20, booking_status=[1, 3], api_keys=[api-key], last_fetch_date=2025-02-26T08:00:03.985Z, date_filter_mode=3, interval_active=10}], received at 1740556813610

I've tried all types of processors: transform, text, etc but nothing works...

Extract a new field "context" with dynamic value in every log for output in elasticsearch:

Desired result:

{
  "_index": ".ds-dvlp-op-ci-bin-log-2025.02.25-000062",
  "_id": "0nfqQZUBuQEk-wxXPD8h",
  "_version": 1,
  "_score": 0,
  "_source": {
    "@timestamp": "2025-02-26T11:00:08.839000000Z",
    "Body": "Command: UpdateAdditionalSettings[lastFetchDate=2025-02-26T11:00:01.973Z, context=SAAI-egypt] executed at 1740567608839",
  "context": SAAI-egypt
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745062966a282812.html

最新回复(0)