[ciapug] suggestions on reading a log file

David Champion dchampion at visionary.com
Wed Apr 5 15:17:47 CDT 2006


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
> 




More information about the ciapug mailing list