From 098458476c012e9bef649824fc07741dffef570b Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 11 Jun 2026 13:26:41 +0900 Subject: [PATCH 1/2] Replace yajl-ruby with the json gem for JSON handling Since the yajl-ruby gem depends on a deprecated Ruby C API, it cannot be installed with Ruby 4.1. Signed-off-by: Shizuo Fujita --- README.md | 4 ++-- lib/fluent/plugin/out_pgjson.rb | 6 +++--- test/plugin/test_out.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6f1d061..223b484 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ CREATE TABLE fluentd ( #tag_col tag #record_col record #msgpack false - #encoder yajl + #encoder json ``` @@ -87,7 +87,7 @@ CREATE TABLE fluentd ( |tag_col|The column name for the tag|`tag`| |record_col|The column name for the record|`record`| |msgpack|If true, insert records formatted as msgpack|`false`| -|encoder|JSON encoder (`yajl`, `json`)|`yajl`| +|encoder|JSON encoder (`yajl`, `json`)|`json`| ## Copyright diff --git a/lib/fluent/plugin/out_pgjson.rb b/lib/fluent/plugin/out_pgjson.rb index 3d147bf..7164b7f 100755 --- a/lib/fluent/plugin/out_pgjson.rb +++ b/lib/fluent/plugin/out_pgjson.rb @@ -1,6 +1,5 @@ require "fluent/plugin/output" require "pg" -require "yajl" require "json" module Fluent::Plugin @@ -34,7 +33,7 @@ class PgJsonOutput < Fluent::Plugin::Output desc "If true, insert records formatted as msgpack" config_param :msgpack, :bool, default: false desc "JSON encoder (yajl/json)" - config_param :encoder, :enum, list: [:yajl, :json], default: :yajl + config_param :encoder, :enum, list: [:yajl, :json], default: :json # NOTE: Contains yajl for backward compatibility config_param :time_format, :string, default: "%F %T.%N %z" @@ -56,7 +55,8 @@ def configure(conf) end @encoder = case @encoder when :yajl - Yajl + log.info "encoder 'yajl' is deprecated. Please use 'json' instead." + JSON when :json JSON end diff --git a/test/plugin/test_out.rb b/test/plugin/test_out.rb index 12df2b9..b9ba1e4 100644 --- a/test/plugin/test_out.rb +++ b/test/plugin/test_out.rb @@ -17,7 +17,7 @@ class PgJsonOutputTest < Test::Unit::TestCase TIME_COL = "time" TAG_COL = "tag" RECORD_COL = "record" - ENCODER = Yajl + ENCODER = JSON CONFIG = %[ @type pgjson From b492565f2d899c7d8380719607bacb003bb0e64a Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 12 Jun 2026 10:38:21 +0900 Subject: [PATCH 2/2] Update README.md Co-authored-by: Kentaro Hayashi --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 223b484..871358c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ CREATE TABLE fluentd ( |tag_col|The column name for the tag|`tag`| |record_col|The column name for the record|`record`| |msgpack|If true, insert records formatted as msgpack|`false`| -|encoder|JSON encoder (`yajl`, `json`)|`json`| +|encoder|JSON encoder (`yajl`, `json`) Starting from v1.0.3, `yajl` is no longer available and internally defaults to `json`|`json`| ## Copyright