Skip to content

Commit

Permalink
Limit log query result size
Browse files Browse the repository at this point in the history
Set a max number of records returned by Loki to avoid leaking memory.
  • Loading branch information
DavidePrincipi committed Sep 11, 2024
1 parent d4a6ae5 commit b5c940d
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 b5c940d

Please sign in to comment.