Tim Cooke

Saving journalctl logs to a file

30th July 2020

On Linux when you run an application as a service, the logs are available to view using the journalctl command. For example, I'm running and instance of Orthanc - DICOM Server as a service and to access the logs I use the following:

$ journalctl -u orthanc

I'm actually only interested in something that happened since yesterday so I can use the --since option

$ journalctl --since yesterday -u orthanc

I'd like to save the logs into a file for further analysis. Turns out it's as simple as piping to a file.

$ journalctl --since yesterday -u orthanc > orthanc.log

Much easier than I was expecting.