fluent / fluent/fluentd

Log files with same inode number in different block Device caused missing log file

Open
#4,326 3 comments 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Ruby
Stars
13.6k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
20

Description

### Describe the bug

I have two log files in different block device. Two log files have same file name and same inode number.

```
The first file with inode 17 in device fh72h/64882d
stat /var/lib/kubelet/pods/pod-uid-1/volumes/kubernetes.io~csi/local-pv-id-1/mount/xx/xx/file.log
Device: fh72h/64882d Inode:17

The second file with inode 17 in device fd53h/64851d
stat /var/lib/kubelet/pods/pod-uid-2/volumes/kubernetes.io~csi/local-pv-id-2/mount/xx/xx/file.log
Device: fd53h/64851d Inode:17
```

When I want collect the two file.log, I find fluentd only collect one file, the other one doesn't show the fluentd tail target and existing list.

```
tailing paths: target = /var/lib/kubelet/pods/pod-uid-1/volumes/kubernetes.io~csi/local-pv-id-1/mount/xx/xx/file.log |
existing = /var/lib/kubelet/pods/pod-uid-1/volumes/kubernetes.io~csi/local-pv-id-1/mount/xx/xx/file.log
```

### To Reproduce

1. mount two block device to different mountpoint
2. cd mountpoint, make new file, I think default inode number is same
3. start fluentd , set config **follow_inodes true**

### Expected behavior

Fluentd can identify inode number in different block device, and collect log.

### Your Environment

```markdown
- Fluentd version:1.16.2
- TD Agent version:
- Operating system: Centos7
- Kernel version:3.10.0-1160.92.1.el7.x86_64
```

### Your Configuration

```apache

@type tail
read_from_head true
skip_refresh_on_startup true
path /var/lib/kubelet/pods/*/volumes/kubernetes.io~csi/*/mount/namespace/*/*/*.log
pos_file /var/log/csi_namespace.log.pos
refresh_interval 5s
tag "csi_namespace"
limit_recently_modified 7d
format /?.*/

```

### Your Error Log

```shell
There is no error log, just can't get the log. And Fluentd print existing just include one log file.
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with Fluentd's tail source behavior for follow_inodes and the existing-list/tailing-path output, using the provided two-mount reproduction and configuration as the entry point. Trace how the pos_file at /var/log/csi_namespace.log.pos distinguishes files, then verify that both same-named files are discovered and collected when their device and inode values differ.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.