[ciapug] Re: Re: suggestions on reading a log file
Mike Parks
mparks at captainjack.com
Thu Apr 6 12:12:04 CDT 2006
If the host allows exec or system commends to run, you could run
exec('tail -n 1000 $logfile' , $retval);
or
system('tail -n 1000 $logfile', $retval);
print $retval;
;-)
Mike
At 12:00 PM 4/6/2006, you wrote:
>Send ciapug mailing list submissions to
> ciapug at cialug.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://cialug.org/mailman/listinfo/ciapug
>or, via email, send a message with subject or body 'help' to
> ciapug-request at cialug.org
>
>You can reach the person managing the list at
> ciapug-owner at cialug.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of ciapug digest..."
>
>
>Today's Topics:
>
> 1. Re: suggestions on reading a log file (David Champion)
> 2. Re: suggestions on reading a log file (David Champion)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Wed, 05 Apr 2006 15:17:47 -0500
>From: David Champion <dchampion at visionary.com>
>Subject: Re: [ciapug] suggestions on reading a log file
>To: Barry Buelow <bjbuelow at yahoo.com>, ciapug at cialug.org
>Message-ID: <443425EB.9010805 at visionary.com>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>I don't know a lot about how various commercial virtual hosting is set
>up, but I would bet most of them would use seperate logs. We do for our
>hosting clients. It could be considered a security risk to allow other
>clients to view a common log.
>
>You could used the php fopen / fread commands, I'm sure with a little
>trickery you could emulate the unix "tail" command.
>
>-dc
>
>Barry Buelow wrote:
> > Hello,
> >
> > I've been lurking for a few months and trying not to embarass
> myself by asking too stupid a question, but neither my, nor your,
> luck can last forever.
> >
> > 1. I'm working on a web page that will be on a commercial
> hosting site (tbd). Past experience with these sites is that they
> have a common error log file. I usually look at the "tail" of it.
> >
> > It struck me that I could have a php page go get the "tail" and
> strip it down to items from my site. Something like the last 10
> matched substring. Reading the entire huge file doesn't seem like
> a good idea. Nor do I want to do anything that is a major load on
> the system. The only idea I have is to open the log file in read
> mode, then replicate the "tail" function using file pointer manipulation.
> >
> > Is there a way to copy the last 1000 lines or some other
> interesting trick?
> > Any suggestions?
> >
> >
> > 2. What is recommended practice for processing form data to
> prevent attacks?
> > addslashes?
> > escape_shell_cmd?
> > string length limiting?
> > other?
> > Is there a particular web page that lists best practices for security?
> >
> > tia,
> > Barry
> >
> >
> >
> > ================
> > I'm 56, live in the Cedar Rapids area, have a BSCS which is now
> yellow and curled.
> > Written: pascal, pl1, assembly, c(not ++), nearly all of it
> embedded, haven't learned a new language in ages as career moves
> have taken me away from sw. Read 3 books on php and digging in,
> but have to "real world" experience.
> >
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > ciapug mailing list
> > ciapug at cialug.org
> > http://cialug.org/mailman/listinfo/ciapug
> >
>
>
>
>
>------------------------------
>
>Message: 2
>Date: Wed, 05 Apr 2006 17:58:37 -0500
>From: David Champion <dchampion at visionary.com>
>Subject: Re: [ciapug] suggestions on reading a log file
>To: ciapug at cialug.org
>Message-ID: <44344B9D.9080403 at visionary.com>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Out of curiosity, I googled for "php tail" and found this link right away...
>
>http://www.phpclasses.org/browse/file/1656.html
>
>This one shows doing using the unix "tail" command...
>
>http://www.codecomments.com/archive228-2005-2-405524.html
>
>I'm sure there are several other examples out there.
>
>-dc
>
>David Champion wrote:
> > I don't know a lot about how various commercial virtual hosting is set
> > up, but I would bet most of them would use seperate logs. We do for our
> > hosting clients. It could be considered a security risk to allow other
> > clients to view a common log.
> >
> > You could used the php fopen / fread commands, I'm sure with a little
> > trickery you could emulate the unix "tail" command.
> >
> > -dc
> >
> > Barry Buelow wrote:
> >
> >> Hello,
> >>
> >> I've been lurking for a few months and trying not to embarass myself
> >> by asking too stupid a question, but neither my, nor your, luck can
> >> last forever.
> >> 1. I'm working on a web page that will be on a commercial hosting
> >> site (tbd). Past experience with these sites is that they have a
> >> common error log file. I usually look at the "tail" of it.
> >> It struck me that I could have a php page go get the "tail" and strip
> >> it down to items from my site. Something like the last 10 matched
> >> substring. Reading the entire huge file doesn't seem like a good
> >> idea. Nor do I want to do anything that is a major load on the
> >> system. The only idea I have is to open the log file in read mode,
> >> then replicate the "tail" function using file pointer manipulation.
> >> Is there a way to copy the last 1000 lines or some other interesting
> >> trick?
> >> Any suggestions?
> >>
> >>
> >> 2. What is recommended practice for processing form data to prevent
> >> attacks? addslashes?
> >> escape_shell_cmd?
> >> string length limiting?
> >> other?
> >> Is there a particular web page that lists best practices for security?
> >>
> >> tia,
> >> Barry
> >>
> >>
> >>
> >> ================
> >> I'm 56, live in the Cedar Rapids area, have a BSCS which is now
> >> yellow and curled. Written: pascal, pl1, assembly, c(not ++), nearly
> >> all of it embedded, haven't learned a new language in ages as career
> >> moves have taken me away from sw. Read 3 books on php and digging in,
> >> but have to "real world" experience.
>
>
>
>
>------------------------------
>
>_______________________________________________
>ciapug mailing list
>ciapug at cialug.org
>http://cialug.org/mailman/listinfo/ciapug
>
>
>End of ciapug Digest, Vol 12, Issue 2
>*************************************
<><><><><><><><><><><><><><><>
Mike Parks
Captain Jack Communications
Email: techsupport at captainjack.com
Phone: 515-964-8500
Toll-Free: 800-581-3230
More information about the ciapug
mailing list