<div class="gmail_extra">The OP has not said if he uses Guvnor or not. We can only guess.<br><br>&quot;Last run date&quot; is a run-time metric. Guvnor only contains design-time metrics. Therefore you&#39;ll have to devise your own mechanism using AgendaListener as Wolfgang proposes.<br>
<br>&quot;Author&quot; (and other such metadata) is stored in Guvnor and is (probably) available using the REST API - but it&#39;ll be on a per-asset basis and definitely not lend itself to batch querying (e.g. as with a RDBMS) as you imply.<br>
<br>&quot;Rule validity&quot; is another analysis you do not mention. drools-verifier may be able to help there.<br><br><div class="gmail_quote">On 25 April 2012 17:43, Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 25/04/2012, <a href="mailto:thomashatz@yahoo.com">thomashatz@yahoo.com</a> &lt;<a href="mailto:thomashatz@yahoo.com">thomashatz@yahoo.com</a>&gt; wrote:<br>

&gt; Thanks Wolfgang,<br>
&gt;<br>
&gt; But don&#39;t the rules tables have basic info like &#39;last run date and time and<br>
&gt; user&#39; type info...<br>
<br>
</div>I&#39;m not aware of any such information being collected and stored<br>
automatically. But if this is a Guvnor function, I may have a very<br>
blind spot there.<br>
<div class="im"><br>
&gt;<br>
&gt; Also how to setup an AgendaEventListener<br>
<br>
</div>It&#39;s done as with any other listener in JDK etc. Here are some code<br>
snippets to get you started. This code is not necessarily &quot;best<br>
practice&quot; or anything; it&#39;s meant to illustrate the essentials. The<br>
constructor installs the listener.<br>
<br>
public class AgendaWatcher implements AgendaEventListener {<br>
<br>
    // useful aux. method<br>
    private String ruleNameOfEvent( ActivationEvent actEvent ){<br>
        Activation activation = actEvent.getActivation();<br>
        Rule rule = activation.getRule();<br>
        return rule.getPackageName() + &#39;.&#39; + rule.getName();<br>
    }<br>
<br>
    public AgendaWatcher( KnowledgeRuntime knowledgeRuntime ){<br>
        knowledgeRuntime.addEventListener( (AgendaEventListener)this );<br>
    }<br>
<br>
    @Override<br>
    public void activationCancelled(ActivationCancelledEvent actEvent) {<br>
         // happens frequently, for various reasons. may not be of interest.<br>
    }<br>
<br>
    @Override<br>
    public void activationCreated(ActivationCreatedEvent actEvent) {<br>
        // same thing.<br>
    }<br>
<br>
    @Override<br>
    public void beforeActivationFired(BeforeActivationFiredEvent arg0) {<br>
    }<br>
<br>
    @Override<br>
    public void afterActivationFired(AfterActivationFiredEvent actEvent) {<br>
        // count firings<br>
        Counts counts = getCountsForName( ruleNameOfEvent( actEvent ) );<br>
        counts.firings++;<br>
    }<br>
<br>
    @Override<br>
    public void agendaGroupPopped(AgendaGroupPoppedEvent arg0) {<br>
    }<br>
    @Override<br>
    public void agendaGroupPushed(AgendaGroupPushedEvent arg0) {<br>
<div class="HOEnZb"><div class="h5">    }<br>
}<br>
<br>
<br>
<br>
<br>
&gt;<br>
&gt; Really appreciate your knowledge sharing<br>
&gt;<br>
&gt; --- On Tue, 4/24/12, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; From: Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;<br>
&gt;&gt; Subject: Re: [rules-users] How to query rules to create reports to analyze<br>
&gt;&gt; usage<br>
&gt;&gt; To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
&gt;&gt; Date: Tuesday, April 24, 2012, 4:30 AM<br>
&gt;&gt; For analyzing &quot;rules usage&quot; an<br>
&gt;&gt; AgendaEventListener should be used to<br>
&gt;&gt; register the information you are interested in. (You<br>
&gt;&gt; wouldn&#39;t need to<br>
&gt;&gt; query the rules DB for this anyway.)<br>
&gt;&gt;<br>
&gt;&gt; -W<br>
&gt;&gt;<br>
&gt;&gt; On 24/04/2012, thatz &lt;<a href="mailto:thomashatz@yahoo.com">thomashatz@yahoo.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Am new user to Drools, have 300+ rules, but need to<br>
&gt;&gt; query them using SQL<br>
&gt;&gt; &gt; syntax to create reports and analyze rules usage (if<br>
&gt;&gt; rules are being called,<br>
&gt;&gt; &gt; etc.).  App developer said cannot query the rules<br>
&gt;&gt; db directly because it is<br>
&gt;&gt; &gt; proprietary.  Is there anyway to query rules or<br>
&gt;&gt; what is best way to analyze<br>
&gt;&gt; &gt; rules usage.  Thanks<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; View this message in context:<br>
&gt;&gt; &gt; <a href="http://drools.46999.n3.nabble.com/How-to-query-rules-to-create-reports-to-analyze-usage-tp3934833p3934833.html" target="_blank">http://drools.46999.n3.nabble.com/How-to-query-rules-to-create-reports-to-analyze-usage-tp3934833p3934833.html</a><br>

&gt;&gt; &gt; Sent from the Drools: User forum mailing list archive<br>
&gt;&gt; at Nabble.com.<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>