From ca8c2ce9c0a4349c6848a04f66d84d807459b882 Mon Sep 17 00:00:00 2001 From: Jan Notka Date: Wed, 27 Jan 2021 15:39:17 +0100 Subject: [PATCH] Put pipeline_id into ThreadContext after entering flush_thread --- lib/logstash/outputs/google_bigquery.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/logstash/outputs/google_bigquery.rb b/lib/logstash/outputs/google_bigquery.rb index 1adc2c4..f9afea2 100644 --- a/lib/logstash/outputs/google_bigquery.rb +++ b/lib/logstash/outputs/google_bigquery.rb @@ -9,6 +9,8 @@ require 'fileutils' require 'concurrent' +java_import org.apache.logging.log4j.ThreadContext + # # === Summary # @@ -275,7 +277,9 @@ def write_to_errors_file(messages, table) end def init_batcher_flush_thread + pipeline_id = ThreadContext.get('pipeline.id') @flush_thread = Thread.new do + ThreadContext.put('pipeline.id', pipeline_id) until stopping? Stud.stoppable_sleep(@flush_interval_secs) { stopping? }