Skip to content

Commit

Permalink
Fix log follow mode
Browse files Browse the repository at this point in the history
When using a range with an explicit num_entries systemd-journal-gatewayd
will not contiue even when the follow parameter is passed.

Fixes an issue introduced with #5334.
  • Loading branch information
agners committed Oct 11, 2024
1 parent 180a7c3 commit 941c16a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions supervisor/api/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ async def advanced_logs_handler(
# return 2 lines at minimum.
lines = max(2, lines)
# entries=cursor[[:num_skip]:num_entries]
range_header = f"entries=:-{lines-1}:{lines}"
range_header = f"entries=:-{lines-1}:{"" if follow else lines}"
elif RANGE in request.headers:
range_header = request.headers.get(RANGE)
else:
range_header = f"entries=:-{DEFAULT_LINES-1}:{DEFAULT_LINES}"
range_header = f"entries=:-{DEFAULT_LINES-1}:{"" if follow else DEFAULT_LINES}"

async with self.sys_host.logs.journald_logs(
params=params, range_header=range_header, accept=LogFormat.JOURNAL
Expand Down

0 comments on commit 941c16a

Please sign in to comment.