Emulating grep
Posted: Thu Sep 16, 2010 8:51 pm
Hello! I'm new to php.
I have logs on a linux server that I'd like other admins the to have the ability to search, similar in concept to grep. Not all admins have shell access, however, so I was looking for a way implement this functionality with php since the info does reside on a web server.
Right now, the logs are being stripped of any username/passwords and other irrelevant data using grep/sed and output to a web accessible directory as simple .txt files. There isnt any sensitive data or information on the server, its just that some admins do not require shell access so they are not given it. With that in mind, which would be better to use? Pass the search strings using system() to grep or preg_grep?
Thanks!
I have logs on a linux server that I'd like other admins the to have the ability to search, similar in concept to grep. Not all admins have shell access, however, so I was looking for a way implement this functionality with php since the info does reside on a web server.
Right now, the logs are being stripped of any username/passwords and other irrelevant data using grep/sed and output to a web accessible directory as simple .txt files. There isnt any sensitive data or information on the server, its just that some admins do not require shell access so they are not given it. With that in mind, which would be better to use? Pass the search strings using system() to grep or preg_grep?
Thanks!