Create a separate Apache log for netscaler heartbeat

If you are running your Apache instances through Netscalers and want to avoid cluttering your logs with Netscaler heartbeat calls, try the below:


# Dont log netscaler heartbeats and log ns requests from the CLIENT-IP header and not %a (via combinedtimens)

LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combinedtime
LogFormat "%{CLIENT-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combinedtimens

SetEnvIf CLIENT-IP "." clientrequest

CustomLog logs/webserver-access_log combinedtimens env=clientrequest
CustomLog logs/webserver-heartbeat_log combinedtime env=!clientrequest

Leave a Reply

Your email address will not be published. Required fields are marked *