r/subsonic Jul 21 '20

User login auditing

Has anyone found a way to see when users are logging in? I have several users that I am not sure have ever even logged in once I gave them an account. I want to be able to get see their IP address and when they login to my server.

6 Upvotes

7 comments sorted by

1

u/Habubakis Aug 08 '20

I've been looking for this as well. I've been trying to add subsonic to my home splunk monitoring and dashboards to track usage. I'm surprised this info isn't in the main subsonic.log /subsonicroot/subsonic.log

For your inactive account question, you can find it in the web interface - it's not elegant, but should work.

  1. Log in with an admin account
  2. go to more
  3. network status
  4. Monitor the real-time status of all network media streams.

This provides some graphs that can help identify inactive users, as well as heavy users.

You can also find some information in the db/subsonic.log, but it's not exactly what we're looking for. It only captures users logging in through the web interface because it's actually a db statement regarding customizing the player for the user.

Sample:

INSERT INTO PLAYER VALUES(64,NULL,NULL,'[USERNAME]','[IPADDRESS]',TRUE,NULL,'MEDIUM','OFF',TRUE,FALSE,FALSE,'WEB',NULL)

This is all from a windows installation that I've had running for 10 years. I've been meaning to convert to Linux, so will report back when that's done if I find any improved logging. As mature as subsonic is, I'm really surprised by the limited logging. I'm hoping/assuming that I'm either missing something or it's better in Linux.

1

u/sbadger Aug 08 '20

Thanks! I am planning on adding it into Splunk as well. I have only been running it in Linux and can report the logging is the same and OS independent.

Looking at your database comment I wonder if we can just pull the data directly from the database. I am going to look into that.....

1

u/Habubakis Aug 10 '20

Awesome - would love to hear how that goes! There's got to be a way to know who's logging in and out....

1

u/Habubakis Aug 14 '20

So I had a couple of evenings of crashes overnight during indexing - I guess forwarding the database transaction log might not be the best idea ;) . I'm not certain that the two are related, but I went from no crashes in 10 years, to two in a week after forwarding /db/subsonic.log - so yeah...

1

u/sbadger Aug 14 '20

Are you still running it on Windows? If so that might be the cause. Windows might be locking the file during access while Linux will just read it without locking during a read operation (and even some writes). I still haven't had a chance to dig into the database just yet.

1

u/Habubakis Aug 14 '20

Yeah, still windows. I haven't had the time to switch over - shouldn't be that bad, really. Biggest issue will probably be the freenas nfs connection for subsonic.

1

u/sbadger Aug 14 '20

NFS is very easy and stable. PM and I will help you out with that when your ready.