Forum Discussion

ashish_solanki's avatar
May 29, 2023

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

  • 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.

  • HI Mohamed,

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

    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