traccar / traccar

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
4.96k stars 2.51k forks source link

Saving user logs in the database - legal obligations #5219

Open byhturk opened 7 months ago

byhturk commented 7 months ago

Hello friends, Due to legal laws in some countries, it may be necessary to keep user login and logout and action records (user-Action-IP-Date-Time) for 1-2 years. Although we do not use it commercially, it is not functionally convenient to keep the logs of users accessing our web service in the log file. How can we ensure that user input, output and actions are recorded in the database by creating a new table with the change to be made in the schema file in the database? In this way, we can optimize it with a cron task (for example, the command to delete data older than 1 year in the table).

I added a new table so far, but I couldn't find how to save the user logs to this table. Anyone have any ideas?

What approach should we look for for a solution? I am waiting for your valuable ideas.

tananaev commented 7 months ago

We log it in the log file. Why does it need to be in the database?

byhturk commented 7 months ago

Finding user logs in large log files can be a problem. For example, wouldn't a server that creates a 1GB log file every day cause problems?

We could have a real problem with possible law enforcement requests for information.

For example, if "userlog" logs are saved in the database and "userid" is referenced from the "tc_users" table, historical user logs can be easily found on the users page.

I have been researching these issues for several months but have not been able to resolve this issue.