How do I use Nagios to monitor a log file that generates a random ID

Solution 1:

I would run a separate script, via cron, that identifies the newest log file and makes a symlink to it (named something like "latest.log"). There are several ways you could do this (using ls -rt | tail or find -mtime, for example).

If the new logfile is created at the same time every day, schedule it to run right after that. If not, have it run every (minute, 5 minutes, whatever), checking for a new log file.

... And then have check_logfiles use that symlink.