Skip to content

limit_execution: delayed notifications #1681

Answered by mkondratev
mkondratev asked this question in Q&A
Discussion options

You must be logged in to vote

Enhancements:

import datetime

from croniter import croniter
from elastalert.enhancements import BaseEnhancement, DropMatchException


class LimitExecutionEnhancement(BaseEnhancement):
    def process(self, match):
        limit = self.rule.get('limit_execution')
        if not limit:
            return

        ts = match.get('@timestamp')
        if not ts:
            return

        event_time = datetime.datetime.fromisoformat(ts.replace("Z", "+00:00"))

        if not croniter.match(limit, event_time):
            raise DropMatchException()

Replies: 4 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jertel
Comment options

@nsano-rururu
Comment options

Comment options

You must be logged in to vote
8 replies
@mkondratev
Comment options

@jertel
Comment options

@mkondratev
Comment options

@jertel
Comment options

@mkondratev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mkondratev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants