Skip to content

Commit

Permalink
Be tolerant of apama-ctrl logs with the double-space after "[correlat…
Browse files Browse the repository at this point in the history
…or] " changed to a single space, which some processing tools can do.
  • Loading branch information
ben-spiller committed Aug 9, 2022
1 parent 924d6c4 commit 78e45bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
3.9 (in development)
--------------------
Enhancements:
- Be tolerant of apama-ctrl logs with the double-space after "[correlator] " changed to a single space, which some
processing tools can do.

Bug fixes:

Expand Down
9 changes: 8 additions & 1 deletion apamax/log_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,17 @@ def __init__(self, line, lineno):
if firstchar == '[': # probably apama ctrl
iscorrelator = line.startswith( '[correlator] ')
if not iscorrelator:
isapamactrl = line.startswith('[apama-ctrl] ')
isapamactrl = line.startswith( '[apama-ctrl] ')
if iscorrelator or isapamactrl:
self.line = line = line[14:]
if len(line)>0: firstchar = line[0]
else: # have once seen a log that came through Logstash that had one of these spaces removed (implemented like this to avoid compromising performance for common case)
iscorrelator = line.startswith( '[correlator] ')
if not iscorrelator:
isapamactrl = line.startswith( '[apama-ctrl] ')
if iscorrelator or isapamactrl:
self.line = line = line[13:].lstrip()
if len(line)>0: firstchar = line[0]

# do minimal parsing by default to keep speed high for messages we don't care about - just separate message from prefix
i = line.find(' - ')
Expand Down

0 comments on commit 78e45bb

Please sign in to comment.