From f07ee2b975dd8c7325dc1472adc005dc27f91076 Mon Sep 17 00:00:00 2001
From: Kentaro Hayashi <hayashi@clear-code.com>
Date: Thu, 11 Jul 2024 14:51:36 +0900
Subject: [PATCH 1/3] Fix graylog connecting issue

Closes: #1479

Feedback from @mszyzdek
ref. https://github.com/fluent/fluentd-kubernetes-daemonset/issues/1479#issuecomment-1996018837

* graylog flavour of fluentd-kubernetes-daemonset uses gelf 3.0.0 and
  this version of gelf gem has Fixnum in code,
  https://github.com/graylog-labs/gelf-rb/commit/7cc3cbb63556f54967699e034b1d51cf30bf1c6f
* in ruby 3.2 Fixnum was removed after previous deprecation in version 2.4
  https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/
* ruby in newest fluentd was upgraded to 3.2
  https://github.com/fluent/fluentd-docker-image/commit/4f1d5e8dcdbbed10d1458edaecfb771f6ba9f05e
  so it also happened in fluentd-kubernetes-daemonset
* gelf 3.0.0 cannot work with ruby 3.2+ so we can see sad error on container start

NOTE: Even though gelf was updated to 3.1.0, still it has problem with
reloading Fluentd configuration with SIGUSR2. This is known issue
since Fluentd 1.8.0.
ref. https://github.com/fluent/fluentd/issues/2709

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
---
 templates/Gemfile.erb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/Gemfile.erb b/templates/Gemfile.erb
index 0e058413f..12c4281ae 100644
--- a/templates/Gemfile.erb
+++ b/templates/Gemfile.erb
@@ -45,7 +45,7 @@ gem "fluent-plugin-s3", "~> 1.7.0"
 <% when "gcs" %>
 gem "fluent-plugin-gcs", "0.4.2"
 <% when "graylog" %>
-gem "gelf", "3.0.0"
+gem "gelf"
 gem "fluent-plugin-gelf-hs", "~> 1.0.7"
 <% when "logzio" %>
 gem "fluent-plugin-logzio", "~> 0.2.2"

From 48d726d3bd4ed87b6ed20db5d167b3d4159c4da2 Mon Sep 17 00:00:00 2001
From: Kentaro Hayashi <hayashi@clear-code.com>
Date: Fri, 12 Jul 2024 16:50:02 +0900
Subject: [PATCH 2/3] Bump version to v1.17.0-1.2

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 0e49157c5..661659d21 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ X86_IMAGES := \
 	v1.17/debian-syslog:v1.17.0-debian-syslog-amd64-1.1,v1.17-debian-syslog-amd64-1 \
 	v1.17/debian-forward:v1.17.0-debian-forward-amd64-1.1,v1.17-debian-forward-amd64-1 \
 	v1.17/debian-gcs:v1.17.0-debian-gcs-amd64-1.1,v1.17-debian-gcs-amd64-1 \
-	v1.17/debian-graylog:v1.17.0-debian-graylog-amd64-1.1,v1.17-debian-graylog-amd64-1 \
+	v1.17/debian-graylog:v1.17.0-debian-graylog-amd64-1.2,v1.17-debian-graylog-amd64-1 \
 	v1.17/debian-papertrail:v1.17.0-debian-papertrail-amd64-1.1,v1.17-debian-papertrail-amd64-1 \
 	v1.17/debian-logzio:v1.17.0-debian-logzio-amd64-1.1,v1.17-debian-logzio-amd64-1 \
 	v1.17/debian-kafka:v1.17.0-debian-kafka-amd64-1.1,v1.17-debian-kafka-amd64-1 \
@@ -44,7 +44,7 @@ ARM64_IMAGES := \
 	v1.17/arm64/debian-syslog:v1.17.0-debian-syslog-arm64-1.1,v1.17-debian-syslog-arm64-1 \
 	v1.17/arm64/debian-forward:v1.17.0-debian-forward-arm64-1.1,v1.17-debian-forward-arm64-1 \
 	v1.17/arm64/debian-gcs:v1.17.0-debian-gcs-arm64-1.1,v1.17-debian-gcs-arm64-1 \
-	v1.17/arm64/debian-graylog:v1.17.0-debian-graylog-arm64-1.1,v1.17-debian-graylog-arm64-1 \
+	v1.17/arm64/debian-graylog:v1.17.0-debian-graylog-arm64-1.2,v1.17-debian-graylog-arm64-1 \
 	v1.17/arm64/debian-papertrail:v1.17.0-debian-papertrail-arm64-1.1,v1.17-debian-papertrail-arm64-1 \
 	v1.17/arm64/debian-logzio:v1.17.0-debian-logzio-arm64-1.1,v1.17-debian-logzio-arm64-1 \
 	v1.17/arm64/debian-kafka:v1.17.0-debian-kafka-arm64-1.1,v1.17-debian-kafka-arm64-1 \

From 46aadcc79b59f11e3f754b5f4a2a0dcf0bb528fd Mon Sep 17 00:00:00 2001
From: Kentaro Hayashi <hayashi@clear-code.com>
Date: Fri, 12 Jul 2024 16:51:51 +0900
Subject: [PATCH 3/3] Add v1.17.0-1.2 graylog images

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
---
 docker-image/v1.17/arm64/debian-graylog/Gemfile         | 2 +-
 docker-image/v1.17/arm64/debian-graylog/Gemfile.lock    | 4 ++--
 docker-image/v1.17/arm64/debian-graylog/hooks/post_push | 2 +-
 docker-image/v1.17/debian-graylog/Gemfile               | 2 +-
 docker-image/v1.17/debian-graylog/Gemfile.lock          | 4 ++--
 docker-image/v1.17/debian-graylog/hooks/post_push       | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/docker-image/v1.17/arm64/debian-graylog/Gemfile b/docker-image/v1.17/arm64/debian-graylog/Gemfile
index 366a3b5f3..9509092db 100644
--- a/docker-image/v1.17/arm64/debian-graylog/Gemfile
+++ b/docker-image/v1.17/arm64/debian-graylog/Gemfile
@@ -15,7 +15,7 @@ gem "fluent-plugin-record-modifier", "~> 2.1.0"
 gem "fluent-plugin-detect-exceptions", "~> 0.0.13"
 gem "fluent-plugin-rewrite-tag-filter", "~> 2.4.0"
 gem "fluent-plugin-parser-cri", "~> 0.1.0"
-gem "gelf", "3.0.0"
+gem "gelf"
 gem "fluent-plugin-gelf-hs", "~> 1.0.7"
 gem "fluent-plugin-kubernetes_metadata_filter", "~> 3.5.0"
 gem "ffi"
diff --git a/docker-image/v1.17/arm64/debian-graylog/Gemfile.lock b/docker-image/v1.17/arm64/debian-graylog/Gemfile.lock
index 150a443b6..d334e2872 100644
--- a/docker-image/v1.17/arm64/debian-graylog/Gemfile.lock
+++ b/docker-image/v1.17/arm64/debian-graylog/Gemfile.lock
@@ -61,7 +61,7 @@ GEM
       tzinfo-data (~> 1.0)
       webrick (~> 1.4)
       yajl-ruby (~> 1.0)
-    gelf (3.0.0)
+    gelf (3.1.0)
       json
     http (5.2.0)
       addressable (~> 2.8)
@@ -137,7 +137,7 @@ DEPENDENCIES
   fluent-plugin-rewrite-tag-filter (~> 2.4.0)
   fluent-plugin-systemd (~> 1.0.5)
   fluentd (= 1.17.0)
-  gelf (= 3.0.0)
+  gelf
   oj (~> 3.15.0)
   rexml (~> 3.2.5)
 
diff --git a/docker-image/v1.17/arm64/debian-graylog/hooks/post_push b/docker-image/v1.17/arm64/debian-graylog/hooks/post_push
index be16a1bb7..97b26ba33 100644
--- a/docker-image/v1.17/arm64/debian-graylog/hooks/post_push
+++ b/docker-image/v1.17/arm64/debian-graylog/hooks/post_push
@@ -13,7 +13,7 @@ curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download
 chmod +x manifest-tool
 
 # Tag and push image and manifest list for each additional tag
-for tag in {v1.17.0-debian-graylog-arm64-1.1,v1.17-debian-graylog-arm64-1}; do
+for tag in {v1.17.0-debian-graylog-arm64-1.2,v1.17-debian-graylog-arm64-1}; do
   docker tag $IMAGE_NAME ${repoName}:${tag}
   docker push ${repoName}:${tag}
   # Note: this will fail until both the amd64 and arm64 images have been pushed
diff --git a/docker-image/v1.17/debian-graylog/Gemfile b/docker-image/v1.17/debian-graylog/Gemfile
index 366a3b5f3..9509092db 100644
--- a/docker-image/v1.17/debian-graylog/Gemfile
+++ b/docker-image/v1.17/debian-graylog/Gemfile
@@ -15,7 +15,7 @@ gem "fluent-plugin-record-modifier", "~> 2.1.0"
 gem "fluent-plugin-detect-exceptions", "~> 0.0.13"
 gem "fluent-plugin-rewrite-tag-filter", "~> 2.4.0"
 gem "fluent-plugin-parser-cri", "~> 0.1.0"
-gem "gelf", "3.0.0"
+gem "gelf"
 gem "fluent-plugin-gelf-hs", "~> 1.0.7"
 gem "fluent-plugin-kubernetes_metadata_filter", "~> 3.5.0"
 gem "ffi"
diff --git a/docker-image/v1.17/debian-graylog/Gemfile.lock b/docker-image/v1.17/debian-graylog/Gemfile.lock
index 150a443b6..d334e2872 100644
--- a/docker-image/v1.17/debian-graylog/Gemfile.lock
+++ b/docker-image/v1.17/debian-graylog/Gemfile.lock
@@ -61,7 +61,7 @@ GEM
       tzinfo-data (~> 1.0)
       webrick (~> 1.4)
       yajl-ruby (~> 1.0)
-    gelf (3.0.0)
+    gelf (3.1.0)
       json
     http (5.2.0)
       addressable (~> 2.8)
@@ -137,7 +137,7 @@ DEPENDENCIES
   fluent-plugin-rewrite-tag-filter (~> 2.4.0)
   fluent-plugin-systemd (~> 1.0.5)
   fluentd (= 1.17.0)
-  gelf (= 3.0.0)
+  gelf
   oj (~> 3.15.0)
   rexml (~> 3.2.5)
 
diff --git a/docker-image/v1.17/debian-graylog/hooks/post_push b/docker-image/v1.17/debian-graylog/hooks/post_push
index fd48f8ba4..26ade5f87 100644
--- a/docker-image/v1.17/debian-graylog/hooks/post_push
+++ b/docker-image/v1.17/debian-graylog/hooks/post_push
@@ -13,7 +13,7 @@ curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download
 chmod +x manifest-tool
 
 # Tag and push image and manifest list for each additional tag
-for tag in {v1.17.0-debian-graylog-amd64-1.1,v1.17-debian-graylog-amd64-1}; do
+for tag in {v1.17.0-debian-graylog-amd64-1.2,v1.17-debian-graylog-amd64-1}; do
   docker tag $IMAGE_NAME ${repoName}:${tag}
   docker push ${repoName}:${tag}
   # Note: this will fail until both the amd64 and arm64 images have been pushed