
Filter and routing sections in Fluentd are processed top-to-bottom: sources read data in, filters transform records, and matches route them out. Place your filters between
<source> and <match> so the additional context is present before data leaves Fluentd.- Bob creates a
pluginsfolder next to his Fluentd configuration and adds one Ruby file. - Plugin files must be prefixed with
filter_so Fluentd discovers them when scanning plugin directories.
filter_my_custom_filter.rb). It registers as my_custom_filter, exposes a string config parameter additional_data, and stamps each record in filter:
static_info is a placeholder. In production use cases set this to the environment name, owning team, node identifier, or another useful metadata value.
Enabling the plugin in Fluentd’s configuration
Fluentd will not use the plugin just because the file exists — you must reference it in fluent.conf and ensure the <filter> appears between a <source> and the <match> that sends data out.
Example fluent.conf fragment (source → filter → match):
Order is critical. If you place
<filter> after <match>, the lines have already been routed out and the filter will not be applied.plugins folder into the Fluentd container so the runtime can load it. Bob edits the Fluentd DaemonSet YAML, adding a hostPath volume and corresponding volumeMount.

volumeMounts and volumes):
Using
hostPath gives the container direct access to the node filesystem. Validate permissions and security implications before applying in production.plugins folder mounted and the custom filter available.
What the filter produces
When a log line passes through Fluentd after the filter is applied, records include the stamped metadata:
30200.

my_logs_policy.json): a hot phase with rollover at 5 GB or 30 days, and a delete phase at 90 days.

my_logs_template) that matches the index naming pattern Fluentd will create. The template names the ILM policy and sets a rollover alias such as my-logs. Fluentd writes to the alias while ILM rolls the underlying write indices.
Diagram: one stable write alias

- Open Kibana.
- Set the time range (for example, last night).
- Search for
user5(or your stamped field).

Useful references
- Fluentd plugin guide: https://docs.fluentd.org/plugin-development
- Elasticsearch ILM docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-management.html
- Kubernetes DaemonSet docs: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
- Kibana docs: https://www.elastic.co/guide/en/kibana/current/index.html