是否可以使用 siddhi 中的 json 映射删除封闭元素?

Is it posible to remove enclosing element using json mapping in siddhi?

我得到了 siddhi 的工作代码,我想知道它是否可以使用没有封闭元素的 json 格式输出事件。

我试过将 null enclosing.element 和 $. , 但其中 none 似乎有效。

@sink(type = 'file', file.uri = "/var/log/cert/output/{{name}}", 
    @map(type = 'json', fail.on.missing.attibute = "false",enclosing.element="$."))
define stream AlertStream (timestamp long, name string, ipsrc string, ipdst string, evento string, tipoAmenaza string, eventCategory string, severity string, network string, threatId string, eventTech string, eventArea string, urlOriginal string, eventID string, tag string);

我得到了以下结果

{"event":{"timestamp":1562232334157,"name":"client_name","ipsrc":"192.168.1.1","ipdst":"192.168.1.2","evento":"threat","tipoAmenaza":"file","eventCategory":"alert","severity":"medium","network":"192.168.0.0-192.168.255.255","threatId":"spyware","eventTech":"firewall","eventArea":"fwaas","urlOriginal":"undefined","eventID":"901e1155-5407-48ce-bddb-c7469fcf5c48","tag":"[Spyware-fwaas]"}}

预期输出是

{"timestamp":1562232334157,"name":"client_name","ipsrc":"192.168.1.1","ipdst":"192.168.1.2","evento":"threat","tipoAmenaza":"file","eventCategory":"alert","severity":"medium","network":"192.168.0.0-192.168.255.255","threatId":"spyware","eventTech":"firewall","eventArea":"fwaas","urlOriginal":"undefined","eventID":"901e1155-5407-48ce-bddb-c7469fcf5c48","tag":"[Spyware-fwaas]"}

您必须使用由@payload 注释促进的自定义映射。更多信息请参考https://siddhi-io.github.io/siddhi-map-json/api/5.0.2/#json-sink-mapper

@sink(type='inMemory', topic='{{symbol}}', 
     @map(type='json', 
         @payload( """{"StockData":{"Symbol":"{{symbol}}","Price":{{price}}}""")))
define stream BarStream (symbol string, price float, volume long);