Forum Discussion
Help with iRule logging to local0.
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]" } }
- fredlubranoCirrus
---
- Stanislas_Piro2Cumulonimbus
The issue may be the character ”. this is not the accepted double-quote inside irules. replace it with "
- Boggs_5738Nimbostratus
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.
- Boggs_5738Nimbostratus
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" } {
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
- benniehanas_239Nimbostratus
I took underscores out and it still fails. I really need to learn TCL better
- Boggs_5738Nimbostratus
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_239Nimbostratus
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]"]
- Lee_SutcliffeNacreous
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]" } }
- Boggs_5738Nimbostratus
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]" } }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com