开发者

What to log for security and statistics?

What are smart / handy things to log /statistics for a social networking site? Things i came up with:

  • user logins (timestamp + user id)
  • failed user logins (timestamp + user id)
  • number of messages/user (timestamp + userid
  • table of active users (timestamp + user id)
  • time user spent on page (delta timestamp + userid + pageid
  • table of users page views (user/page pair)

Things I missed?

Considering i'm using Cassa开发者_运维技巧ndra (=nosql) what would be the fastest and most scalable way? Im thinking of adding the login attempts to the user keyspace and creating an logging keyspace for time on page etc.

Is there something like an opensource version of google analytics written in php? If I expand that with the data mentioned above + this (demo@bottom here) = killer app


It might be a good thing to log log_type

Like DEBUG, INFO, ERROR, etc


For storing statistics in cassandra, look at twitters rainbird as a good example of how to use counters which are new in cassandra 0.8.


Have you tried approach defined here ? It's a multi-threaded (and synchronized) logger-2-files. I guess this is the fastest logging method possible on standard PHP server.


As you're asking "what" you should store, not "how" to store it, I'd say you are asking the wrong people. You need to work out what your business requirements are, and how to support them - storing data because it might be "handy" is likely to create a complex app with lots of maintenance trouble, not to mention performance pain.

Having said that, within social networks, the connection between people is really important (duh), so I'd consider explicitly storing that in your logs as well. "User x viewed user y's wall"; "User x sent a message to user y" etc. That way, you can answer questions like "how often did user x send a message to user y between a and b dates?".


To answer your question regarding an "open source Google Analytics in PHP":

check out piwik.org!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜