Hello Everyone,
I am trying to get IP-address that is been used to register more that 2 users and flag the IP as anomolous.
I tried to do "aggs" by grouping by IPaddress with the "array_compare" condition.
Once the condition is met on some of my array values, I need the related action to take only those values and not all of them for reporting purposes.
Condition:
"condition": {
"array_compare": {
"ctx.payload.aggregations.group_by_ip.buckets": {
"path": "doc_count",
"gte": {
"value": 2,
"quantifier": "some"
}
}
}
}
Here is my action:
"actions": {
"email_administrator": {
"email": {
"profile": "standard",
"from": "'****'",
"priority": "high",
"to": [
"'***'"
],
"subject": "Model - Encountered Multiple SUR - Successful User Registration",
"body": {
"text": "The IP [{{#ctx.payload.aggregations.group_by_ip.buckets}}{{key}} {{/ctx.payload.aggregations.group_by_ip.buckets}}] spiked usage with [{{#ctx.payload.aggregations.group_by_ip.buckets}}{{doc_count}} {{/ctx.payload.aggregations.group_by_ip.buckets}}]"
}
}
}
}
I see from other posts that I need to do script transform that does this filtering. Can anyone please provide me sample of how to do that?
Appreciate your help!
Thanks!
SV