0

I have a pretty large log file on my server, and i would like to have a continually updating console view on my website, showing only the last 50 or so lines of the file

the problem is that it takes too long to load the entire file every time, so i need a way to load only the nescsarry lines, (if possible) or another solution that works.

thanks in advance

Daniel Holst
  • 139
  • 10

2 Answers2

0

I'd say it's an exact duplicate (as John Conde mentioned), unless you want to do it client-side, in which case maaaybe, just maybe, you could do it with HTTP byte serving.

I do recommend you do this with PHP, so read that question.

Community
  • 1
  • 1
Camilo Martin
  • 37,236
  • 20
  • 111
  • 154
-1
$file = file("file.txt");
for ($i = count($file)-50; $i < count($file); $i++) {
echo $file[$i] . "\n";
}

Untested, but...?

Mattios550
  • 372
  • 1
  • 5
  • 18