Skip to content

Tail input plugin doesn't respect SIGTERM signal  #3323

@shenmuxiaosen

Description

@shenmuxiaosen

Check CONTRIBUTING guideline first and here is the list to help us investigate the problem.

Describe the bug
We use tail input plugin to read logs. And Fluentd is deployed as daemonset in Kubernetes. During deployment, Kubernetes will first send a SIGTERM signal to Fluentd container to ask it to gracefully shut down. But tail input plugin keeps reading data until the container eventually killed.

To Reproduce
Run Fluentd in Kubernetes and trigger a deployment.

Expected behavior
When receive SIGTERM, tail should stop reading, keep record of current position and flush out memory buffers.

Your Environment

  • Fluentd or td-agent version: td-agent 4.1.0 fluentd 1.12.1 (e3effa337593618cbd7f0f4ef071766df1ec69a0)
  • Operating system: Ubuntu 18.04.5 LTS (Bionic Beaver)
  • Kernel version: 5.4.0-1039-azure

If you hit the problem with older fluentd version, try latest version first.

Your Configuration

<source>
  @type tail
  path /var/log/containers/*.log
  pos_file /var/log/fluentd-containers.log.pos
  time_key @timestamp
  tag kubernetes.*
  format json
  read_from_head true
</source>

Your Error Log

N/A

Additional context

N/A

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions