Hi there
I am hoping an Ubuntu guru can help. I log all my system logs to a remote log server, and I would also like to log my xbmc logs as well. I was wondering if anyone knows a way I can send the xbmc.log to syslog (my syslog is set up to send all logs to the remote server, so I need to just send them to syslog).
I thought I could use logger (so logger -t xbmc -f ~/.xbmc/temp/xbmc.log) but this only sends the whole log each time, not just the changes.
I then thought of using logger and tail so:
tail -f .xbmc.log | logger -t xbmc
But for some reason, tail doesn't seem to register any changes to the xbmc.log (I tried by playing and then stopping a video file, although the log file changed, tail didn't seem to notice..).
Thus, has anyone got any ideas of how I can get changes to the xbmc.log into syslog??
Cheers
erhnam Wrote:By adding a line to syslog.conf:
#XBMC
local1.* /home/xbmc/.xbmc/temp/xbmc.log
It's that easy??!!! Coolio.
I did a lot of googling for how to use the syslog.conf but I couldn't find anything useful.
Awesome, I shall try what you suggested, thanks for the super fast and hopefully v useful response!!
Ahh, bummer, doing some more reading it seems the command acutually does the reverse of what I need. It is designed to take message out of the normal syslog message list and pipe them to a separate log file
I need something that does the reverse of this...
Ah. difficult because you can't redirect the tail result to the syslog because it's in the interactive mode.
I don't know if it's possible to start the runXBMC in a debug mode so it will debug on the screen. If so you could make a wrapper around runXBMC.
/usr/bin/runXBMC | logger -p local1.info
Ahh, well, at least that explains why the tail command didn't work.
Hmm, I will do some more research and see what I can find. It is surprising, I was sure this was something that people would have requested all the time, but I guess not....
I guess that is why there are so many log viewing solutions out there....
Perhaps this might work. Create a script called logger.sh with the following contents
Code:
#!/bin/bash
tail -f /home/xbmc/.xbmc/temp/xbmc.log |
while read -r line
do
logger $line
done
chmod +x logger.sh
sudo ./logger.sh &
I'll give it a whirl and see what happens, cheers.
Poop, still no luck.
What I don't get is that the tail command isn't working when following the xbmc.log...I think that is the problem. It works when following syslog, but not xbmc.log and I don't know why.
What rev are you using? There were a few after the logging init logic was changed where the log wasn't flushed. It's fixed now.
I'm using the official build from the Karmic repos:
09:27:06 T:3023681408 M:2803240960 NOTICE: Starting XBMC, Platform: GNU/Linux. Built on Dec 24 2009 (SVN:26018)
Was this one of the svn's that had a problem....
erhnam Wrote:Perhaps this might work. Create a script called logger.sh with the following contents
Code:
#!/bin/bash
tail -f /home/xbmc/.xbmc/temp/xbmc.log |
while read -r line
do
logger $line
done
chmod +x logger.sh
sudo ./logger.sh &
AHA
I just tested this script on my Ubuntu apache server, and it does work!! It was happily sending my apache2 weblogs to syslog. AWESOME.
So, I guess it is a problem with the xbmc.log as althekiller mentioned. Hopefully he can confirm which svn versions are handling the log file correctly and I can then sort this out (though I don't really wanna go enabling the svn repos just to fix this though
)
Proof it works with mythtv
:
mythbuntu.prupert.co.uk user 19:02:28 mythtv mythtv: 2010-01-15 19:02:27.579 Im idle now... shutdown will occur in 240 seconds.
mythbuntu.prupert.co.uk user 19:02:27 mythtv mythtv: 2010-01-15 19:02:26.577 Scheduled 10 items in 0.1 = 0.02 match + 0.05 place
mythbuntu.prupert.co.uk user 19:02:27 mythtv mythtv: 2010-01-15 19:02:26.521 Invalid search key in recordid 127
mythbuntu.prupert.co.uk user 19:02:27 mythtv mythtv: 2010-01-15 19:02:26.520 Invalid search key in recordid 126
mythbuntu.prupert.co.uk user 19:02:27 mythtv mythtv: 2010-01-15 19:02:26.518 Invalid search key in recordid 118
ok wrong reply, ignore this one.