Forum Discussion
Newby needs irule help
Greetings. The software guys assigned this task to me, can anyone please help me come up with an irule?
"Please write an IRule or some kind of filter that inspects the last_login Cookie in the Http Resonse Header sent from our weblogic application servers.
The Cookie will have a Name of last_login, the Content field will contain the username and this is the element we want to filter on.
During times of troubleshooting program staff will contact someone in IT and ask them to enable this filter for some username. The expectation is this filter can sniff the response header where last_login=SomeUserName and write some dianostics to a file, such as the time and HTTP Header."
7 Replies
- nitass
Employee
e.g.[root@ve10:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_RESPONSE { if {[HTTP::cookie exists last_login]} { foreach aheader [HTTP::header names] { log local0. "[IP::client_addr]:[TCP::client_port] | ${aheader}: [HTTP::header value $aheader]" } } } } on client [root@centos251 ~] curl -I http://172.28.19.79 HTTP/1.1 200 OK Date: Thu, 04 Oct 2012 17:16:06 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT ETag: "4183e4-3e-9c564780" Accept-Ranges: bytes Content-Length: 62 Set-Cookie: last_login=tasmania path=/ Connection: close Content-Type: text/html; charset=UTF-8 on bigip [root@ve10:Active] config tail -f /var/log/ltm Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Date: Thu, 04 Oct 2012 17:16:06 GMT Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Server: Apache/2.2.3 (CentOS) Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | ETag: "4183e4-3e-9c564780" Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Accept-Ranges: bytes Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Content-Length: 62 Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Set-Cookie: last_login=tasmania path=/ Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Connection: close Oct 5 00:59:48 local/tmm info tmm[4907]: Rule myrule : 172.28.19.251:49826 | Content-Type: text/html; charset=UTF-8
- RiverFish
Altostratus
Thank you very much! I think I understand everything here. I'll put it in place and see how it goes. - RiverFish
Altostratus
They have modified their request. Any help would be much appreciated. New request below: - Kevin_Stewart
Employee
The rule is pretty close to the last one:when HTTP_RESPONSE { if { [HTTP::header exists NTTN_ARMON] } { log local0. "[clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}], [HTTP::header NTTN_ARMON]" } }
- RiverFish
Altostratus
Bam! Thanks again! - RiverFish
Altostratus
Is there an easy way to direct the output of this iRule to it's own dedicated log instead of the system log? - Mohamed_Lrhazi
Altocumulus
Maybe you'll find your answer here:
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