我使用Esper來生成基於esper查詢的警報消息。Esper警報查詢不觸發
我使用Map作爲java對象來綁定所有的日誌消息,並且在外部esper config xml文件中定義,如下所示。
<?xml version="1.0" encoding="UTF-8"?>
<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.espertech.com/schema/esper"
xsi:schemaLocation="http://www.espertech.com/schema/esper
http://www.espertech.com/schema/esper/esper-configuration-2.0.xsd">
<!-- <event-type name="StockTick" class="com.espertech.esper.example.stockticker.event.StockTick"/>
<event-type name="PriceLimit" class="com.espertech.esper.example.stockticker.event.PriceLimit"/>
<auto-import import-name="org.mycompany.mypackage.MyUtility"/>
<auto-import import-name="org.mycompany.util.*"/> -->
<event-type name="b2cAccessLogEvent">
<java-util-map>
<map-property name="request" class="string"/>
<map-property name="response" class="int"/>
<map-property name="type" class="string"/>
<map-property name="dc" class="int"/>
<map-property name="message" class="string"/>
<map-property name="source" class="string"/>
<map-property name="source_host" class="string"/>
<map-property name="source_path" class="string"/>
<map-property name="agent" class="string"/>
<map-property name="duration" class="string"/>
<map-property name="@timestamp" class="string"/>
</java-util-map>
</event-type>
</esper-configuration>
我正在閱讀隊列中的日誌消息。我對事件觸發的要求如下: 1.如果類型=「b2c_access」的日誌消息中的響應字段爲= 302,並且在1分鐘內具有此響應代碼的日誌消息的計數大於10,則觸發一個事件。
我有以下EPL
select * from b2cAccessLogEvent(type="b2c_access").win:time(1 minute) having response = 302 and dc like "%s%" and count(request) > 10.
但eventhough日誌消息包含10倍以上的消息是時間跨度的事件不會被解僱,也沒有任何異常的2分鐘。所以我試圖讓EPL簡單如下。
select * from b2cAccessLogEvent(type="b2c_access").win:time(1 minute) having response = 302
上面這個查詢仍然沒有被解僱。
我無法在Esper官方網站上找到任何與我所尋找的相匹配的例子。
有人可以幫我解決這個問題。
感謝 Shantanooķ