I want to know how to send new login and logout logs to a database.

I know that last command outputs the "lasts" login info. But, I found the following problems:

  • How to filter to only get new logs? How can I identify them?
  • How many time is saved in the utmp file? How many time should I wait to refresh it? Should I access wtmp? How?
  • Is there any other way?
  • Can I use rsyslog.cong to copy the log info to a MySQL database or to a PHP (local or remote)?

Note that:

  • Other users shuold not be able to delete the logs before script/deamon send it to the database.
  • Other users should not be able to falsify logs entries.

I'm trying to solve this for several days... Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.