4

I have a PHP application that is running on 20 web servers. It's silly to check every servers' PHP error log. I'm planning to centralize the error logging on one (not a web server, a server just used for monitoring).

PHP does support logging to syslog by doing a simple change "error_log = syslog". Then I will configure syslogd to log to my central server.

Did anybody try this before? Any recommendation? Anything I should be careful of? Would this affect performance?

3 Answers 3

3

Yes, I've done this. It works well, and doesn't have any real gotchas. Performance isn't an issue unless you're logging so many errors that you really want to be fixing some of them anyway, or you're logging to a really remote network location (which is a bad idea for all sorts of reasons).

2
  • The app shouldn't have many errors, it actually runs for days without displaying a single error. And the central log server is on the same network. Does the central server tell you which machine sent this error?
    – Ammar
    Dec 18, 2009 at 18:41
  • Yes, the logs will still display the machine name the log entry was generated on, just like local syslogs.
    – womble
    Dec 18, 2009 at 22:29
2

It will only have a real affect on speed if your PHP is regularly throwing errors, and fixing those will save much more then the CPU taken to deal with them.

-3

You'd better not invent bicycles: just use a simple script that's run by cron and uses the logger command to duplicate everything from PHP error_log to syslog, or maybe even to a remote host :)

2
  • 1. php has built in capabilities to log to syslog, so why would you make your setup more complex by having a separate script duplicate the log file? 2. you're doubling the disk space needed to store php logs now. 3. Syslogd already has the ability to forward syslogs to a remote host so once again no need to have your script do that. Rolling your own script IS re-inventing the wheel (or as you put it inventing bicycles)
    – Zypher
    Dec 17, 2009 at 22:55
  • Umm, sure. Thought syslog is implemented as a module which is not always accessible. Should have read the manual before answering :)
    – kolypto
    Dec 18, 2009 at 2:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .