Jump to content

Logging User Activity

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
ChazUK

ChazUK

    Newbie

  • Members
  • Pip
  • 5 posts
Hi, I'm creating a website where I would like to log each users activity during their visit on the site.

I was wondering whether you'd suggest storing all the information in a file for each user. For example my activity would be logged in the file "/activitylogs/c/chazuk.txt"

Or should all the information be stored in a database?

The only problem I can see with using the database is that there could potentially be millions of entries, which could bog down the server when searching through the data.

This would mainly be used to track how often users are logging in to the site and viewing certain pages.

Thanks for your comments,
Charlie

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The advantage of a database is you can store the date of the activity and purge old records as you go.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
ChazUK

ChazUK

    Newbie

  • Members
  • Pip
  • 5 posts
very good idea! I did not think about removing old records.

I guess this could be done with a cron job that I will look into later

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You can even have the act of hitting the website trigger a the old-record cleanup.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
It wont bog down the server if your the only one looking at the records. You could be the next google or facebook! Know everything about everyone!

#6
ChazUK

ChazUK

    Newbie

  • Members
  • Pip
  • 5 posts

mikelbring said:

It wont bog down the server if your the only one looking at the records. You could be the next google or facebook! Know everything about everyone!

Yeah, I can build the stuff, but it's making it efficient that I have trouble with!

Thanks for the input