From 108897b4dec9c4c16d73cb07d03131b986426b68 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Mon, 24 Aug 2026 10:51:50 +0900 Subject: [PATCH 1/2] Add gc_stat input plugin page * Document in_gc_stat, which had no page * Warn that the plugin is a diagnostic tool and must not be configured in production * Cover use_symbol_keys, which decides whether the record keys are symbols or strings * List in_dummy and in_monitor_agent in the input plugin overview, which were missing from it Signed-off-by: Shizuo Fujita --- SUMMARY.md | 1 + input/README.md | 3 ++ input/gc_stat.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 input/gc_stat.md diff --git a/SUMMARY.md b/SUMMARY.md index e75c127b..98e214d6 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -87,6 +87,7 @@ * [sample](input/sample.md) * [dummy](input/dummy.md) * [monitor\_agent](input/monitor_agent.md) + * [gc\_stat](input/gc_stat.md) * [windows\_eventlog](input/windows_eventlog.md) * [Output Plugins](output/README.md) * [file](output/file.md) diff --git a/input/README.md b/input/README.md index c267536e..e2fa7d32 100644 --- a/input/README.md +++ b/input/README.md @@ -29,6 +29,9 @@ Input plugins extend Fluentd to retrieve and pull event logs from the external s * [`in_syslog`](syslog.md) * [`in_exec`](exec.md) * [`in_sample`](sample.md) +* [`in_dummy`](dummy.md) +* [`in_monitor_agent`](monitor_agent.md) +* [`in_gc_stat`](gc_stat.md) * [`in_windows_eventlog`](windows_eventlog.md) ## Other Input Plugins diff --git a/input/gc_stat.md b/input/gc_stat.md new file mode 100644 index 00000000..4976a25f --- /dev/null +++ b/input/gc_stat.md @@ -0,0 +1,90 @@ +# gc\_stat + +The `in_gc_stat` Input plugin periodically emits the statistics of the Ruby garbage collector of the running Fluentd process. Each record is the value returned by [`GC.stat`](https://docs.ruby-lang.org/en/master/GC.html#method-c-stat). + +It is included in Fluentd's core. + +{% hint style='warning' %} +This plugin is a diagnostic tool to investigate a problem of Fluentd itself, such as a memory leak or an unexpected slowdown. Do not configure it in a production environment. Enable it only while you are collecting the data for a specific investigation, and remove it once the investigation is done. +{% endhint %} + +## Example Configuration + +```text + + @type gc_stat + tag gc_stat + emit_interval 10 + + + + @type stdout + +``` + +Refer to the [Configuration File](../configuration/config-file.md) article for the basic structure and syntax of the configuration file. + +## Plugin Helpers + +* [`timer`](../plugin-helper-overview/api-plugin-helper-timer.md) + +## Parameters + +See [Common Parameters](../configuration/plugin-common-parameters.md). + +### `@type` \(required\) + +The value must be `gc_stat`. + +### `tag` \(required\) + +| type | default | version | +| :--- | :--- | :--- | +| string | nil | 0.10.16 | + +The tag assigned to the emitted events. + +### `emit_interval` + +| type | default | version | +| :--- | :--- | :--- | +| time | 60 | 0.10.16 | + +The interval between the emits. + +### `use_symbol_keys` + +| type | default | version | +| :--- | :--- | :--- | +| bool | true | 1.11.0 | + +If `true`, the keys of the record are the symbols returned by `GC.stat`. If `false`, they are converted to strings. + +The default value assumes that the events are sent to [`out_stdout`](../output/stdout.md), which serializes the symbols as strings anyway. Set this parameter to `false` when you send the events to another plugin, because a plugin which looks up a field by its name expects string keys. For example, the [`csv`](../formatter/csv.md) formatter emits empty values for `fields count` unless `use_symbol_keys false` is set. + +## Output Example + +With the example configuration above, the events look like this: + +```text +2026-08-24 10:38:04.387923158 +0900 gc_stat: {"count":20,"time":38,"marking_time":28,"sweeping_time":9,"heap_allocated_pages":184,"heap_empty_pages":0,"heap_allocatable_slots":0,"heap_available_slots":170033,"heap_live_slots":128266,"heap_free_slots":41767,"heap_final_slots":0,"heap_marked_slots":118143,"heap_eden_pages":184,"total_allocated_pages":184,"total_freed_pages":0,"total_allocated_objects":414773,"total_freed_objects":286507,"malloc_increase_bytes":1117672,"malloc_increase_bytes_limit":16777216,"minor_gc_count":15,"major_gc_count":5,"compact_count":0,"read_barrier_faults":0,"total_moved_objects":0,"remembered_wb_unprotected_objects":0,"remembered_wb_unprotected_objects_limit":676,"old_objects":116402,"old_objects_limit":135202,"oldmalloc_increase_bytes":3586192,"oldmalloc_increase_bytes_limit":16777216} +``` + +The set of the keys depends on the Ruby version which runs Fluentd. See [`GC.stat`](https://docs.ruby-lang.org/en/master/GC.html#method-c-stat) for the meaning of each key. + +## Multi-Process Environment + +If you use this plugin under the multi-process environment, each worker emits the statistics of its own process. Since the record itself has no field to tell the workers apart, embed `worker_id` in the tag: + +```text + + @type gc_stat + tag "gc_stat.#{worker_id}" + +``` + +See [config article](../configuration/config-file.md#embedded-ruby-code) for the embedded Ruby code. + +## Learn More + +* [Input Plugin Overview](./) From a579ec18a7c5fded3570fe889da12dbbdd2f6a25 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Mon, 24 Aug 2026 11:04:30 +0900 Subject: [PATCH 2/2] Use danger hint style for the gc_stat warning The hints plugin supports only info, tip, danger and working, so style='warning' renders as alert-undefined and gets no styling. Signed-off-by: Shizuo Fujita --- input/gc_stat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/gc_stat.md b/input/gc_stat.md index 4976a25f..e8f0c444 100644 --- a/input/gc_stat.md +++ b/input/gc_stat.md @@ -4,7 +4,7 @@ The `in_gc_stat` Input plugin periodically emits the statistics of the Ruby garb It is included in Fluentd's core. -{% hint style='warning' %} +{% hint style='danger' %} This plugin is a diagnostic tool to investigate a problem of Fluentd itself, such as a memory leak or an unexpected slowdown. Do not configure it in a production environment. Enable it only while you are collecting the data for a specific investigation, and remove it once the investigation is done. {% endhint %}