I've searched for an answer for quite a while, and haven't found anything that works correctly.
I have log files, some reaching
If you are on a 'nix machine, you should be able to use shell escaping and the tool 'tail'. It's been a while, but something like this:
$lastLines = `tail -n 500`;
notice the use of tick marks, which executes the string in BASH or similar and returns the results.