Forum Discussion

Ding_Hsu's avatar
Ding_Hsu
Icon for Nimbostratus rankNimbostratus
Apr 11, 2021
Solved

is it possible to log all header to html page

Hi Guys, I try to use the irule to log all http headers when the request is coming to the VS, and then F5 generate the response page to the client. I find the rule to log the all header to /var/log...
  • Nikoolayy1's avatar
    Apr 12, 2021

    1.You can just add the log local0 in statement in the foreach loop and not write all the headers to "LogString" variable like log local0. "$headerName:[HTTP::header value $headerName]" or you can still use "LogString" but without the "append" as this time it will just take the value of the firt header and log it, then the second and then the 3th header and value and so on.

     

     

     

    2.Also you can also research the Split string ?splitChars? to split the string in a list before logging the output "LogString" variable, so that you can make it a list (you add something like "#" after each append of the HTTP header and value and use it as match for the split string) beffore logging it out but the previous example is easyer.

     

    Use of manipulations like "Split string" etc.:

     

    https://devcentral.f5.com/s/articles/irules-101-15-tcl-list-handling-commands

     

     

    I suggest reading the F5 devcental course on irules, so that you can work better with irules. After that play writting irules and in no time you are good to go as I see you are playng with them but just need some more time.