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

'??' glob pattern not working in recent versions for --logs argument #638

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

jaqx0r
Copy link
Contributor

@jaqx0r jaqx0r commented Apr 23, 2024

'??' glob pattern for --logs argument used to work (in v3.0.0-rc36) but stopped working in recent versions.

I have the following log files:

/var/log/my_prog/my_prog.log.20220419_14
/var/log/my_prog/my_prog.log.20220419_15

I am starting the latest build of mtail with the following arguments:
/tmp/mtail.rc48 -port 12345 -progs /etc/mtail/my-progs/ -logtostderr -disable_fsnotify -logs '/var/log/my_prog/my_prog.log.*_??'

Mtail does not tail the files:

runtime.go:188] Loaded program sockets.mtail
runtime.go:84] unmarking sockets.mtail
mtail.go:126] Listening on [::]:12345

If I start it with:
/tmp/mtail.rc48 -port 12345 -progs /etc/mtail/my-progs/ -logtostderr -disable_fsnotify -logs '/var/log/my_prog/my_prog.log.*_[0-9][0-9]'
It tails the files:

runtime.go:188] Loaded program sockets.mtail
runtime.go:84] unmarking sockets.mtail
logstream.go:61] Parsed url as /var/log/my_prog/my_prog.log.20220419_14
tail.go:287] Tailing /var/log/my_prog/my_prog.log.20220419_14
logstream.go:61] Parsed url as /var/log/my_prog/my_prog.log.20220419_15
tail.go:287] Tailing /var/log/my_prog/my_prog.log.20220419_15
mtail.go:126] Listening on [::]:12345

the -logs '/var/log/my_prog/my_prog.log.*_??' argument works in version v3.0.0-rc36, so I think this bug was introduced in a new version.

Moreover, according to https://google.github.io/mtail/Deploying.html,

--logs is a comma separated list of filenames to extract from, but can also be used multiple times, and each filename can be a glob pattern.

And the glob pattern documentation says:

'?' matches any single non-Separator character

So I expect the glob pattern matching to work as it used to in v3.0.0-rc36

@jaqx0r jaqx0r added bug This is considered a bug and shall get fixed mtail-Log Tailing Issues related to log polling and tailing labels Jan 1, 2023
@jaqx0r
Copy link
Contributor

jaqx0r commented Jan 1, 2023

Thanks for the report! Looks like there was a regression; IIRC the log discovery code was rewritten after rc36 and this feature got lost. I'll add a test for the specific behaviour and get it back.

jaqx0r added a commit that referenced this pull request Apr 23, 2024
@jaqx0r jaqx0r added this pull request to the merge queue Apr 23, 2024
Copy link
Contributor

Unit Test Results

    1 files     27 suites   9m 10s ⏱️
  649 tests   648 ✅ 1 💤 0 ❌
1 920 runs  1 917 ✅ 3 💤 0 ❌

Results for commit 1a2dd04.

Merged via the queue into main with commit 1eb4b8a Apr 23, 2024
18 checks passed
@jaqx0r jaqx0r deleted the glob branch April 23, 2024 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is considered a bug and shall get fixed mtail-Log Tailing Issues related to log polling and tailing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant