Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tail input silently ignores files in unreadable directories #16188

Open
cpinflux opened this issue Nov 13, 2024 · 0 comments
Open

Tail input silently ignores files in unreadable directories #16188

cpinflux opened this issue Nov 13, 2024 · 0 comments
Labels
bug unexpected problem or unintended behavior

Comments

@cpinflux
Copy link

Relevant telegraf.conf

[global_tags]

[agent]
  interval = "5s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  flush_interval = "1s"
  precision = "1ms"

[[inputs.tail]]
  files = [ "/home/myuser/root_only/myfile" ]
  data_format = "influx"

Logs from Telegraf

$ telegraf --config telegraf-basic.conf  --debug --test
2024-11-13T11:36:48Z I! Loading config: telegraf-basic.conf
2024-11-13T11:36:48Z I! Starting Telegraf 1.32.2 brought to you by InfluxData the makers of InfluxDB
2024-11-13T11:36:48Z I! Available plugins: 235 inputs, 9 aggregators, 32 processors, 26 parsers, 62 outputs, 6 secret-stores
2024-11-13T11:36:48Z I! Loaded inputs: tail
2024-11-13T11:36:48Z I! Loaded aggregators:
2024-11-13T11:36:48Z I! Loaded processors:
2024-11-13T11:36:48Z I! Loaded secretstores:
2024-11-13T11:36:48Z W! Outputs are not used in testing mode!
2024-11-13T11:36:48Z I! Tags enabled: host=thinkpad
2024-11-13T11:36:48Z D! [agent] Initializing plugins
2024-11-13T11:36:48Z D! [agent] Starting service inputs
2024-11-13T11:36:48Z D! [agent] Stopping service inputs
2024-11-13T11:36:48Z D! [agent] Input channel closed
2024-11-13T11:36:48Z D! [agent] Stopped Successfully

System info

Fedora 44, Telegraf 1.32.2

Docker

No response

Steps to reproduce

  1. Run telegraf with a tail input that references a file in a directory to which there are no access permissions for the executing user

Expected behavior

If a file can not be reached because of directory permissions then an error should be reported.

Actual behavior

No error is reported, telegraf ignores the input

Additional info

I couldn't work out in the code at what point the path access is evaluated, it seems to be quite early on as when the code is adding the tail, there are unaviodable error messages there that would be printed had it failed inside the Tail module.

This works fine for actual file permissions, but not for directories.

@cpinflux cpinflux added the bug unexpected problem or unintended behavior label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant