Still a crash…

Had to reflect on crontab. Still not sure I have everything in place. But maybe

Added sudo crontab to see if I can run a postfix restart after a system crash. I hate manually restarting postfix after a crash. Maybe this will work? @reboot in a sudo crontab could work, right?

Mail system resolved under Homebrew

Did some work on mail related interfaces and now have competent holding bin for system related mail relative to crontab, wordpress, and phpservermon. Mailhog and update of various elements was the answer to have easy solution for mail capturing without dealing with external SMTP servers and configuration.

Mailhog sits as a launch-able site to review mail generated by these systems. Keeps it in a nice holding location for easy review.

$ brew install mailhog

Installation via brew was easy, although configuration of Postfix was critical:

/etc/postfix/main.cf

#Gmail SMTP
#relayhost=smtp.gmail.com:587
#Enable SASL authentication in the Postfix SMTP client.
#smtp_sasl_auth_enable=yes
#smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
#smtp_sasl_security_options=noanonymous
#smtp_sasl_mechanism_filter=plain

#Enable Transport Layer Security (TLS), i.e. SSL.
#smtp_use_tls=yes
#smtp_tls_security_level=encrypt
#tls_random_source=dev:/dev/urandom
#smtputf8_enable = no
 compatibility_level = 2
 
#MailHog
 myhostname = localhost
 relayhost = [127.0.0.1]:1025

Key is to comment out everything gmail related (never worked anyway for some reason) and add the mailhog configuration as suggested through install documentation. Keep compatibility_level=2 for proper logging and operation. Worked well and stable. Mailhog has to be started in Brew:

$ brew services start mailhog

By the way, figured out that my use of apachectl was screwing up brew services, so no longer using “sudo apachectl -k restart” – that pushes web services to the SU level and causes a conflict with Brew. By using sudo apachectl to stop and “brew services start http” everything was fixed. Additionally, added the following to crontab:

#restart commands
 @reboot brew services restart httpd

Now, when there is a crash (still happening occasionally), restart and login causes httpd to automatically restart. Much more functional. If I can set it to do this without logging in, I’ll get it running automatically at runtime and without login.

New tool… Logstalgia

Finally found the real time monitoring I was looking for…

brew install logstalgia

Beautiful pong-styled view of access log in realtime when called as follows:

tail -f /usr/local/var/log/httpd/access_log | logstalgia --sync 

Ends up as a screen like this with pong balls that are the requests from the access log showing the files being accessed by category. Brilliant!!

Logstalia window

Further, with a sequence of commands, you can push the monitor into the background and exit terminal as follows:

$ tail -f /usr/local/var/log/httpd/access_log | logstalgia --sync &
$ disown
$ exit

This leaves logstalgia running in a window that you can place on a desktop for easy access and monitoring. Before disown, you can run “jobs” command to see the process before disown-ing it. After, it is now missing from “jobs” list.

New add – would love sound with this.

Cool tool!

Two indispensable Tools

Added two modules to my LAMP server.

First is goaccess

$brew install goaccess

Log parsing for apache monitoring. all the right statistics derived from the main httpd log:

/usr/local/var/log/httpd/access_log

Startup this way with the important log format tag:

$goaccess /usr/local/var/log/httpd/access_log --log-format=COMMON

Second tool – very much like Activity monitor, but in terminal – GLANCES

$brew install glances

Then it is simple startup via:

$glances

Running in different shells makes for informative set of information screens.