Claus,
Probably I didn't explain the problem in much better way. For my audit logs due
to security reasons we don't need to the print body information that's why I
didn't enable the stream caching. Even otherwise I tried before as well as
tried again (added streamCaching to the route) it is still not printing what i
am expecting . Please take a close look at the following "expected result and
wire tap print" explanation. I am trying to create to http access log kind of
audit logging. You can say why can't you enable that, well, our incoming urls
are encrypted and so once the incoming URL passes through our security filter I
felt routes will give me full control to log what i want.
Essentially, I was expecting the first wire tap to print proxy URL and its http
response code and the second wire tap to print the Provider URL and its http
response code. However, from both the wiretaps Camel is only printing proxy
URLs and its response code.
What surprises me is after "to("provider url") why it is printing the
from("proxy url") information.
Please let me know if I you have any quesitons.
Thanks,
Sridhar
As explained earlier, Our HttpLogProcessor contains the following log statement
------------------------ -----------------------------------------------------
Message in = exchange.getIn();
System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE));
Route DSL
--------
from("servlet://Proxy/Vendor/12345")
.streamCaching()
.wireTap(direct:auditLog).end(); [ This
wire tap prints : https://proxy-host:6081/Proxy/Vendor/12345
,<https://proxy-host:6081/Proxy/Vendor/12345,>
null<https://proxy-host:6081/Proxy/Vendor/12345,null> where first one is proxy
URL and the null is for HTTP response code] [Expected Result:
https://proxy-host:6081/Proxy/Vendor/12345
,<https://proxy-host:6081/Proxy/Vendor/12345,> 200 ]
.process(new HttpHeaderProcessor())
.routeId(routeId)
.to("https://ProivderHost:6081/Provider/Vendor/12345")
.streamCaching()
.process(new CleanupHeaderProcessor())
.wireTap(direct:auditLog).end(); [ This
wire tap prints : https://proxy-host:6081/Proxy/Vendor/12345
,<https://proxy-host:6081/Proxy/Vendor/12345,>
2<https://proxy-host:6081/Proxy/Vendor/12345,null>00 where first one is proxy
URL and the 200 is for HTTP response code] [Expected Result:
https://ProivderHost:6081/Provider/Vendor/12345 ,
200<https://ProivderHost:6081/Provider/Vendor/12345,200> ]
________________________________
From: Claus Ibsen-2 [via Camel] [[email protected]]
Sent: Saturday, January 19, 2013 3:07 AM
To: Dabbeeru, Sridhar V (CGI Federal)
Subject: Re: how to intercept route builder "to" route for audit logging
Hi
See the blue box at
http://camel.apache.org/servlet
And this FAQ
http://camel.apache.org/why-is-my-message-body-empty.html
On Fri, Jan 18, 2013 at 8:52 PM, dvsridhar
<[hidden email]<UrlBlockedError.aspx>> wrote:
> Hi,
> We have to provide audit log for our http routes, for which, we host bunch
> http proxy routes using servlet component which routes the request to the
> provider using http producer.
>
> The following route does wireTap after "from" and "to" routes. However,
> when the wiretap finishes, i am getting the same from url in both logs.
>
> In my HttpLogProcessor I am using the following snippet to obtain endpoint
> URL. In both the logs I get the same from end point URL and the response
> code is null in the first log where as i get the correct response code on
> the second log. In nutshell it is not printing the "to" route end point URL.
> I could enable trace that prints whole lot for audit log, so, we don't need
> all that stuff.
>
> HttpLogProcessor
> ------------------------
> *
> Message in = exchange.getIn();
> System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE));
> *
>
>
> Route
> ----------
> onException(Exception.class)
> .handled(true)
> .wireTap(direct:auditLog).end()
> .process(new ErrorProcessor());
>
> from("servlet://Proxy/Vendor/12345")
> * .wireTap(direct:auditLog).end();
> *
> .process(new HttpHeaderProcessor())
> .routeId(routeId)
>
> .to("https://ProivderHost:6081/Provider/Vendor/12345")
> .process(new CleanupHeaderProcessor())
> * .wireTap(direct:auditLog).end();
> *
>
> * from(direct:auditLog).process(new
> HttpLogProcessor())
> .to(jms:queue:LOG_QUEUE);
> *
>
> from("jms:queue:LOG_QUEUE?concurrentConsumers=3")
> .bean(AuditLogProcessor.class,"log");
>
> *Expected Result:*
> 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor]
> https://proxy-host:6081/Proxy/Vendor/12345,200
>
> 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor]
> https://proxy-host:6081/Proxy/Vendor/12345,200
>
> *But what we are getting the following Log Trace
> ------------
> *
> 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor]
> https://proxy-host:6081/Proxy/Vendor/12345,null
>
> 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor]
> https://ProivderHost:6081/Provider/Vendor/12345,200
>
>
> Wondering how to do this? Do I need to do some sort interceptors to achieve
> this?
>
> Any help appreciated.
>
> Thanks,
> Sridhar
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]<UrlBlockedError.aspx>
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791p5725798.html
To unsubscribe from how to intercept route builder "to" route for audit
logging, click
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5725791&code=ZGFiYmVlcnUudmVua2F0YS5zcmlkaGFyQGNnaWZlZGVyYWwuY29tfDU3MjU3OTF8LTYyMjUyMDIzNA==>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context:
http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791p5725812.html
Sent from the Camel - Users mailing list archive at Nabble.com.