Hacker News new | ask | show | jobs
by dharmab 1334 days ago
Here's an excerpt from my cheat sheet:

    # Output all logs since boot
    journalctl
    # Follow all logs in real time
    journalctl -f
    # Output logs for a given systemd unit
    journalctl -u $unit
    # Combine follow and unit flags to follow logs for a given systemd unit
    # Easy to remember: You are saying F*** U to a broken piece of software
    journalctl -fu $unit
    # Output kernel logs
    journalctl -k
    # Follow kernel logs
    journalctl -fk

    # Tip: Use -b flag to see logs from previous boot cycles

    # Learn more, including advanced filtering and formatting
    man journalctl
You can also add that configtest command as an ExecStartPre to the unit, and it will run that before starting nginx and optionally fail early if it finds an error.
2 comments

You forgot:

    # Easy to remember: You are saying F**K because your kernel is broken
    journalctl -fk
Thank You