Comments (6)
While technically we are drifting into application land, I added this because parsing apache error logs is in theory an apache administration task. So, This does not come under "scope creep" and I am happy to work on this if it is popular.
from apache2buddy.
Slight snag though, apache2buddy has traditionally only scanned the generic apache error log in /var/log/httpd/[error.log / error_log](depending on distro).
Would it be worth the time scanning all the error logs and reporting on each one individually? What if they have 200 vhosts with individual log files? Hmmm. Also would this produce too much data? No, not if we limit it to the top 5 maybe.But the 200 vhosts = 200 logs....still thats a lot of output. It might take too long.
Thoughts?
from apache2buddy.
Kept it simple for now, similar to maxclients hit detection, show last 5 PHP Fatal Errrors
from apache2buddy.
# Check 19 : PHP Fatal Errors
# This has been abstracted out into a separate subroutine
# This addresses issue #6 'Check for and report on PHP Fatal Errors in the logs'
detect_php_fatal_errors($model, $process_name);
}
sub detect_php_fatal_errors {
our ($model, $process_name) = @_;
if ($model eq "worker") {
return;
} else {
if ( ! $NOINFO ) {
print "\n${PURPLE}Detecting PHP Fatal Errors....${ENDC}\n";
print "\n${CYAN}PRO TIP: If this process appears to hang, press CTRL + c to exit the program, and then\ngo check for a large error log file in /var/log/httpd or /var/log/apache2.${ENDC}\n\n";
}
}
our $phpfatalerr = 0;
if ($process_name eq "/usr/sbin/httpd") {
our $phpfatalerr_hits = `grep -i fatal /var/log/httpd/error_log | tail -5`;
} elsif ($process_name eq "/usr/local/apache/bin/httpd") {
our $phpfatalerr_hits = `grep -i fatal /usr/local/apache/logs/error_log | tail -5`;
} else {
our $phpfatalerr_hits = `grep -i fatal /var/log/apache2/error.log | tail -5`;
}
our $phpfatalerr_hits;
if ($phpfatalerr_hits) {
$phpfatalerr = 1;
}
our $phpfatalerr;
if ($phpfatalerr) {
if ( ! $NOWARN ) {
show_warn_box();
print "${RED}PHP Fatal errors were found, see the last 5 entries below${ENDC}\n";
show_advisory_box(); print "${YELLOW}Check the logs, there may be much more.${ENDC}\n";
print $phpfatalerr_hits;
}
} else {
if ( ! $NOOK ) {
show_ok_box();
print "${GREEN}No PHP Fatal errors were found.${ENDC}\n";
return;
}
}
}
from apache2buddy.
Only checking the main error log in apache, not sure if php fatal errors are logged in both vhost AND main error logs or not.
may adjust code slightly
from apache2buddy.
# Check 19 : PHP Fatal Errors
# This has been abstracted out into a separate subroutine
# This addresses issue #6 'Check for and report on PHP Fatal Errors in the logs'
detect_php_fatal_errors($model, $process_name);
}
sub detect_php_fatal_errors {
our ($model, $process_name) = @_;
if ($model eq "worker") {
return;
} else {
if ( ! $NOINFO ) {
print "\n${PURPLE}Detecting PHP Fatal Errors....${ENDC}\n";
print "\n${CYAN}PRO TIP: If this process appears to hang, press CTRL + c to exit the program, and then\ngo check for a large error log file in /var/log/httpd or /var/log/apache2.${ENDC}\n\n";
}
}
our $phpfatalerr = 0;
if ($process_name eq "/usr/sbin/httpd") {
our $phpfatalerr_hits = `grep -Hi fatal /var/log/httpd/* | grep -i php | grep -i error | tail -5`;
} elsif ($process_name eq "/usr/local/apache/bin/httpd") {
our $phpfatalerr_hits = `grep -Hi fatal /usr/local/apache/logs/* | grep -i php | grep -i error | tail -5`;
} else {
our $phpfatalerr_hits = `grep -Hi fatal /var/log/apache2/* | grep -i php | grep -i error | tail -5`;
}
our $phpfatalerr_hits;
if ($phpfatalerr_hits) {
$phpfatalerr = 1;
}
our $phpfatalerr;
if ($phpfatalerr) {
if ( ! $NOWARN ) {
show_warn_box();
print "${RED}PHP Fatal errors were found, see the last 5 entries below${ENDC}\n";
show_advisory_box(); print "${YELLOW}Check the logs, there may be much more.${ENDC}\n";
print $phpfatalerr_hits;
}
} else {
if ( ! $NOOK ) {
show_ok_box();
print "${GREEN}No PHP Fatal Errors were found.${ENDC}\n";
return;
}
}
}
Committed to master branch, closing.
from apache2buddy.
Related Issues (20)
- Plans to Support AlmaLinux 8.x and CloudLinux 7.9? HOT 5
- AmazonLinux Docker: Cannot find the 'hostname' executable. HOT 2
- AmazonLinux [ !! ] Python scripting failed. Python requires package 'distro' or 'platform' to determine the Operating System and Version. HOT 6
- Newer versions of python throw deprecation warnings HOT 5
- [ LOW PRIORITY ] Unable to detect apache on nonstandard ports - EOL Ubunutu 1604 with --skip-os-version-check HOT 1
- SS support along with netstat HOT 10
- Apache2buddy does not find apache on bitnami installation HOT 10
- --- a2bchk.sh --- showing MD5 mismatch HOT 4
- Add support for Ubuntu 22.04 HOT 8
- Add tests for ansible playbook in all Jenkins stages HOT 1
- Debian 12 support
- Running ISPconfig on ARM64: Bullseye with Linux 5.10.110-rockchip-rk3588: uninitialized value $apache_proc_php in concatenation (.) or string at - line 2524 (#1) HOT 1
- sub detect_php_memory_limit has hardcoded php executable path
- Support for Oracle Linux Server HOT 1
- Error: Illegal division by zero at line 987 HOT 4
- Support for SLES 12 with worker MPM HOT 1
- including Gentoo
- sub get_php_setting breaks on systems with multiple versions of php installed HOT 1
- Use of uninitialized value $apache_proc_php in string eq HOT 1
- DeprecationWarning: distro.linux_distribution() is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apache2buddy.