• Testers

    Can anyone help me with a Mysql query to track users?
    I would like to search by username.

    The reason I am asking is the user tracking function is giving me fits, we have a very large database.


  • Moderator

    @Greg-Plamondon Try these queries:

    Get a list of (unique) host IDs where username logged in to:

    SELECT DISTINCT utHostID FROM userTracking WHERE utUserName LIKE '%username%';

    Now combine this query to get the list of hostnames as well:

    SELECT hostID,hostName FROM hosts WHERE hostID IN (SELECT DISTINCT utHostID FROM userTracking WHERE utUserName LIKE '%username%');

    Be aware that the first query might return more results than the later one because older user tracking entries will still exist even if you delete a host from your database. In that case the later query won’t return this host.

  • Testers

    I need to know what PC a user has logged into.
    you can find it in the GUI under Reports > User Tracking

    from there you can type a users login ID ito the field and search it will list what PC the user has logged into.

  • Moderator

    @greg-plamondon Forgive my ignorance, track users against what? (this maybe an unused feature to me in FOG). To know what tables to hit, I need something fog knows about.