Use godirwalk in globpath (#5145)
This commit is contained in:
@@ -73,13 +73,17 @@ func (f *FileStat) Gather(acc telegraf.Accumulator) error {
|
||||
continue
|
||||
}
|
||||
|
||||
for fileName, fileInfo := range files {
|
||||
for _, fileName := range files {
|
||||
tags := map[string]string{
|
||||
"file": fileName,
|
||||
}
|
||||
fields := map[string]interface{}{
|
||||
"exists": int64(1),
|
||||
}
|
||||
fileInfo, err := os.Stat(fileName)
|
||||
if os.IsNotExist(err) {
|
||||
fields["exists"] = int64(0)
|
||||
}
|
||||
|
||||
if fileInfo == nil {
|
||||
log.Printf("E! Unable to get info for file [%s], possible permissions issue",
|
||||
|
||||
Reference in New Issue
Block a user