title: Database logs vs file logs
body: <p>I have created a PHP+MYSQL web app and I am trying to implement now a logging system to store and track some actions of each user.</p>
  
  <p>The purpose of this is the following: track the activity of each user's session by logging the IP+time+action, then see which pages he accessed later on by logging time+pagename; for each user there will be a file in the format: <strong>log{userid}_{month}.log</strong></p>
  
  <p>Each log will then be viewed only by the website owner, through a custom admin panel, and the data will be used only for security purposes (as in to show to the user if he logged in from a different IP or if someone else logged in from a different IP and to see which areas of the website the user accessed during his login session).</p>
  
  <p>Currently, I have a MYSQL MyISAM table where I store the userid,IP,time,action and the app is still not launched, but we intend to have very many users (over 100k), and using a database for this solutions feels like suicide.</p>
  
  <p>So what do you suggest? How should the logging be done? Using files, using a table in the current database, using a separate database? Are there any file-logging frameworks available for PHP?</p>
  
  <p>How should the reading of the file be done then? Read the results by row?</p>
  
  <p>Thank you</p>