Other linux device logfile monitoring; is this possible?

I have a Synology, and it runs a custom backup program that generates logfiles in a folder.

Is it possible to let HA monitor this logfile and look for the text “Error” or anything??

Tried the search, but that comes up with the normal HA logfile, and that is not what i’m searching for…

A command line sensor using grep ?

The file sensor?

I always use bash scripts on the other hosts, started by cron, and publish the results to mqtt.
For example, this monitors if a script in a screen session is running.

#!/bin/bash

SCR_NAME='E3DC2MQTT'
MQTT='192.168.77.67'
TOPIC="home/sensors/$(hostname)/e3dc2ha_daemon"

if /usr/bin/screen -ls | grep $SCR_NAME >> /dev/null; then
    PAYLOAD='on'
else
    PAYLOAD='off'
    /srv/e3dc/init.sh start &
fi

/usr/bin/mosquitto_pub -t "$TOPIC" -m "$PAYLOAD" -h "$MQTT"

Good idea… but I checked it, and every cycle it read just the last line… if in between the check cycle an error pops up, and after that a succes, it will not be visible…

Back to the drawing board…

I’m thinking in the same direction… don’t know how to program is (yet)… but… google is my best friend :wink: