mtools icon indicating copy to clipboard operation
mtools copied to clipboard

Add support for Enterprise log redaction

Open stennie opened this issue 2 years ago • 0 comments

The Log Redaction feature in MongoDB Enterprise (3.4+) redacts messages associated with any given log event before logging, leaving only metadata, source files, or line numbers related to the event.

Values replaced with ### placeholders are not expected by mtools' log parsing (as at 1.7.0) and will cause unhandled exceptions, eg:

Traceback (most recent call last):
 File “/usr/local/lib/python3.9/site-packages/mtools/util/logevent.py”, line 833, in _extract_counters
  vars(self)[‘_’ + counter] = int((token.split(‘:’)
ValueError: invalid literal for int() with base 10: ‘’
​
During handling of the above exception, another exception occurred:
​
Traceback (most recent call last):
 File “/usr/local/bin/mloginfo”, line 8, in <module>
  sys.exit(main())
 File “/usr/local/lib/python3.9/site-packages/mtools/mloginfo/mloginfo.py”, line 112, in main
  tool.run()
 File “/usr/local/lib/python3.9/site-packages/mtools/mloginfo/mloginfo.py”, line 107, in run
  section.run()
 File “/usr/local/lib/python3.9/site-packages/mtools/mloginfo/sections/query_section.py”, line 92, in run
  allowDiskUse=le.allowDiskUse)
 File “/usr/local/lib/python3.9/site-packages/mtools/util/logevent.py”, line 678, in allowDiskUse
  self._extract_counters()
 File “/usr/local/lib/python3.9/site-packages/mtools/util/logevent.py”, line 884, in _extract_counters
  self._txnNumber = int((split_tokens[t + 1 + self.datetime_nextpos + 2]).replace(‘,’, ‘’))
ValueError: invalid literal for int() with base 10: ‘“###“’

stennie avatar Mar 22 '22 07:03 stennie