cancel
Showing results for 
Search instead for 
Did you mean: 

grab host header from logs

Highlighted
Occasional Contributor

grab host header from logs

Hi all,

I have a support case going for this already but wanted to see if anyone in here has a solution. My client changed url's some time back. to ease the transition, they configured a redirect where any requests coming in on the old url gets sent to the new url. Now they want to decomm the old url. They have asked me to check in the logs for any requests with the old url in the header. Support advised to use this custom config : %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" %f

This seems to reveal only the url of the page being served but we still don't how what url was in the request. Any insight will be appreciated.

1 REPLY
Contributor

Re: grab host header from logs

Were you able to solve this with the support team? They will have more detailed context, and they can help you enable Request Logging to track the information you need.

 

Meanwhile, if the redirect is implemented in Traffic Manager, then you can add a line to that redirect rule, to write the originating URL to the log file, along with any other info you want, such as originating IP, serving node and so on. For example:

 

$request = http.getRequest();
if( string.contains( http.getheader( "Host" ), "example.com" ) ) {

     $oldurl = http.getPath(); 
     $newurl = ....

     log.info( "REDIRECT from " . $oldurl . " to " . $newurl );
     http.changeSite( $newurl );
}