Forum Discussion
atomicdog_7107
Mar 24, 2012Nimbostratus
Does anyone know why this wouldn't work?
Hey guys I'm trying to create an iRule to log when a specific source port hits a VS... this is what I've created.
when CLIENT_ACCEPTED {
if {[IP::addr[TCP::client_port] equals "1025"] } {
log local0.info "IP and Port: [IP::client_addr]:[TCP::client_port]"
}
}
The iRule editor says it's valid, but when I apply it to the VS it doesn't work and I see this in the logs:
Mar 23 18:32:36 local/tmm err tmm[6065]: 01220001:3: TCL error: Log_Source_Port_1025 - invalid command name "IP::addr58751" while executing "IP::addr[TCP::client_port] equals "1025""
Any suggestions? Thanks!
- richard_77048NimbostratusMaybe just try [TCP::client_port] rather than [IP::addr[TCP::client_port]?
- atomicdog_7107NimbostratusI thought the same thing... I tried both ways. I just ran it again to get the error...
- atomicdog_7107NimbostratusI happened to find this thread and figured it out from that... Thanks Hoolio!
- richard_77048NimbostratusIt seems to work for me. I guess I should have asked what version you were using. I'd be surprised if that made a difference here but you never know.
when CLIENT_ACCEPTED { if { [TCP::client_port] equals "49562" } { log local0.debug "client: [IP::client_addr]:[TCP::client_port]" } }
- atomicdog_7107NimbostratusYou're absolutely right man! Thanks! I don't know exactly what I missed in my iRule (unfortunately I deleted it once I got the other one working), but I copied and pasted yours and it worked like a charm. It looks exactly the same from memory... this is going to bug me now!
- hooleylistCirrostratus'invalid command name "IP::addr58751"' was caused by not having a space between IP::addr and [TCP::client_port]. As Richard said, you wouldn't want to use IP::addr for this though as it's used for doing bitwise comparisons of IP addresses/subnets.
when CLIENT_ACCEPTED { if { [TCP::client_port] == 49562 } { log local0.debug "client: [IP::client_addr]:[TCP::client_port]" } }
- atomicdog_7107NimbostratusHmmm... The iRule editor doesn't have the logic to check and see if the spacing is correct? I didn't realize that.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects