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

Fix basedir check and parent dir extraction in filecount input #5630

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

danielnelson
Copy link
Contributor

Not just a Windows bug, previously we would panic on paths without a /, and it was possible to not detect the top directory if it was aliased with a different path.

closes #5621

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added the fix pr to fix corresponding bug label Mar 26, 2019
@danielnelson danielnelson added this to the 1.10.2 milestone Mar 26, 2019
@danielnelson danielnelson merged commit 5f74c0d into master Mar 27, 2019
@danielnelson danielnelson deleted the fix-filecount-windows-relative branch March 27, 2019 01:12
danielnelson added a commit that referenced this pull request Mar 27, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
hwaastad pushed a commit to hwaastad/telegraf that referenced this pull request Jun 13, 2019
@SimonMcN
Copy link

SimonMcN commented Jul 2, 2019

This does not work for me on windows, was the fix tested on windows, or just linux please ?
2019-07-02T13:32:03Z I! Loaded inputs: filecount win_services win_perf_counters
2019-07-02T13:32:03Z I! Loaded aggregators:
2019-07-02T13:32:03Z I! Loaded processors:
2019-07-02T13:32:03Z I! Loaded outputs: influxdb
2019-07-02T13:32:03Z I! Tags enabled: ENV=PROD host=DLS07-P
2019-07-02T13:32:03Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"DLS07-P", Flush Interval:10s
2019-07-02T13:32:58Z I! [agent] Hang on, flushing any cached metrics before shutdown

tested with:
C:\telegraf\telegraf.exe --config c:\telegraf\prod.conf --config-directory c:\telegraf\conf.d --test --debug

[[inputs.filecount]]
directories = ["E:/mydirectory/processed/Failed"]
name = "*"
recursive = true
regular_only = true
size = "0B"
mtime = "0s"

@SimonMcN
Copy link

SimonMcN commented Jul 2, 2019

telegraf.exe V1.11.0

@danielnelson
Copy link
Contributor Author

@SimonMcN Most likely I only tested on Linux, I'll reopen the issue and try it out when I have a Windows system available.

@SimonMcN
Copy link

SimonMcN commented Jul 2, 2019

I'd appreciate it. I know the Linux and windows filesystems have different mount point syntax so it would be easy to break it by mistake..... Either that or I am incapable 🤔😐😋

@danielnelson
Copy link
Contributor Author

Looks to be related to the path separators, I believe using backslashes will workaround this issue until the fix is released. You can either escape the backslashes \\ or use single quote "literal" strings:

directories = ['E:\mydirectory\processed\Failed']

@danielnelson
Copy link
Contributor Author

Fix for the separator issue is here: #6077

bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filecount not working on Windows
4 participants