mtail icon indicating copy to clipboard operation
mtail copied to clipboard

How to deal with the log name with a suffix, such as access.log.20221221314, using access.log.* will load all the logs, I only want to monitor the logs of the current hour

Open huozhirui opened this issue 3 years ago • 3 comments

How to deal with the log name with a suffix, such as access.log.20221221314, using access.log.* will load all the logs, I only want to monitor the logs of the current hour

huozhirui avatar Nov 24 '22 06:11 huozhirui

Can you use a symlink to the latest log file, that gets updated after the logs are rotated?

jaqx0r avatar Dec 08 '22 19:12 jaqx0r

In this way, I need to establish a new soft connection every hour, and for multiple log files, I need to establish multiple maintenance logics, which is a lot of work.

huozhirui avatar Dec 21 '22 02:12 huozhirui

Well the normal practice is to use log rotation to create the date-named log files so that there's a common base name to follow.

After a timeout of one hour, all the logs that haven't been written to get removed from the list of watched logs: https://google.github.io/mtail/Deploying.html#setting-garbage-collection-intervals

jaqx0r avatar Jan 01 '23 05:01 jaqx0r