Skip to content

Commit

Permalink
v1.6.5 (#39)
Browse files Browse the repository at this point in the history
## v1.6.5
|||
|---|---|
|Date|2023-07-28
|Kind| Minor release
|Author|mschiess@akamai.com
- **Minor improvements**
  - Allow manipulation of the [TCP & UDP output format](ARGUMENTS_ENV_VARS.md#list-of-parameters--environmental-variables) (--tcpudpformat / ULS_TCPUDP_FORMAT).
  - [docker] bumped source image to 3.11.4-slim-bookworm (new debian release)
  • Loading branch information
MikeSchiessl authored Jun 28, 2023
1 parent a847786 commit c406560
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.3-slim-bullseye
FROM python:3.11.4-slim-bookworm
LABEL MAINTAINER="Mike Schiessl - mike.schiessl@akamai.com"
LABEL APP_LONG="Akamai Universal Log Streamer"
LABEL APP_SHORT="ULS"
Expand Down
2 changes: 1 addition & 1 deletion bin/config/global_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

# Common global variables / constants
__version__ = "1.6.4"
__version__ = "1.6.5"
__tool_name_long__ = "Akamai Unified Log Streamer"
__tool_name_short__ = "ULS"

Expand Down
9 changes: 9 additions & 0 deletions bin/modules/UlsArgsParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ def init():
default=int(os.environ.get('ULS_OUTPUT_PORT') or '0' ),
help="Port for TCP/UDP")

## TCP/UDP FORMAT DEFINITION
output_group.add_argument('--tcpudpformat',
action='store',
type=str,
default=(os.environ.get('ULS_TCPUDP_FORMAT') or '%s'),
help='TCP UDP Message format expected by the receiver '
'(%%s defines the data string). Default \'%%s\'')


# HTTP
## HTTP URL
output_group.add_argument('--httpurl',
Expand Down
15 changes: 13 additions & 2 deletions bin/modules/UlsOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class UlsOutput:
def __init__(self, output_type: str,
host=None,
port=None,
tcpudp_out_format='%s',
http_out_format=None,
http_out_aggregate_count=None,
http_out_auth_header=None,
Expand Down Expand Up @@ -76,6 +77,7 @@ def __init__(self, output_type: str,
self.httpSession = None
self.port = None
self.host = None
self.tcpudp_out_format = None
self.clientSocket = None
self.stopEvent = stopEvent

Expand All @@ -92,6 +94,13 @@ def __init__(self, output_type: str,
if self.output_type in ['TCP', 'UDP'] and host and port:
self.host = host
self.port = port
if "%s" in tcpudp_out_format:
self.tcpudp_out_format = tcpudp_out_format
else:
aka_log.log.critical(
f"{self.name} The given TCP_UDP_OUT_FORMAT does not contain %s identifier:"
f"given ULS_TCPUDP_FORMAT: {tcpudp_out_format} - exiting")
sys.exit(1)
elif self.output_type in ['TCP', 'UDP'] and (not host or not port):
aka_log.log.critical(f"{self.name} - Host or Port has not "
f"been set Host: {host} Port: {port} - exiting")
Expand Down Expand Up @@ -392,11 +401,13 @@ def send_data(self, data):
aka_log.log.debug(f"{self.name} Trying to send data via {self.output_type}")

if self.output_type == "TCP":
out_data = data + uls_config.output_line_breaker.encode()
send_data = bytes(self.tcpudp_out_format, 'utf-8') % data
out_data = send_data + uls_config.output_line_breaker.encode()
self.clientSocket.sendall(out_data)

elif self.output_type == "UDP":
out_data = data + uls_config.output_line_breaker.encode()
send_data = bytes(self.tcpudp_out_format, 'utf-8') % data
out_data = send_data + uls_config.output_line_breaker.encode()
self.clientSocket.sendto(out_data, (self.host, self.port))

elif self.output_type == "HTTP":
Expand Down
1 change: 1 addition & 0 deletions bin/uls.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def main():
my_output = UlsOutput.UlsOutput(output_type=uls_args.output,
host=uls_args.host,
port=uls_args.port,
tcpudp_out_format=uls_args.tcpudpformat,
http_out_format=uls_args.httpformat,
http_out_auth_header=uls_args.httpauthheader,
http_out_aggregate_count=uls_args.httpaggregate,
Expand Down
44 changes: 23 additions & 21 deletions docs/ARGUMENTS_ENV_VARS.md

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Version History

## v1.6.5
|||
|---|---|
|Date|2023-07-28
|Kind| Minor release
|Author|mschiess@akamai.com
- **Minor improvements**
- Allow manipulation of the [TCP & UDP output format](ARGUMENTS_ENV_VARS.md#list-of-parameters--environmental-variables) (--tcpudpformat / ULS_TCPUDP_FORMAT).
- [docker] bumped source image to 3.11.4-slim-bookworm (new debian release)

## v1.6.4
|||
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/kubernetes/helm/akamai-uls/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: akamai-uls
description: Akamai Universal Log Streamer Helm installation

type: application
version: 1.6.4
appVersion: "1.6.4"
version: 1.6.5
appVersion: "1.6.5"

0 comments on commit c406560

Please sign in to comment.