A
A
Alex Shinkevich2010-10-22 18:38:08
Journaling
Alex Shinkevich, 2010-10-22 18:38:08

Storing user logs?

Please share your ideas on how best to keep logs of visits / user actions. It will be faster to write to the database, store in separate files and then write to the database when the server is not loaded.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
A
adminimus, 2010-10-22
@adminimus

good old text files + logrotate, no? An interlayer in the form of a database will only create an extra overhead.

E
Elvis_the_King, 2010-10-22
@Elvis_the_King

it will be faster to store in memcache / hcache or something like that and upload batches to the database / files

B
BasilioCat, 2010-10-22
@BasilioCat

It is more reliable to store classic logs - any failures in the statistics processing system will not lead to data loss. However, this applies to systems where statistics are not needed immediately, and where data from an HTTP request is sufficient - data from a session or a database, etc. is not needed.
For example, using nginx, you can fine-tune what and how to log, and such logs can be downloaded, for example, to PostgreSQL with one copy command

M
Max, 2010-10-22
@7workers

If you do not need to “read” the logs often, then text files are the best solution.

B
bdmalex, 2010-10-22
@bdmalex

It will be faster to write to the database, store in separate files and then write to the database when the server is not loaded.
In my opinion - if there is at least a minimal probability that your service will be of interest to a LARGE number of users at the architecture level, immediately decide that these LOGS are on a separate server (servers) ...

P
pwlnw, 2010-10-22
@pwlnw

The question is ambiguous. Better test both.
Do you know that if enough large blocks and enough parallel scripts write to a file, then messages can get mixed up?
here there is a need to synchronize access to the file, which means there is a bottleneck where all parallel processes are blocked.
Whereas the DBMS already has some interesting and free mechanisms like INSERT IGNORE that return the result “instantly”.
Prepared statements and a connection pool will also come in handy.
There is also an opinion that a truly loaded project does not need user action logs at all. Except during debugging.

S
Shedar, 2010-10-22
@Shedar

Scribe (http://github.com/facebook/scribe) - quite flexible, fast, simple, aggregation from multiple servers if necessary, possible integration with hadoop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question