What is the best way to record a user log?

Asked

Viewed 684 times

2

I have a small monitoring system that aims to show if the data of some servers are equal to backups.

As the system interacts directly with the database, the need arose to know who accessed and when they accessed the system, as I am new in the programming area, my first alternative was to set up a function that kept the name, the IP, the user action along with the date/time the user executed the action in a Mysql database.

I saw that there are other options, recording in txt for example, however, by recording accesses in Mysql, it is much easier to manipulate them for statistical use and related.

Am I doing it the right way? Is there another way to do it that’s just as effective? What’s wrong with doing it that way? It depends on the number of accesses?

  • I see that the use of Triggers is the safest way to maintain a log of changes in a bank. A natural problem is that depending on the number of changes a bank undergoes, the Logs table will grow exponentially. Also depends on what information Trigger s will save.. (all fields? in all operations? in all tables?)

1 answer

2


Only you can answer what’s best for you. Actually it is much easier to do in Mysql and fully feasible, even HTTP servers use this, though not by default.

Making into a file can be more performative. And it shouldn’t be difficult to import into a database to manipulate 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.

  • So far I’m using Mysql, and meets perfectly well, the system does not usually have as many accesses so, in two weeks I had 15 thousand interactions, what is a low number until, but as I am not so experienced in the area, I was in doubt if this is a good practice or not

  • Absurdly low. The difference in performance will rarely be relevant and even if it is has techniques to avoid disturbing too much. People use it all the time, even HTTP servers have the option to log in on DB.

  • Oh yes, that’s great, the trend is that the number of accesses grows, so I was worried, but as the trend is that these logs last at most one year I am calmer, in case of emergency/ despair I will turn to the Forum again kkkk, thank you, hug

Browser other questions tagged

You are not signed in. Login or sign up in order to post.