summaryrefslogtreecommitdiff
path: root/hosts/ahmed/minecraft-log-server
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2025-02-06 18:22:32 +0100
committerLinnnus <[email protected]>2025-02-06 18:22:32 +0100
commit856a912ef70219a65f2f094a4983e51dcc9d771f (patch)
tree08762eaa8da0fa3154238bb5650c1bdbfe2ca99b /hosts/ahmed/minecraft-log-server
parent59ef6972778ef867b0bccf04efdfce38e8134d8d (diff)
ahmed/minecraft-log-server: Show more previous messages
Diffstat (limited to 'hosts/ahmed/minecraft-log-server')
-rw-r--r--hosts/ahmed/minecraft-log-server/minecraft_log_server.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/hosts/ahmed/minecraft-log-server/minecraft_log_server.py b/hosts/ahmed/minecraft-log-server/minecraft_log_server.py
index 30d295d..a676626 100644
--- a/hosts/ahmed/minecraft-log-server/minecraft_log_server.py
+++ b/hosts/ahmed/minecraft-log-server/minecraft_log_server.py
@@ -85,7 +85,6 @@ def get_log_entries(units, last_event_id = None) -> t.Generator[Event, None, Non
"/run/current-system/sw/bin/journalctl",
# We want a stream
"--follow",
- "--lines=20",
# A JSON line for each entry
"--output=json",
# Use UTC timestamps to avoid tricky timezone issues on the client
@@ -100,6 +99,10 @@ def get_log_entries(units, last_event_id = None) -> t.Generator[Event, None, Non
# If this is such a connection, we can avoid including duplicate entries by
# starting just after the given cursor.
args.append("--after-cursor=" + last_event_id)
+ else:
+ # Otherwise this the user has just opened the page and we should give
+ # them a bit of context for the next lines that appear
+ args.append("--lines=200")
try:
process = subprocess.Popen(args, stdout=subprocess.PIPE)