HTTP Access log

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HTTP Access log

davidh
We are using ActiveMQ REST API <http://activemq.apache.org/rest.html>   to
publish messages on topics.

I'd like to be able to track HTTP requests into ActiveMQ, via Jetty, such
that I can see timestamp, time taken etc.

Is this possible?

I know that AMQ uses Jetty embedded - and ( based on this
<https://www.eclipse.org/jetty/documentation/9.3.x/configuring-jetty-request-logs.html>
) should in theory be able to get Jetty to write access logs, but I'm
struggling to relate this to inclusion in  AMQ control scripts
<http://activemq.apache.org/unix-shell-script.html>  




--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: HTTP Access log

art.licis
Yes, it is possible. To do that, you just need to add RequestLogHandler to
jetty handler collection. That's how you do it:

By default, Jetty is configured via jetty.xml (imported in activemq.xml):
<import resource="jetty.xml"/>

jetty.xml is a regular Spring configuration file, and some handlers are
already defined. So you just create an additional one for request logging,
and add to handlers collection:
<!-- ............... -->

    <bean id="requestLogHandler"
class="org.eclipse.jetty.server.handler.RequestLogHandler">
        <property name="requestLog">
            <bean class="org.eclipse.jetty.server.NCSARequestLog">
                <property name="filename"
value="/var/opt/activemq/logs/yyyy_mm_dd.request.log" />
                <property name="filenameDateFormat" value="yyyy_MM_dd" />
                <property name="retainDays" value="14" />
                <property name="append" value="true" />
                <property name="extended" value="true" />
                <property name="logCookies" value="false" />
                <property name="logTimeZone" value="GMT" />
            </bean>
        </property>
    </bean>

        <bean id="secHandlerCollection"
class="org.eclipse.jetty.server.handler.HandlerCollection">
                <property name="handlers">
                        <list>
                            <ref bean="rewriteHandler"/>
                            <!-- ..........-->
                            <ref bean="requestLogHandler"/>
                        </list>
                </property>
        </bean>


The rest is a matter of fine-tuning.

- Art


On Thu, Oct 19, 2017 at 2:26 PM, davidh <[hidden email]> wrote:

> We are using ActiveMQ REST API <http://activemq.apache.org/rest.html>   to
> publish messages on topics.
>
> I'd like to be able to track HTTP requests into ActiveMQ, via Jetty, such
> that I can see timestamp, time taken etc.
>
> Is this possible?
>
> I know that AMQ uses Jetty embedded - and ( based on this
> <https://www.eclipse.org/jetty/documentation/9.3.x/
> configuring-jetty-request-logs.html>
> ) should in theory be able to get Jetty to write access logs, but I'm
> struggling to relate this to inclusion in  AMQ control scripts
> <http://activemq.apache.org/unix-shell-script.html>
>
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: HTTP Access log

Karlovsky Alexey
In reply to this post by davidh
If you are Mac or Linux user, I can recommend lnav(1).
It's super tool for viewing logs, combine different logs, filtering and etc.

1 http://lnav.org

On 19 Oct 2017 2:26 p.m., "davidh" <[hidden email]> wrote:

> We are using ActiveMQ REST API <http://activemq.apache.org/rest.html>   to
> publish messages on topics.
>
> I'd like to be able to track HTTP requests into ActiveMQ, via Jetty, such
> that I can see timestamp, time taken etc.
>
> Is this possible?
>
> I know that AMQ uses Jetty embedded - and ( based on this
> <https://www.eclipse.org/jetty/documentation/9.3.x/
> configuring-jetty-request-logs.html>
> ) should in theory be able to get Jetty to write access logs, but I'm
> struggling to relate this to inclusion in  AMQ control scripts
> <http://activemq.apache.org/unix-shell-script.html>
>
>
>
>
> --
> Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-
> f2341805.html
>