Simpler logs -- user listening history?

Need help? Post your questions here.

Moderator: moderators

Simpler logs -- user listening history?

Postby supra92 » Fri Aug 21, 2009 2:13 am

I like the logging aspect of Subsonic, but it seems a bit complicated/messy to try to just figure out who's played what. For example, here's some entries that indicates user "jdoe" listened to the songs "Lilac Wine" and "Mojo Pin" by Jeff Buckley. It takes 3 lines for each song: one to show that a user started a stream, two to show which song, and three to show the user stopped the stream:


[2009-08-20 16:49:22,888] INFO StreamController - Starting stream jdoe@111.222.333.444:1262 (Mozilla/5.0 (Windows; U; Windows N
T 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5)
[2009-08-20 16:49:22,889] INFO PlaylistInputStream - Opening new song 1994 - Grace/04 - Buckley, Jeff - Lilac Wine.mp3
[2009-08-20 16:49:32,491] INFO StreamController - Stopping stream jdoe@111.222.333.444:1262 (Mozilla/5.0 (Windows; U; Windows N
T 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5)
[2009-08-20 16:51:22,888] INFO StreamController - Starting stream jdoe@111.222.333.444:1262 (Mozilla/5.0 (Windows; U; Windows N
T 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5)
[2009-08-20 16:51:22,889] INFO PlaylistInputStream - Opening new song 1994 - Grace/04 - Buckley, Jeff - Mojo Pin.mp3
[2009-08-20 16:51:32,491] INFO StreamController - Stopping stream jdoe@111.222.333.444:1262 (Mozilla/5.0 (Windows; U; Windows N
T 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5)



That's a lot of messy text to plow through just to get a "user listening history".

What I'd like to see is, instead of all that, have a logfile that simply has this:


[2009-08-20 16:49:32] jdoe@111.222.333.444 played 1994 - Grace/04 - Buckley, Jeff - Lilac Wine.mp3
[2009-08-20 16:51:32] jdoe@111.222.333.444 played 1994 - Grace/04 - Buckley, Jeff - Mojo Pin.mp3



Much easier to read, right? :) This seems like a pretty reasonable and, I'd think, common request of a Subsonic logging system. Would make it a whole heck of a lot easier to go back and see who listened to what. Is this possible at all, or has anyone found a way to do it? Is this a reasonable feature request that other folks would like to see as well?

Cheers!
Supra92
User avatar
supra92
 
Posts: 137
Joined: Sun Nov 19, 2006 12:17 am
Location: Central Texas

Postby 3R3 » Fri Aug 28, 2009 8:17 am

hey, that was my thread title today (would have been, kinda)...
my question is, is there a log analyzer which can use the log format subsonic uses, or in other words: Sindre, which log analyzer do you use?

a verbose log also has its upsides, mainly for troubleshooting, but it would be a cool thing to set the verbosity level as admin.
bye
User avatar
3R3
 
Posts: 332
Joined: Mon May 04, 2009 2:09 pm
Location: Germany

it ain't pretty but . . .

Postby dobson » Thu Sep 03, 2009 4:47 pm

I use a shell script to accomplish what supra92 was talking about on my mac (or on any unix box). I am sure that it is not the most elegant way to get it done, and I'd encourage anyone with better scripting knowledge to give us some pointers. That said, this works fine for me in meantime:

I have this shell script run periodically (say every 10 seconds or so) to analyze the subsonic.log file and output a single parsed line for each song played. here's the code (all one line):

Code: Select all
grep -A 1 "Starting stream" /var/subsonic/subsonic.log | awk '/stream/{print$1,$2,$5,$8":"} /Opening/{print$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20}' | sed -e 'N' -e 's/\n/ /'


grep -A 1 . . . finds every line that says "starting stream" and the following line
awk. . . parses only the relevant information
and
sed . . . gets rid of the line break so it's all on one line.

and here's an example of the output:

[2009-09-02 16:18:52,803] - beryl@xx.xxx.xxx.xxx: Elephant/14 It's True That We Love One Ano.mp3
[2009-09-02 22:38:47,155] - ron@xx.xxx.xxx.xxx: Super Soukous/04 Bolinga.mp3
[2009-09-02 22:43:44,927] - ron@xx.xxx.xxx.xxx: Super Soukous/05 Kelele.mp3
[2009-09-02 22:53:41,890] - ron@xx.xxx.xxx.xxx: Motorcade of Generosity/01 Comanche.mp3
[2009-09-02 22:55:51,404] - ron@xx.xxx.xxx.xxx: Motorcade of Generosity/02 Ruby Sees All.mp3

if you want to output the list to a text file, just add to the end:
Code: Select all
> output.txt

What I do is output that information to the that text file once every 10 seconds or so (overwriting the whole thing because I can't figure out how to add just a single line to it each time a song is played... the whole log file needs to be parsed every time. it's not too processor intensive, but it's certainly not pretty). Then I use geektool and the command "tail -4 output.txt" or something like that to display the last couple songs played on my desktop.
Also, I share that text file in a remotely accessible folder on my computer (or you could have it upload somewhere else), so I can use geektool to display what's being played even if I'm not on the LAN. (using curl . . . and then tail).

let me know if you try it and if you have any suggestions for improvement![/b]
dobson
 
Posts: 46
Joined: Tue Apr 14, 2009 10:10 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 20 guests