Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated procedure to identify an invalid Siddhi policy

Problem Statement:

    Eagle Topology failed to Start if it finds invalid Policy.


Identifying an invalid query (Siddhi)

AlertDefinitionAPIEntity class is used to define policy.

From the request payload, the policyDef tag contains the values of the type of the policy and the actual policy (given in bold below)

 

[{
“tags”: {
“site”: “sandbox”,
“dataSource”: “hdfsAuditLog”,
“policyId”: “testPolicy”,
“alertExecutorId”: “hdfsAuditLogAlertExecutor”,
“policyType”: “siddhiCEPEngine”
},
“desc”: “test alert policy”,
“policyDef”: “{"type":"siddhiCEPEngine","expression":"from hdfsAuditLogEventStream[src ==’/tmp/private’] select * insert into outputStream;"}”,
“notificationDef”: “[{
“sender”:”noreply-eagle@company.com”,
“recipients”:”user@company.com”,
“subject”:”test alert policy”,
“flavor”:”email”,
“id”:”email_1”
}]”,
“enabled”: true
}]


From the HBaseStorage class, whenever a request comes in to persisted Policy details (request under the service name AlertDefinitionService), we could put a check on the query to see whether it is valid syntax WRT to Siddhi. This can be achieved using the parseQuery method of the SiddhiCompiler. Based on the output, we can add another field, say queryCompiled and yet another field for error message if the query is not compiled.