We’ve written a throttling iRule that parses URIs and occasionally rejects requests based on volume, content and other conditions. That part works well.
We’d like to be able to log some of these events locally for troubleshooting and audit purposes - preferably in a separate custom log in the /var/log/ directory. (not /var/log/ltm) Is this possible?
I don’t have that much experience with syslog, so working through bigpipe to manipulate syslog isn’t making this any easier.
I thought about grabbing one of the local.* logs and using it for myself, but I’m not sure what the impact might be elsewhere.
If a remote server isn’t an option, it would be cleaner to configure syslog-ng to send specific messages to a separate file than take a default syslog facility and use it for your logging. The concept for configuring syslog is relatively simple. You’d want to create a new filter which states which syslog facility to check and which messages to match or not match on, a new destination which states where to send the messages and a new log statement which implements the first two configuration objects.
There are some examples in this Codeshare for the pre-9.4.2 configuration:
You would then need to modify the existing log filter to not match the specific messages if you don’t want those messages logged to the default file.
So that’s the end goal for the syslog-ng configuration. Then you need to use the b syslog command to add this configuration to the bigip_sys.conf file. Deb wrote a helpful article on this:
This is EXACTLY what I’m looking for.Wish I could get it to work
Here is what I’m using…
when HTTP_REQUEST {
set http_request_time [clock clicks -milliseconds]
set request_log_line "\
[HTTP::request_num],\
[IP::remote_addr],\
[HTTP::method],\
[HTTP::version],\
[HTTP::host],\
[LB::server],\
\“[HTTP::uri]\”,\
\“[HTTP::header value Referer]\”,
\“[HTTP::header User-Agent]\”,\
\“[HTTP::cookie value JSESSIONID]\”,\
[SSL::cipher name],\
[SSL::cipher version],\
[SSL::cipher bits]"
}
when HTTP_RESPONSE {
set http_response_time [ clock clicks -milliseconds ]
log 10.1.3.31 local0.info "$request_log_line,\
[HTTP::status],\
[HTTP::payload length],\
[expr $http_response_time - $http_request_time]"
}
I use the same rule to log to the local syslog on my BigIP (log local0. "$request_log_line,\) and it works flawlessly.
However, when trying to log to the remote box 10.1.3.31 (Using the KIWI Syslog Daemon from Solarwinds) I get nothing. Sniffing with WireShark, I don’t see anything coming from my BigIP.
Which LTM version are you running? For 9.4.2+ it would probably be easiest and most efficient to use the log option. For previous versions, how have you configured syslog-ng.conf to send the messages remotely?