Skip to content

Glob Pattern at inputs.tail not working properly #7419

@th3-w1ll

Description

@th3-w1ll

Relevant telegraf.conf:

[[inputs.tail]]
  ## File names or a pattern to tail.
  ## These accept standard unix glob matching rules, but with the addition of
  ## ** as a "super asterisk". ie:
  ##   "/var/log/**.log"  -> recursively find all .log files in /var/log
  ##   "/var/log/*/*.log" -> find all .log files with a parent dir in /var/log
  ##   "/var/log/apache.log" -> just tail the apache log file
  ##
  ## See https://github.com/gobwas/glob for more examples
  ##
  files = ["/home/test/2020041[!1-8]*"]

  ## Read file from beginning.
  # from_beginning = false

  ## Whether file is a named pipe
  # pipe = false
   grok_patterns = ["'''%{GREEDYDATA:message}'''"]
   data_format = "grok"

System info:

Telegraf 1.14.1

Steps to reproduce:

  1. create files:
    touch /home/test/202004182350
    touch /home/test/202004190000
    touch /home/test/202004190010

  2. start telegraf

Expected behavior:

telegraf should open the files 202004190000 and 202004190010

Actual behavior:

telegraf opens the file 202004182350
2020-04-28T06:43:25Z D! [inputs.tail] Tail added for "/home/test/202004182350"

Additional info:

I think there is an problem with the glob parser, all glob testing-tools say that the glob-pattern is correct:

https://www.digitalocean.com/community/tools/glob?comments=true&glob=%2Fhome%2Ftest%2F2020041%5B%211-8%5D%2A&matches=false&tests=%2Fhome%2Ftest%2F202004180010&tests=%2Fhome%2Ftest%2F202004190010

Metadata

Metadata

Assignees

Labels

area/tailbugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions