What is the best way to record a user log?

2

I have a small monitoring system that aims to show if the data on some servers are the same as the backups .

As the system interacts directly with the database, there was a need to know who was accessing and when accessing the system, as I am new to the programming area, my first alternative was to set up a function that stored the name, IP, the user action along with the date / time that the user performed the action on a MySQL database.

I saw that there are other options, writing in txt for example, however, saving the accesses in MySQL, it is much easier to manipulate them for statistical and similar use.

Am I doing it right? Is there another way to do this that is as effective as this? What's the problem with doing that? Does it depend on the number of hits?

    
asked by anonymous 21.02.2018 / 14:32

1 answer

2

Only you can respond to what is best for you. It really is a lot easier to do in MySQL and totally viable, even HTTP servers use this, although not by default.

Doing in a file can be more performative. And it should not be difficult to import into a database to handle offline . Of course you need to take some care.

If you need the log to be transactional with what was done there in practice the database becomes the only option.

    
21.02.2018 / 15:45