Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Local Traffic Policy for creating Logging Profile

Hi All,

I am working on creating a logging profile for HTTP/S virtual server for which I need help in tcl format for below logging parameters like  tcl:[HTTP::host]:

Virtual server name
BIGIP HOSTNAME
DATE and TIME
CLIENT PORT
POOL NAME
SERVER IP
SERVER PORT
SNAT PORT
HTTP STATUS CODE

Thanks

Ashish Solanki

3 REPLIES 3

Hello @ashish_solanki , 
It's not that easy to deploy that , but let's try I see it's interesting: 

Client >>> [IP::remote_addr]
Port >>>[TCP::remote_port]
Pool >>> [LB::server]
Returns Server IP address >>> [LB::server addr]
Returns selected Server Port >>> [LB::server port] >>> https://clouddocs.f5.com/api/irules/LB__server.html

[virtual name] >>>> https://clouddocs.f5.com/api/irules/virtual.html

Hostname >>> [HTTP::host]

Http Status in Responses >>[HTTP::status] 

 

it's Good to try those but as I mentioned it's not that easy , you need to log to events at http requests and responses as well to get the status codes. 

unfortunatelty , I don't have like your environment to test all of these TCL scripts , but anyway I hope it helps you in your implementations. 

Please keep me updated , I need to know if it helps you or not.

_______________________
Regards
Mohamed Kansoh

HI Mohamed,

Thanks for your response, it working fine just date and time part is missing attaching the snippet for your reference.

ashish_solanki_0-1685463847495.png

May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 192.168.1.1
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: /user_login.php?
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: GET
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: /user_login.php
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 1.1
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: /Common/F5-TRNG-POOL
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 52668
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 192.168.1.25
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 80
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 192.168.1.25
May 30 09:20:30 ashi.com info tmm[12651]: [/Common/LOGGING-TRAFFIC-POLICY/CLIENT-IP-LOGGING]: 200

Hi @ashish_solanki , 
IT's great that it worked with you. 
For Time Maybe you can use this : 

tcl:[clock format clock seconds]

Also I would like you to refer to those articles : 
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl41.html
https://community.f5.com/t5/technical-forum/date-time-sensitive-irules/td-p/17077 

It achievable easly using iRules but Let's try this with Local traffic policies. 

goodluck

_______________________
Regards
Mohamed Kansoh