{"action":"closed","issue":{"url":"https://api.github.com/repos/Yelp/elastalert/issues/1309","repository_url":"https://api.github.com/repos/Yelp/elastalert","labels_url":"https://api.github.com/repos/Yelp/elastalert/issues/1309/labels{/name}","comments_url":"https://api.github.com/repos/Yelp/elastalert/issues/1309/comments","events_url":"https://api.github.com/repos/Yelp/elastalert/issues/1309/events","html_url":"https://github.com/Yelp/elastalert/issues/1309","id":253344795,"number":1309,"title":"DropMatchException for Sunday","user":{"login":"fyayc-ire","id":30406370,"avatar_url":"https://avatars0.githubusercontent.com/u/30406370?v=4","gravatar_id":"","url":"https://api.github.com/users/fyayc-ire","html_url":"https://github.com/fyayc-ire","followers_url":"https://api.github.com/users/fyayc-ire/followers","following_url":"https://api.github.com/users/fyayc-ire/following{/other_user}","gists_url":"https://api.github.com/users/fyayc-ire/gists{/gist_id}","starred_url":"https://api.github.com/users/fyayc-ire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fyayc-ire/subscriptions","organizations_url":"https://api.github.com/users/fyayc-ire/orgs","repos_url":"https://api.github.com/users/fyayc-ire/repos","events_url":"https://api.github.com/users/fyayc-ire/events{/privacy}","received_events_url":"https://api.github.com/users/fyayc-ire/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-28T14:22:31Z","updated_at":"2018-03-19T11:02:11Z","closed_at":"2018-03-19T11:02:11Z","author_association":"NONE","body":"Hi, I have a DropMatchException between midnight to 6AM:\r\n\r\n```\r\nfrom elastalert.enhancements import BaseEnhancement, DropMatchException\r\nimport datetime\r\nimport time\r\nimport sys\r\n\r\ndef datetime_from_utc_to_local(utc_datetime):\r\n    now_timestamp = time.time()\r\n    offset = datetime.datetime.fromtimestamp(now_timestamp) - datetime.datetime.utcfromtimestamp(now_timestamp)\r\n    return utc_datetime + offset\r\n\r\nclass DropFrom00To06(BaseEnhancement):\r\n    def process(self, match):\r\n        dateformat = \"%Y-%m-%dT%H:%M:%S\"\r\n        exceptional_dateformat = \"%Y-%m-%dT%H:%M:%SZ\"\r\n        timestamp = match['@timestamp'].split(\".\")[0]\r\n        try:\r\n            timestamp = datetime.datetime.strptime(timestamp, dateformat)\r\n        except ValueError:\r\n            timestamp = datetime.datetime.strptime(timestamp, exceptional_dateformat)\r\n        except:\r\n            print(\"Unexpected error:\", sys.exc_info()[0])\r\n            raise\r\n        timestamp = datetime_from_utc_to_local(timestamp)\r\n        timePart = timestamp.time()\r\n        if timePart >= datetime.time(00, 00) and timePart <= datetime.time(8, 00):\r\n            raise DropMatchException()\r\n```\r\n\r\nHow can I  add an exception for Sunday that raise DropMatchException from midnight to 10AM?\r\n\r\nI have to add something like\r\n\r\n```\r\nd = timestamp.date()\r\ndayOfTheWeek = d.weekday()\r\nif dayOfTheWeek == 6 and timePart >= datetime.time(00, 00) and timePart <= datetime.time(10, 00):\r\n    raise DropMatchException()\r\n```\r\n\r\n????"}}
{"actor":{"display_login":"fyayc-ire"}}