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

Unclear tailing extrapolation? #13

Closed
hynek opened this issue Nov 5, 2015 · 5 comments
Closed

Unclear tailing extrapolation? #13

hynek opened this issue Nov 5, 2015 · 5 comments

Comments

@hynek
Copy link

hynek commented Nov 5, 2015

Hi,

I want to tail /var/log/exim4/mainlog so I run mtail using runit like this:

#!/bin/sh -e

export LC_ALL="en_US.UTF-8"

exec 2>&1 \
    chpst -u Debian-exim:Debian-exim \
        mtail -progs /etc/mtail -logs /var/log/exim4/mainlog -logtostderr

That seems to work fine, except that my log is spammed with the following message multiple times per second:

@40000000563b39770fc60854 I1105 12:11:41.264553   20836 tail.go:130] No file descriptor found for "/var/log/exim4/rejectlog

At no point did I tell mtail to care about the reject log nor do I want to tail it since it would taint the metrics. What is going wrong here?

Why does mtail think it should tail an unrelated file that happens to be in the same directory and what can I do about it? It is generating quite a bit of log data…

@SuperQ
Copy link
Contributor

SuperQ commented Nov 5, 2015

This is probably coming from the watcher, which uses fsnotify to know when /var/log/exim4/mainlog is rotated. I have no idea what's wrong tho.

@jaqx0r
Copy link
Contributor

jaqx0r commented Nov 5, 2015

This seems like a bug, but certainly related to how the filesystem watcher
tracks log rotation.

I suspect it is noticing updates to that file and the message merely states
that it should ignore it.

If so, a simple fix is to downgrade the message to a lower severity.

On Fri, 6 Nov 2015, 00:13 Ben Kochie [email protected] wrote:

This is probably coming from the watcher, which uses fsnotify to know when
/var/log/exim4/mainlog is rotated. I have no idea what's wrong tho.


Reply to this email directly or view it on GitHub
#13 (comment).

@jaqx0r
Copy link
Contributor

jaqx0r commented Nov 9, 2015

handleLogUpdate in mtail/tailer/tail.go:123 is called on all UpdateEvents
from the fs notifier. This includes updates on the directory, which is so
we can detect log rotation events. Unfortunately, the check for presence
occurs in the method itself, not before it's called, so that cases like
this end up triggering that log message. It's effectively harmless, but
spammy like you say.
A simple fix as I said is to downgrade the message, so I've done that, but
added a note to make it less wasteful in a future change.

On 6 November 2015 at 09:24, Jamie Wilkinson [email protected] wrote:

This seems like a bug, but certainly related to how the filesystem watcher
tracks log rotation.

I suspect it is noticing updates to that file and the message merely
states that it should ignore it.

If so, a simple fix is to downgrade the message to a lower severity.

On Fri, 6 Nov 2015, 00:13 Ben Kochie [email protected] wrote:

This is probably coming from the watcher, which uses fsnotify to know
when /var/log/exim4/mainlog is rotated. I have no idea what's wrong tho.


Reply to this email directly or view it on GitHub
#13 (comment).

@SuperQ
Copy link
Contributor

SuperQ commented Nov 9, 2015

👍 😎

@jaqx0r jaqx0r closed this as completed in 38a0f2a Nov 9, 2015
@hynek
Copy link
Author

hynek commented Nov 9, 2015

Thanks!

jaqx0r added a commit that referenced this issue Nov 10, 2015
We can avoid some strange info log messages and additional checks in the
handler methods by doing this.

Issue: #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants