Last active
March 11, 2021 16:37
-
-
Save lumue/112adb3364121ccfd1bf to your computer and use it in GitHub Desktop.
tail kodi.log (or any other logfile) to syslog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tail -f /home/osmc/.kodi/temp/kodi.log | | |
while read -r line | |
do | |
logger $line | |
done |
In the meantime I switched to this solution after reading that read
is not recommended in this context and pure "pipe" is performing better.
tail -n0 -F /home/kodi/.kodi/temp/kodi.log | stdbuf -o0 cut -c37- | logger -t KODI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A little improvement for the logger call:
logger -t KODI "${line:37}"
-t : sets a tag which is used as program name in syslog
${line:37} : removes the fixed length time stamp from the kodi log (tested only on Debian; length may be different on other platforms?)
.. and the tail command:
tail -n0 -F
-n0 : don't include the last lines when starting the log "transfer"
-F : retry reading the file until access is possible
The last one is needed when starting this process during boot, while the file
kodi.log
may not be accessible at that time.