0

I am looking for ideas on how to log user's login IPs without compromising on performance in MySQL.

There are few primary tasks which the log would be used for:

  1. Finding list of other users who have similar IPs (almost every time a user logs in)
  2. Finding names of users with same IP
  3. Finding all IPs used by the user and showing side by side other users who have similar IPs. (mainly to track ban-evaders) (by similar, I require at least 2 bytes of the IP to match)
  4. Finding most recently used IP by a user when he is offline (was thinking if it would be better to add an IP column in the users table for each user)

Every user has a unqiue id known as database-id which is a number.

I need ideas on how to implement before I begin with the main focus on maximizing performance of the tasks mentioned above.

1 Answer 1

1

https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_init_connect

Create an init_connect script that writes the user's session info to a table.

A better way would be to configure MySQL to log user activity to a table, as in Rolando's answer to this question: Audit logins on MySQL database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.