Centralized server log (not web) on AX
in aFleX
Posted by ddesmidt
I guess that's the "logging question week"!!!
After one customer asking me "how to centralize web server log on AX" (see: aFleX forum - Centralized web server log on AX), I just received a question from one A10 System Engineer on "how to centralized server log (not web) on AX".
That's pretty much the same, but obviously this time I check the IP and port only (and not http information).
Note: Use AX 2.4.2P3 code or newer
Code:
I guess that's the "logging question week"!!!
After one customer asking me "how to centralize web server log on AX" (see: aFleX forum - Centralized web server log on AX), I just received a question from one A10 System Engineer on "how to centralized server log (not web) on AX".
That's pretty much the same, but obviously this time I check the IP and port only (and not http information).
Note: Use AX 2.4.2P3 code or newer
Code:
when CLIENT_ACCEPTED {
# Set strings for the "client side"
set time_client_connection [clock seconds]
set date_time_request [clock format $time_client_connection -format {%Y-%m-%d %H:%M:%S} ]
set c_ip [IP::client_addr]
set c_port [TCP::client_port]
set vip_ip [IP::local_addr]
set vip_port [TCP::local_port]
}
when SERVER_CONNECTED {
# Set strings for the "server side"
set s_ip [IP::server_addr]
set s_port [TCP::server_port]
# Format strings for logging
set log_str "$date_time_request - $c_ip:$c_port => $vip_ip:$vip_port => $s_ip:$s_port"
# write to syslog with Debug level
log local0.7 $log_str
# write to AX log (turn this for troubleshooting only, as you may have a lot of connections / second)
# log $log_str
}
0