Sending logs over Telegram
-
I wrote a very stupid little Python bot to send me a message over Telegram any time it detects that a host on my network is down, then I thought, why not include the logs from my appliances, too? And then it occurred to me to not try to re-invent the wheel, so I wanted to see if anyone else has worked on this, or knows of a project that already does this.
Assuming there is not already some project, here are some questions I have if I'm going to be doing this on my own:
From Googling, it seems the way to get the system log is calling clog over SSH to pull in /var/log/system.log, which requires that the machine running the bot has root SSH access to the machine, as the log is owned and only accessible by root. Is this the best way, and are there other log files I may want to monitor?
-
@Ranko-Kohime said in Sending logs over Telegram:
Is this the best way,
When you SSH into pfSense you are root (admin).
But, you could use sudo if needed.
Still, your script has to run as root to access root files that are not 'world' readable.@Ranko-Kohime said in Sending logs over Telegram:
are there other log files I may want to monitor?
Well, you should monitor what you find interesting.
Keep in mind : https://forum.netgate.com/topic/146169/heads-up-logging-changes-clog-deprecated-plain-text-logs-newsyslog-rotation-in-next-snapshots
-
@Gertjan said in Sending logs over Telegram:
When you SSH into pfSense you are root (admin).
Funnily enough, I actually have a regular user account I use for creating my own hodge-podge VPN, which is restricted to port forwarding only. (I use sshuttle, which requires Python, and since pfSense doesn't have Python, I port forward to my NAS and then use sshuttle against the NAS)
As for the removal of clog, thanks for the heads up.