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

How can i log source ip and source port on SSL vip by irule?

1qaz
Nimbostratus
Nimbostratus

I have a SSL VIP,I know that X-Forwarded-For can log the source address,but I want to log the source address and source port on F5.How can I get this by irule?thanks!

3 REPLIES 3

Samir
MVP
MVP

Below iRule will log the Source IP and Source Port and send to "/var/log/ltm"

when CLIENT_ACCEPTED {
    log local0. "Source IP address and Port is [IP::client_addr]:[TCP::client_port]"
   }

1qaz
Nimbostratus
Nimbostratus

thanks to Samir Jha,I have another question, I want to insert source addree and source port into the HTTP header,and send the package to server,How to write this irule?thanks! 

Samir
MVP
MVP

Try below irule. Hpe it will work.

when HTTP_REQUEST { 
	log local0. "Source IP address and Port is [IP::client_addr]:[TCP::client_port]"
    HTTP::header insert Client-IP [IP::client_addr]:[TCP::client_port]
}