In addition to
Re: collect /var/log/messgages and dmesg about cpan syslog modules,
There are programs designed for that monitoring task. See (simple code for study), for example,
logcheck (written with perl and bash)
They are others , like, zabbix, nxlog, logstash , ... but they are off topic at The Monastery
Regards
I would configure dmesg to be written on /var/log/dmesg