Skip to content

Commit

Permalink
Add log_invalid_line option (Fix shinken-monitoring#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lermit committed Apr 9, 2015
1 parent 4944bfb commit 8b46691
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions etc/modules/logstore_mongodb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ define module {
#database
#collection
#max_logs_age

# Uncoment next line in order to display "This line is invalid" log line.
#log_invalid_line 1
}
4 changes: 3 additions & 1 deletion module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def __init__(self, modconf):
elif maxmatch.group(2) == 'y':
self.max_logs_age = int(maxmatch.group(1)) * 365
self.use_aggressive_sql = (getattr(modconf, 'use_aggressive_sql', '1') == '1')
self.log_invalid_line = to_bool(getattr(modconf, 'log_invalid_line', 'False'))
# This stack is used to create a full-blown select-statement
self.mongo_filter_stack = LiveStatusMongoStack()
# This stack is used to create a minimal select-statement which
Expand Down Expand Up @@ -243,7 +244,8 @@ def manage_log_brok(self, b):
logger.error("[LogStoreMongoDB] Databased error occurred: %s" % exp)
# FIXME need access to this #self.livestatus.count_event('log_message')
else:
logger.info("[LogStoreMongoDB] This line is invalid: %s" % line)
if self.log_invalid_line:
logger.info("[LogStoreMongoDB] This line is invalid: %s" % line)


def add_filter(self, operator, attribute, reference):
Expand Down

0 comments on commit 8b46691

Please sign in to comment.