I am trying to increase the admin functionality of a php project I working on. As of now the project will log all of its errors to the syslog. I am trying to give the admin page the ability to read the syslog for these errors. in the terminal I can type:
cat /var/log/syslog | grep projectName
However ever if I try to run this command with:
$output=shell_exec('cat /var/log/syslog | grep projectName');
or with :
$output=`cat /var/log/syslog | grep projectName`;
$output always comes up as empty. Is there a way I can do this? Is this even the best way (IE does php have a native way to read the syslog)?
EDIT: it seems that the issue is a permissions one. I could give www-data permission to access syslog, but for some reason that doesn't seem like a good idea to me. Is there no native way to read the log?