]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal-gatewayd: make num_entries in Range header optional again
authorJan Čermák <sairon@sairon.cz>
Wed, 18 Jun 2025 15:32:49 +0000 (17:32 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Jun 2025 17:08:03 +0000 (02:08 +0900)
commita2015ad126e82a06d726af6a17b540435f7210dc
tree298b8e13ccc95b91ca09be4a205606117ebda299
parentda993edcf71707f304c0fa1342bc32e3285f5f0e
journal-gatewayd: make num_entries in Range header optional again

Since 435c372ce5059082212d37ac7039844f14f34a80 added in v256,
num_entries part of the Range header is mandatory and error is returned
when it's not filled in. This makes using the "follow" argument clumsy,
because for an indefinite following of the logs, arbitrary high number
must be specified. This change makes it possible to omit it again and
documents this behavior in the man page.

Moreover, as the cursor part of the header was never mandatory, enclose
it in square brackets in the documentation as well and elaborate how
indexing works.

Following are some concrete examples of the Range header which are now
accepted:

 entries= (or entries=:)
  - everything starting from the first event

 entries=cursor
  - everything starting from `cursor`

 entries=:-9:10
  - last 10 events and close the connection

If the follow flag is set:

 entries=:-4:10
  - last 5 events, wait for 5 new and close connection

 entries=:-9:
  - last 10 events and keep streaming

Note that only the very last one is changing current behavior, but
reintroduces pre-v256 compatibility.

Fixes #37172
man/systemd-journal-gatewayd.service.xml
src/journal-remote/journal-gatewayd.c
test/units/TEST-04-JOURNAL.journal-gatewayd.sh