Skip to content

Commit

Permalink
Merge pull request #335 from airbnb/ryandeivert-log-suppression-addition
Browse files Browse the repository at this point in the history
[cli] adding suppression for firehose log messages
  • Loading branch information
ryandeivert authored Oct 2, 2017
2 parents c011f10 + da0d77d commit 3cf6951
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions stream_alert_cli/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from fnmatch import fnmatch
import logging
import logging.handlers

Expand All @@ -29,13 +30,17 @@ class SuppressNoise(logging.Filter):
"""

def filter(self, record):
suppress_starts_with = (
'Starting download from S3',
'Completed download in'
suppressed_messages = (
'Starting download from S3*',
'Completed download in*',
'*triggered an alert on log type*',
'Successfully sent * messages to Firehose*'
)

message = record.getMessage()

return (
not record.getMessage().startswith(suppress_starts_with) and
'triggered an alert on log type' not in record.getMessage()
not any(fnmatch(message, suppression) for suppression in suppressed_messages)
)


Expand Down

0 comments on commit 3cf6951

Please sign in to comment.