Created
December 7, 2017 22:51
-
-
Save yolabingo/c26dd4cc70518418eff9c80213882a6f to your computer and use it in GitHub Desktop.
apache ErrorLog to syslog-ng snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter f_apache_error { match('^apache2' value("MSGHDR")) }; | |
filter f_apache_error_send_email { | |
(message('Option') and message('not allowed here')) | |
}; | |
filter f_apache_php_notice { | |
message('PHP Notice') or | |
message('PHP Deprecated') or | |
message('PHP Strict Standards') | |
}; | |
filter f_apache_php_warn { | |
message('PHP Warning') or | |
message('PHP Startup') | |
}; | |
filter f_apache_php_fatal { | |
message('PHP Fatal error') or | |
message('PHP Parse error') | |
}; | |
destination d_smtp { | |
smtp( | |
host("localhost") | |
port(25) | |
from("webfarm syslog-ng" "website@example.com") | |
to("Hey Sysadmin" "admin@example.com") | |
subject("[ALERT] Apache error on $HOST/$PROGRAM") | |
body("$MSG") | |
); | |
}; | |
destination d_apache_error { file("/var/log/apache2/error.log" template("${MSG}\n") );}; | |
destination d_apache_php_notice { file("/var/log/apache2/php_notice.log" template("${MSG}\n") );}; | |
destination d_apache_php_warn { file("/var/log/apache2/php_warn.log" template("${MSG}\n") );}; | |
destination d_apache_php_fatal { file("/var/log/apache2/php_fatal.log" template("${MSG}\n") );}; | |
log { source(src); filter(f_apache_error); destination(d_apache_error); }; | |
log { source(src); filter(f_apache_error); filter(f_apache_error_send_email); destination(d_smtp); }; | |
log { source(src); filter(f_apache_php_notice); destination(d_apache_php_notice); }; | |
log { source(src); filter(f_apache_php_warn); destination(d_apache_php_warn); }; | |
log { source(src); filter(f_apache_php_fatal); destination(d_apache_php_fatal); }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment