Apache Email Error Log
Contents |
DOMAINS WEB DESIGN WEB DESIGN SERVICES CREATE YOUR OWN WEBSITE SITE HOSTING TOOLS MEET US MEET US apache error log format ABOUT US PARTNERS & AWARDS BLOG WE'RE HIRING CONTACT apache error logs ubuntu US AMP LOGIN SUPPORT CENTER Search Support Center Product Guides Dedicated Hosting Reseller Hosting apache error logs cpanel KnowledgeBase Website Email Domain Names Reseller Billing Community Support Browse Questions Ask a Question User Submitted Articles Education Channels Android BoldGrid cPanel DokuWiki Drupal apache error logs centos 7 Drupal 8 Everything Email Joomla 2.5 Joomla 3.1 K2 Magento 1.6 Mambo MediaWiki Moodle Movable Type OpenCart OpenCart 2.0 osCommerce PHP-Fusion PHP-Nuke phpBB phpList Premium Website Builder PrestaShop 1.5 PrestaShop 1.6 SMF Tiki Wiki VirtueMart 3 Web Hosting Manager Website Design WordPress Tools & Resources Email
Where Are Apache Error Logs Located
Configuration Blacklist Check Visual DNS Lookup Quick Tagger Icon Sets Favicon Generator Bounce Back Parser What is my IP address? >>Website .htaccess (17)Adobe Flash (2)APIs (2)Backup and Restore (15)Billing (8)Browser Issues (2)Connecting to a Database (5)cPanel (26)cPanel Account Management (16)Cron Jobs (4)Cube Cart (2)Database Setup (5)Database Troubleshooting (6)Domain Management (2)Dreamweaver (12)Drush (2)eCommerce (7)Elasticsearch (4)Fantastico (4)File Management (16)File Manager (6)FTP (10)FTP Client Setup (21)General Server Setup / Management (15)Getting Started Guides (18)Ghost (3)Google Tools (21)How To (23)HTML (2)Image Editing (2)IP Addresses (3)iWeb (1)JavaScript (2)Joomla (10)Joomla 2.5 (36)Koken (11)Linux (27)Logaholic (5)Magento (2)Maintaining Your Website (1)Managing Files (7)Microsoft FrontPage (11)Microsoft Publisher (1)ModSecurity (7) MODx (3)New Customers (7)Open Classifieds (1)PCI Compliance (7)PHP (15)PHP Configuration (7)PHP Troubleshooting (6)phpBB (25)phpMyAdmin (10)Premium Website Builder (22)Prestashop (1)Protecting Files (5)Publishing Your Site (2)Python (1)Redirects (4)Restricting Bots (5)Search Engine Optimization (1)Secure Socket Layer (SSL) Tutorials (13)Security (12)Sending Email Fro
have one accepted answer. Are you sure you want to replace the current answer with this one? Yes, I'm sure. Changed your mind? You previously marked this answer as accepted. Are you sure you want to unaccept it? Yes, I'm sure. Sign Up Log In
Where Are Apache Error Logs Stored
submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main linux apache error log Site Sign Up Log In submit View All Results By: sierracircle Subscribe Subscribed Share 1 Script that will email the last few lines of error apache error logging level logs .. September 12, 2014 2.1k views I am working on a script that: checks if mysql and apache are running if not, it sends an email and then attempts to restart the non-running service I would like to add the http://www.inmotionhosting.com/support/website/getting-started-guides/cpanel-logs-for-access-apache-email-error-ftp-mysql-whm last few lines of the error logs to the email. Here is what I have so far. The check works, the restart works, sending email works, but am not getting my error messages from the log: #!/bin/bash #ver. 1 ##this script will check mysql and apache ##if that service is not running ##it will start the service and send ##an email to you ##set your email address EMAIL="email@yourdomain.com" ##list your services you want to check SERVICES=( 'mysql' 'apache2' ) #### DO NOT https://www.digitalocean.com/community/questions/script-that-will-email-the-last-few-lines-of-error-logs CHANGE anything BELOW #### for i in "${SERVICES[@]}" do ###IF APACHE IS NOT RUNNING#### if [[ "$(service $i status)" =~ "not" ]] then service $i start MESSAGE= "$(tail -5 /var/log/$i/error.log)" SUBJECT="$i down on $(hostname) $(date) " echo "$MESSAGE mysql" | mail -s "$SUBJECT" "$EMAIL" fi ###IF MYSQL IS NOT RUNNING#### if [[ "$(service $i status)" =~ "stop" ]] then service $i start MESSAGE= "$(tail -5 /var/log/$i/error.log)" SUBJECT="$i down on $(hostname) $(date) " echo "$MESSAGE " | mail -s "$SUBJECT" "$EMAIL" fi done Any tips on getting info from the error logs into the email? Also, my loop would be much better if all services had the same status message...I wonder if there is a better way of checking if the service is running that will return the same result for all services. 1 comment 1 asb MOD September 12, 2014 Is the space after MESSAGE= just something in your question, or is that in the actual code? If I remove the space, it works for me: MESSAGE="$(tail -5 /var/log/$i/error.log)" Log In to Comment Leave a Comment Add comments here to get more clarity or context around a question. To answer a question, use the “Answer” field below. Log In to Comment 1 Answer 1 asb MOD September 12, 2014 For checking if the service is running or not, you could check the exit code. A well written init script should return 0 if the service is good, 1 service is dead but the /
and Objects Namespaces Errors Exceptions Generators References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session http://php.net/manual/en/function.error-log.php Security Filesystem Security Database Security Error Reporting Using Register Globals User Submitted Data Magic Quotes Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Safe Mode Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and error log Archive Extensions Credit Card Processing Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation Keyboard apache error log Shortcuts? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search(current page) / Focus search box error_reporting » « error_get_last PHP Manual Function Reference Affecting PHP's Behaviour Error Handling Error Handling Functions Change language: English Brazilian Portuguese Chinese (Simplified) French German Japanese Korean Romanian Russian Spanish Turkish Other Edit Report a Bug error_log (PHP 4, PHP 5, PHP 7)error_log — Send an error message to the defined error handling routines Description bool error_log ( string $message [, int $message_type = 0 [, string $destination [, string $extra_headers ]]] ) Sends an error message to the web server's error log or to a file. Parameters message The error message that should be logged. message_type Says where the error should go. The possible message types are as follows: error_log() log types 0 message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to. This is the default option. 1 message is sent by email to the address i