Wednesday 20 April 2016

Stop logging F5 probes - Apache 2

The log format for Apache to log real IP of requests on the F5 (make sure X-Forwarding is enabled) is:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-Forwarded-For}i\"" combined
To tell Apache not to log the probes from the F5 (which is needed for loadbalancing) is to have these directives:
SetEnvIf Remote_Addr IP_range_or_specific_IP dontlog
So IP_range_or_specific_IP is the regex in quotes, e.g "192\.168\.1\." for range and "192\.168\.1\.42" for IP. You will also need this setting on the statement that does the logging:
CustomLog "logs/access_log" combined env=!dontlog
Restart Apache with the graceful command.

Thursday 14 April 2016

Error: /sbin/mingetty: hvc0: cannot open tty: No such device or address - CentOS 6

I get this annoying error message on some of my servers which fills up the /var/log/messages file. My solution for this is to edit the /etc/sysconfig/init file, removing it on this line:
# What ttys should gettys be started on?
ACTIVE_CONSOLES="/dev/tty[1-6] /dev/hvc0"
You will need to reboot to make the messages go away! Restarting init using 'telinit u' is not enough! Or you can just create the device file using mknod!
# mknod -m 600 /dev/hvc0 c 5 1