instance-scheduler-on-aws
instance-scheduler-on-aws copied to clipboard
Group by warring/error message to a single SNS event & a SNS event for successful stop start recourse
Hi,
I am using the instance scheduler for managing ec2 recourses on around 2x aws accounts, for some cause the ec2 is not tagged as it is not require for stop/start and the function will return a warning say "schedule name "1111"/"0000" is unknown" and send out a email by each warning message. so every hour I will receive around 4xx email for the warning message.
Is that possible to group by the warning message in a one email and also add the event after successful stop start?
@aMfM9E2 You can choose to update the logger.py
file to write some filter conditions based on your requirement.
def warning(self, msg, *args):
"""
Logs warning message
:param msg: Warning message format string
:param args: parameters
:return:
"""
s = self._emit(LOG_LEVEL_WARNING, msg, *args)
#Update the code here to filter out message(s) based on a format.
self.publish_to_sns("Warning", s)
Apart from making the above change, there is no workaround for aggregating similar type of warning messages, I will add a new feature in the backlog to be prioritized for a future release.
@gockle , thanks for the reply, that perfect if in the future can provide difference logging level for sns like successful list, warning list etc... instance scheduler is a very cool solution for cross account operation, can't wait for next release and more new functions