I have an LTM that balances a pool of webserver IP+ports. Each webserver forwards requests to a pool of app servers. Currently there’s no way to correlate requests between web and app tiers. I was wondering if the LTM could add a custom header that identifies each request. I could then log this header at web and app tiers and so identify which app server handled a specific webservers request. Can this be done cheaply by the LTM?
Depending on the info you need you might be able to do it with cookie persistence since each cookie will be specific to the connection. Otherwise, as nitass suggested, an irule would be a great option.
Here are two options. The rand option should be more efficient but not cryptographically secure. You can compare the CPU usage using the timing command.
Use rand() to generate a psuedo-random 8 digit number (not cryptographically secure)
format %010s expr [{ int(100000000 * rand()) }]
Use AES::key to generate a cryptographically secure unique ID