# Logging URL redirection

**URL:** <https://community.a10networks.com/t/logging-url-redirection/536>\
**Category:** ADC - Application Delivery\
**Tags:** aflex, slb-adc, syslog\
**Created:** [October 15, 2018, 5:51pm UTC](https://community.a10networks.com/t/logging-url-redirection/536 "2018-10-15T17:51:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinla11](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@pinla11](https://community.a10networks.com/u/pinla11)\
**Post date:** [October 15, 2018, 5:51pm UTC](https://community.a10networks.com/t/logging-url-redirection/536/1 "2018-10-15T17:51:54Z")

</div>

I need to log the requests to some URLs that are redirected to another domain. I need to know if there’s still clients trying to access the OLD domain. I wrote an aFLEX to do this, and it works ok in my lab enviroment. I did the same configuration at the production network, but it doesn’t work. There’s not traffic matching the rule. I did a debug at the ADC (axdebug) and there’s nothing matching the aFlex.

Here’s the aFlex:

#Log HTTP request to Redirected web sites

```auto
when HTTP\_REQUEST \{

if \{([CLASS::match [string tolower [HTTP::host]] starts\_with cl-logging-redirections])\} \{

```

#set slogging yes

```auto
    set cs\_ip\_method\_uri "[IP::client\_addr] [HTTP::method] [HTTP::uri]"
    set site\_web [HTTP::host]
    set date\_time\_request [clock format [TIME::clock seconds] -format \{%Y-%m-%d %H:%M:%S\} ]
    set cs\_user\_agent [string map \{" " "\+"\} [HTTP::header "User-Agent"]]
    set c\_request\_version [HTTP::version]
    if \{[HTTP::header exists Referer]\} \{
     set cs\_referer [HTTP::header "Referer"]
    \} else \{ set cs\_referer "-" \}
   set redirection [HTTP::header Location]
   set log\_str "log-redirection-$site\_web $date\_time\_request $cs\_ip\_method\_uri $cs\_referer $cs\_user\_agent HTTP/$c\_request\_version $redirection"
   log local0.INFO $log\_str
\} 
\}

```

I need some help to find where’s the error.

---

<div class="post-metadata">

**Author:** ![hkohn72](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@hkohn72](https://community.a10networks.com/u/hkohn72)\
**Post date:** [October 29, 2018, 1:44pm UTC](https://community.a10networks.com/t/logging-url-redirection/536/2 "2018-10-29T13:44:27Z")

</div>

Hello pinala,

aFlex are also under support so you can open a case to let the A10 TAC check where the error is.

CU hkohn!
