<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Events filtering]]></title><description><![CDATA[<p dir="auto">Good Morning.</p>
<p dir="auto">We are trying to capture the following events through the mango REST API through its 'events-rest-controller' interface:</p>
<p dir="auto"><img src="https://camo.nodebb.org/dc87f25ff67cda4c3a9561dc6a1d8a9a9e8cfdfe?url=https%3A%2F%2Fi.imgur.com%2FeRDe5v3.png" alt="0_1552662737839_eventos.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">We have done tests with the endpoint '/v1/events', with which we have been able to capture the events.</p>
<p dir="auto"><img src="https://camo.nodebb.org/7c16b9cef936851d97738ad1bc82108f6580a78a?url=https%3A%2F%2Fi.imgur.com%2FZMKXIDm.png" alt="0_1552662801382_EventsQuery.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">We have also been able to capture executing several types of filters for this endpoint.</p>
<p dir="auto">This, for example, is a query to the endpoint to filter by 'acknowledged':</p>
<p dir="auto"><img src="https://camo.nodebb.org/1da52a51e27a14704e23abbc0e3c13e4c5c735d0?url=https%3A%2F%2Fi.imgur.com%2FPtIZoHk.png" alt="0_1552662855324_EventsQueryFilter1.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">This one is for filtering by 'active':</p>
<p dir="auto"><img src="https://camo.nodebb.org/279a55e07c2a90968d0cb49d0537925e5c4fde11?url=https%3A%2F%2Fi.imgur.com%2FMWdRhGl.png" alt="0_1552662896722_EventsQueryFilter2.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">And this last is to filter by 'alarmLevel':</p>
<p dir="auto"><img src="https://camo.nodebb.org/4c1e75562ee26303fa64e1758db0fbb3e473d0b3?url=https%3A%2F%2Fi.imgur.com%2FwFfVIem.png" alt="0_1552662953751_EventsQueryFilter3.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">But when we try to filter by 'message', it does not show us any results, even though the filter has the same coincidence with the three events:</p>
<p dir="auto"><img src="https://camo.nodebb.org/e03728101f2d7d0797b2b3313c851a953cabcfde?url=https%3A%2F%2Fi.imgur.com%2F07QBnIR.png" alt="0_1552663006866_EventsQueryFilter4.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">We tried to consult the endpoint '/v1/events/module-defined-query' but we do not understand it, and we have always had errors in the way we fill the body.</p>
<p dir="auto">What we want to know is:</p>
<ol>
<li>
<p dir="auto">How to filter events by message.</p>
</li>
<li>
<p dir="auto">How the endpoint '/v1/events/module-defined-query' works. We have already consulted the endpoint '/v1/events/explain-module-defined-queries', but we still do not understand it.</p>
</li>
<li>
<p dir="auto">We also are trying with '/v1/events/query'. If you can supply us information about this endpoint, it would be helpful.</p>
</li>
</ol>
<p dir="auto">Beforehand thank you very much.</p>
]]></description><link>https://forum.mango-os.com/topic/4104/events-filtering</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 11:23:42 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4104.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Mar 2019 15:16:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Events filtering on Mon, 18 Mar 2019 15:42:58 GMT]]></title><description><![CDATA[<p dir="auto">Sorry yes I forgot to add the column name to the arguments. Glad you sorted it out.</p>
]]></description><link>https://forum.mango-os.com/post/21548</link><guid isPermaLink="true">https://forum.mango-os.com/post/21548</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Mon, 18 Mar 2019 15:42:58 GMT</pubDate></item><item><title><![CDATA[Reply to Events filtering on Fri, 15 Mar 2019 20:53:05 GMT]]></title><description><![CDATA[<p dir="auto">Ok, we found the right way to send the body:</p>
<pre><code>{
  "name":"and",
  "arguments":[
    {
      "name":"eq",
      "arguments":[
        "active",true
      ]
    },
    {
      "name":"like",
      "arguments":[
        "message","*fallaPCI*"
      ]
    }
  ]
}
</code></pre>
<p dir="auto">Doing the body this way, responds a 200 (ok) with the body:</p>
<pre><code>{
    "items": [
        {
            "eventType": {
                "dataSourceId": 652,
                "dataPointId": 13948,
                "pointEventDetectorId": 194,
                "duplicateHandling": 2,
                "eventType": "DATA_POINT",
                "eventSubtype": null,
                "referenceId1": 13948,
                "referenceId2": 194,
                "systemMessage": false,
                "rateLimited": false,
                "publisherId": -1
            },
            "message": "fallaPCI",
            "id": 105235,
            "active": true,
            "status": "",
            "alarmLevel": "CRITICAL",
            "activeTimestamp": 1552682510905,
            "acknowledged": false,
            "comments": null,
            "acknowledgedTimestamp": 0,
            "acknowledgedByUserId": 0,
            "acknowledgedByUsername": null,
            "acknowledgedMessage": null,
            "returnToNormalTimestamp": 0
        }
    ],
    "total": 1
}
</code></pre>
<p dir="auto">We solved all of the doubts. Thank you very much!!!</p>
]]></description><link>https://forum.mango-os.com/post/21545</link><guid isPermaLink="true">https://forum.mango-os.com/post/21545</guid><dc:creator><![CDATA[Johautt]]></dc:creator><pubDate>Fri, 15 Mar 2019 20:53:05 GMT</pubDate></item><item><title><![CDATA[Reply to Events filtering on Fri, 15 Mar 2019 20:03:50 GMT]]></title><description><![CDATA[<p dir="auto">We tried with both bodies you provided, but returns a 500 error with this body:</p>
<pre><code>{
    "cause": "IndexOutOfBoundsException: Index: 1, Size: 1",
    "mangoStatusCode": -1,
    "mangoStatusName": null,
    "localizedMessage": "Internal Server Error"
}
</code></pre>
]]></description><link>https://forum.mango-os.com/post/21544</link><guid isPermaLink="true">https://forum.mango-os.com/post/21544</guid><dc:creator><![CDATA[Johautt]]></dc:creator><pubDate>Fri, 15 Mar 2019 20:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Events filtering on Fri, 15 Mar 2019 19:37:55 GMT]]></title><description><![CDATA[<p dir="auto">I believe the body will be something simply like</p>
<pre><code>{
  "name": "eq",
  "arguments": ["common.default|fallaPCI|"]
}
</code></pre>
<p dir="auto">You can do more complex queries like</p>
<pre><code>{
  "name":"or",
  "arguments":[
    {
      "name":"eq",
      "arguments":[
        "common.default|fallaPCI|"
      ]
    },
    {
      "name":"like",
      "arguments":[
        "common.default*"
      ]
    }
  ]
}
</code></pre>
]]></description><link>https://forum.mango-os.com/post/21543</link><guid isPermaLink="true">https://forum.mango-os.com/post/21543</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Fri, 15 Mar 2019 19:37:55 GMT</pubDate></item><item><title><![CDATA[Reply to Events filtering on Fri, 15 Mar 2019 19:18:01 GMT]]></title><description><![CDATA[<p dir="auto">Ok <a class="plugin-mentions-user plugin-mentions-a" href="/user/jared-wiltshire" aria-label="Profile: Jared-Wiltshire">@<bdi>Jared-Wiltshire</bdi></a>, thank you very much!!! Now we know how to send the 'message' filter in the endpoint '/v1/events'. In fact, the SQL console answer in the field 'MESSAGE' was 'common.default|fallaPCI|'.</p>
<p dir="auto">But we also want to implement the POST endpoint '/v1/events/query'. We are using this body (in this case to see which events are active):</p>
<pre><code>{
  "arguments": [
    {"active": true}
  ],
  "argumentsSize": 1,
  "name": "string",
  "nameValid": true,
  "rootNode": true
}
</code></pre>
<p dir="auto">But it returns a status 500 (Server Error) with this body:</p>
<pre><code>{
    "cause": "RQLToSQLParseException: Unsupported operation: string",
    "mangoStatusCode": -1,
    "mangoStatusName": null,
    "localizedMessage": "Internal Server Error"
}
</code></pre>
<p dir="auto">Can you give us an example of how to use this endpoint?</p>
]]></description><link>https://forum.mango-os.com/post/21542</link><guid isPermaLink="true">https://forum.mango-os.com/post/21542</guid><dc:creator><![CDATA[Johautt]]></dc:creator><pubDate>Fri, 15 Mar 2019 19:18:01 GMT</pubDate></item><item><title><![CDATA[Reply to Events filtering on Fri, 15 Mar 2019 16:29:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johautt" aria-label="Profile: johautt">@<bdi>johautt</bdi></a> said in <a href="/post/21537">Events filtering</a>:</p>
<blockquote>
<p dir="auto">But when we try to filter by 'message', it does not show us any results, even though the filter has the same coincidence with the three events:</p>
</blockquote>
<p dir="auto">The reason for this is that the message is not stored in the SQL database as a plain string, it is stored as a translatable key with arguments. Try running <code>SELECT * FROM EVENTS ORDER BY ACTIVETS DESC LIMIT 10;</code> from the SQL console to see what I mean. You can filter on it but your query will have to match the format in the DB, try using the RQL <code>like</code> operator. e.g. <code>/rest/v1/events?message=like=event.detector.lowLimitPeriod*&amp;sort(-activeTimestamp)&amp;limit(10,0)</code></p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johautt" aria-label="Profile: johautt">@<bdi>johautt</bdi></a> said in <a href="/post/21537">Events filtering</a>:</p>
<blockquote>
<p dir="auto">How the endpoint '/v1/events/module-defined-query' works.</p>
</blockquote>
<p dir="auto">Honestly I'm not sure myself. I don't think it is what you what. <a class="plugin-mentions-user plugin-mentions-a" href="/user/terrypacker" aria-label="Profile: terrypacker">@<bdi>terrypacker</bdi></a> might be able to help.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johautt" aria-label="Profile: johautt">@<bdi>johautt</bdi></a> said in <a href="/post/21537">Events filtering</a>:</p>
<blockquote>
<p dir="auto">We also are trying with '/v1/events/query'.</p>
</blockquote>
<p dir="auto">This is the same as RQL query endpoint but it is a POST endpoint that takes a JSON query object in the body instead of query parameters in the URL.</p>
]]></description><link>https://forum.mango-os.com/post/21539</link><guid isPermaLink="true">https://forum.mango-os.com/post/21539</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Fri, 15 Mar 2019 16:29:54 GMT</pubDate></item></channel></rss>