Skip to content

Commit

Permalink
Limit log query result size (#26)
Browse files Browse the repository at this point in the history
Set a max number of records returned by Loki to avoid leaking memory.

Refs NethServer/dev#6978
  • Loading branch information
DavidePrincipi authored Sep 12, 2024
1 parent d4a6ae5 commit 891a8f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imageroot/bin/cloud-log-manager-forwarder
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ logs_list = []
while True:
try:
# LogCLI command
logcli_command = ["logcli", "query", "--limit", "0", "--forward", "--timezone", "UTC", "--from", last_timestamp, "--no-labels", "-q", "-o", "jsonl",
logcli_command = ["logcli", "query", "--limit", "2000", "--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, timeout=300)

Expand Down

0 comments on commit 891a8f9

Please sign in to comment.