Skip to content

Commit

Permalink
Resources leak bug fix (#15)
Browse files Browse the repository at this point in the history
NethServer/dev#6978

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Davide Principi <[email protected]>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent 40c186f commit 3b5ad89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ container=$(buildah from scratch)
buildah add "${container}" imageroot /imageroot
buildah add "${container}" ui /ui
buildah config --entrypoint=/ \
--label="org.nethserver.images=docker.io/traefik:v2.4 docker.io/grafana/loki:2.2.1" \
--label="org.nethserver.images=docker.io/traefik:v2.11.6 docker.io/grafana/loki:2.7.5" \
--label="org.nethserver.tcp-ports-demand=1" \
--label='org.nethserver.flags=core_module' \
"${container}"
Expand Down
5 changes: 4 additions & 1 deletion imageroot/bin/cloud-log-manager-forwarder
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ while True:
# LogCLI command
logcli_command = ["logcli", "query", "--limit", "0", "--forward", "--timezone", "UTC", "--from", last_timestamp, "--no-labels", "-q", "-o", "jsonl",
'{node_id=~".+"} | json identifier="SYSLOG_IDENTIFIER", priority="PRIORITY", message="MESSAGE" | line_format "<{{.priority}}> [{{.node_id}}:{{.module_id}}:{{.identifier}}]: {{.message}}"']
response = subprocess.run(logcli_command, capture_output=True, text=True)
response = subprocess.run(logcli_command, capture_output=True, text=True, timeout=300)

last_timestamp_changed = False

Expand Down Expand Up @@ -134,6 +134,9 @@ while True:
with open("./cloud_log_manager_last_timestamp", "w") as tf:
tf.write(last_timestamp)

except subprocess.TimeoutExpired:
print(f"Timeout exception raised on logcli command execution !", file=sys.stderr)
pass
except Exception as exc:
print(f"Error during loop: {exc}", file=sys.stderr)
pass
Expand Down
2 changes: 2 additions & 0 deletions imageroot/loki-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ingester:
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled
wal:
dir: "/tmp/wal"

schema_config:
configs:
Expand Down

0 comments on commit 3b5ad89

Please sign in to comment.