From b4ba582255d403811b134c75d5bdcc9aa91976d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 31 Aug 2020 12:51:24 +0300 Subject: [PATCH] Docs: add the "Viewing cron logs using journalctl" section --- templates/docs/monitoring_cron_jobs.html | 16 ++++++++++++++++ templates/docs/monitoring_cron_jobs.md | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/templates/docs/monitoring_cron_jobs.html b/templates/docs/monitoring_cron_jobs.html index 72e5bbd7..9672de60 100644 --- a/templates/docs/monitoring_cron_jobs.html +++ b/templates/docs/monitoring_cron_jobs.html @@ -79,6 +79,9 @@ Transient error is a timeout or an HTTP 5xx response code.
Redirect curl's stdout to /dev/null (error messages still go to stderr).

Looking up Your Machine's Time Zone

+

If your cron job consistently pings SITE_NAME an hour early or an hour late, +the likely cause is a timezone mismatch: your machine may be using a different timezone +than what is configured on SITE_NAME.

On modern GNU/Linux systems, you can look up the time zone using the timedatectl status command and looking for "Time zone" in its output:

$ timedatectl status
@@ -90,4 +93,17 @@ Transient error is a timeout or an HTTP 5xx response code.
 System clock synchronized: yes
               NTP service: active
           RTC in local TZ: no
+
+ + +

Viewing cron logs using journalctl

+

On a systemd-based system, you can use the journalctl utility to see system logs, +including logs from the cron daemon.

+

To see live logs:

+
journalctl -f
+
+ + +

To see logs from e.g. the last hour, and only from the cron daemon:

+
journalctl --since "1 hour ago" -t CRON
 
\ No newline at end of file diff --git a/templates/docs/monitoring_cron_jobs.md b/templates/docs/monitoring_cron_jobs.md index cf8d017a..2d3abb91 100644 --- a/templates/docs/monitoring_cron_jobs.md +++ b/templates/docs/monitoring_cron_jobs.md @@ -85,6 +85,10 @@ suit your needs. ## Looking up Your Machine's Time Zone +If your cron job consistently pings SITE_NAME an hour early or an hour late, +the likely cause is a timezone mismatch: your machine may be using a different timezone +than what is configured on SITE_NAME. + On modern GNU/Linux systems, you can look up the time zone using the `timedatectl status` command and looking for "Time zone" in its output: @@ -99,3 +103,20 @@ System clock synchronized: yes NTP service: active RTC in local TZ: no ``` + +## Viewing cron logs using `journalctl` + +On a systemd-based system, you can use the `journalctl` utility to see system logs, +including logs from the cron daemon. + +To see live logs: + +```bash +journalctl -f +``` + +To see logs from e.g. the last hour, and only from the cron daemon: + +```bash +journalctl --since "1 hour ago" -t CRON +```