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

Help with iRule logging to local0.

benniehanas_239
Nimbostratus
Nimbostratus

I am trying to log an iRule, but it keeps erroring out. Can you help with what I'm missing?

 

when HTTP_REQUEST { if { [HTTP::path] starts_with "/media" } { pool persist cookie insert log local0. ”media.com_28080 TCP_logging fired, from [IP::client_addr]" } }

 

9 REPLIES 9

Boggs_5738
Nimbostratus
Nimbostratus

what is the error that you get? I noticed you are sending to a pool if it matches the uri but in your pool statement there is no pool defined.

 

when HTTP_REQUEST { if { [HTTP::path] starts_with "/media" } { pool persist cookie insert log local0. ”media.com_28080 TCP_logging fired, from [IP::client_addr]" } }

 

Lee_Sutcliffe
Nacreous
Nacreous

Try this to start with. I've removed your cookie persist section as this didn't match the required syntax. See https://devcentral.f5.com/wiki/iRules.persist.ashx for details. You don't need to configure persistence with an iRule, add a cookie persistence profile to the virtual server

when HTTP_REQUEST { 
    if { [HTTP::path] starts_with "/media" } { 
        pool  
        log local0. "media.com_28080 TCP_logging fired, from [IP::client_addr]" 
    } 
}

benniehanas_239
Nimbostratus
Nimbostratus

I took the pool name out as it was a FQDN. My error is:

 

01070151:3: Rule [/Common/media_pool_redirect] error: /Common/media_pool_redirect:5: error: ["invalid argument local0"][log local0 ”] /Common/media_pool_redirect:5: error: [undefined procedure: media.com_28080][media.com_28080 TCP_logging fired, from [IP::client_addr] to vip [IP::local_addr]"]

 

Boggs_5738
Nimbostratus
Nimbostratus

try to remove the underscores character from your media.com_28080 and TCP_logging fired section of the log. they look to be being interpreted differently by the irule. they look like actual functions similar to IP::local_addr

 

try this for the log statement:

 

log local0. ”media.com.28080 TCP.logging fired, from [IP::client_addr]"

 

benniehanas_239
Nimbostratus
Nimbostratus

I took underscores out and it still fails. I really need to learn TCL better

 

Boggs_5738
Nimbostratus
Nimbostratus

so tried the irule in the lab.. here is working irule per my test.. it was not the underscore. it was some extra or missing curly bracket...

 

when HTTP_REQUEST { if { [HTTP::path] starts_with "/media" } {

 

pool persist cookie insert

log local0. "mediacom_28080 TCP_logging fired, from [IP::client_addr]" } }

 

resulting log

 

Mar 14 09:37:22 f5 info tmm1[21757]: Rule /Common/slashmedia : mediacom_28080 TCP_logging fired, from xx.xx.xx.xx

 

Boggs_5738
Nimbostratus
Nimbostratus

somehow, pool and persist cookie insert shown as enlarge words.. i actually added a character in front of the line to comment them out for testing.

 

Stanislas_Piro2
Cumulonimbus
Cumulonimbus

The issue may be the character . this is not the accepted double-quote inside irules. replace it with "

 

fredlubrano
Cirrus
Cirrus

---