Depending on what you want to do with this, I would say:
- If you need to get data from logs, storing it in MySQL can help.
- If you need only some data that you almost never use (but you need something illegal to be done on your site or something like that), the file can be quite good.
In order not to slow down too much, you can also use both (I used this on some sites with a small amount of traffic, where it would be unreasonable to store data in the database immediately):
- during the day, save the logs in a file
- and once a day (or once an hour, you get an idea), use a batch to analyze these files and put the data in the database
Thus, you do not insert data into the database all the time; and you can (provided that a day or hour has passed), all the requests that you need
source share