Skip to content

Commit

Permalink
v1.8.3 (#75)
Browse files Browse the repository at this point in the history
v1.8.3
  • Loading branch information
MikeSchiessl authored Sep 23, 2024
1 parent e7cd15c commit f283ff0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARG EXT_DIR="$ULS_DIR/ext"
ARG ETP_CLI_VERSION="0.4.8"
ARG EAA_CLI_VERSION="0.6.10"
ARG MFA_CLI_VERSION="0.1.1"
ARG GC_CLI_VERSION="v0.0.5"
ARG GC_CLI_VERSION="v0.0.6"
ARG LINODE_CLI_VERSION="dev"
ARG ACC_CLI_VERSION="v0.0.1-alpha"

Expand Down
23 changes: 13 additions & 10 deletions bin/uls.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,15 @@ def main():
cliformat=uls_args.cliformat,
transformationpattern=uls_args.transformationpattern)

filter_escaped = uls_args.filter.replace('"', '\\"') if uls_args.filter else None
# Prepare the Filter
if uls_args.filter:
try:
aka_log.log.info(f"FILTER pattern has been specified: "
f"{uls_args.filter} - will only output matches")
f"{filter_escaped} - will only output matches")
filter_pattern = re.compile(uls_args.filter.encode())
except Exception as my_error:
aka_log.log.critical(f"Error in filter patter {uls_args.filter}"
aka_log.log.critical(f"Error in filter pattern {filter_escaped}"
f" (exiting). Error: {my_error}")
sys.exit(1)
else:
Expand Down Expand Up @@ -192,11 +193,12 @@ def main():
try:
input_data = event_q.get(block=True, timeout=0.05)
if uls_args.debugloglines:
aka_log.log.debug(f"<IN> {input_data}")
escaped_data = input_data.decode('utf-8').replace('"', '\\"')
aka_log.log.debug(f"<IN> {escaped_data}")
for log_line in input_data.splitlines():

log_line_escaped = log_line.decode('utf-8').replace('"', '\\"')
# Write checkpoint to the checkpoint file (if autoresume is enabled) (not after transformation or filter)

if uls_args.autoresume and int(my_monitor.get_message_count()) >= autoresume_lastwrite + uls_args.autoresumewriteafter:
aka_log.log.info(f"WRITING AUTORESUME CHECKPOINT - curr_message_count={int(my_monitor.get_message_count())} - last_write = {autoresume_lastwrite}")
UlsTools.write_autoresume_ckpt(uls_args.input,
Expand All @@ -208,16 +210,17 @@ def main():

# Filter Enhancement
if uls_args.filter and not filter_pattern.match(log_line):
aka_log.log.info(f"SKIPPED LINE due to FILTER rule {uls_args.filter}")
aka_log.log.info(f"SKIPPED LINE due to FILTER rule {filter_escaped}")
aka_log.log.debug(f"SKIPPED the following LOG_LINE "
f"due to FILTER match: {log_line}")
f"due to FILTER match: {log_line_escaped}")
continue

# Transformation Enhancement
if uls_args.transformation:
log_line = my_transformer.transform(log_line)
log_line_escaped = log_line.decode('utf-8').replace('"', '\\"')
aka_log.log.debug(f"Transformed Logline via "
f"({uls_args.transformation}): {log_line}")
f"({uls_args.transformation}): {log_line_escaped}")

# Attach Linebreak
#out_data = log_line + uls_config.output_line_breaker.encode()
Expand All @@ -235,21 +238,21 @@ def main():
resend_status = my_output.send_data(log_line)
my_monitor.increase_message_count(len(log_line))
if uls_args.debugloglines:
aka_log.log.debug(f"<OUT> {log_line}")
aka_log.log.debug(f"<OUT> {log_line_escaped}")
resend_counter = resend_counter + 1

if resend_counter == uls_config.main_resend_attempts and\
uls_config.main_resend_exit_on_fail:
aka_log.log.critical(f"MSG[{my_monitor.get_message_count()}] "
f"ULS was not able to deliver the log message "
f"{log_line.decode()} after {resend_counter} attempts - Exiting!")
f"{log_line_escaped} after {resend_counter} attempts - Exiting!")
sys.exit(1)
elif resend_counter == uls_config.main_resend_attempts and \
not uls_config.main_resend_exit_on_fail:
aka_log.log.warning(
f"MSG[{my_monitor.get_message_count()}] "
f"ULS was not able to deliver the log message "
f"{log_line.decode()} after {resend_counter} attempts - (continuing anyway as my config says)")
f"{log_line_escaped} after {resend_counter} attempts - (continuing anyway as my config says)")
except queue.Empty:
# No data available, we get a chance to capture the StopEvent
pass
Expand Down
2 changes: 1 addition & 1 deletion bin/uls_config/global_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
# Common global variables / constants
__version__ = "1.8.2"
__version__ = "1.8.3"
__tool_name_long__ = "Akamai Unified Log Streamer"
__tool_name_short__ = "ULS"

Expand Down
17 changes: 16 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# Version History

## v1.8.3
| | |
|--------|---------------------|
| Date | 2024-09-23 |
| Kind | MINOR release |
| Author | [email protected] |

- **Minor improvements**
- [docker] bumped CLI-GC version to 0.0.6

- **Bugfixes**
- Improved JSON Log Escaping (massive thx to @sethumadhav07 for the privded PR)

---

## v1.8.2
| | |
|--------|---------------------|
| Date | 2024-XX-XX |
| Date | 2024-09-11 |
| Kind | MINOR release |
| Author | [email protected] |

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/kubernetes/helm/akamai-uls/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: Akamai Universal Log Streamer Helm installation

type: application
version: 2.0.0
appVersion: "1.8.2"
appVersion: "1.8.3"

0 comments on commit f283ff0

Please sign in to comment.