2020/8/14

systemd 看 log, 還有 service 的 echo output

ref:Ultimate Guide to Logging

systemd 啟動得 service,值行的 script,其中有 echo 的,都 echo 到 journald 裡。
所以要把 journald 打開。
/etc/systemd/journald.conf
其中,第一個 config option:
[Journal]
Storage=auto
...
可以選...
  • “none” :
    This effectively turns off journaling. Any log message received will be dropped. However, any redirection to console, syslog, or kernel log buffer would still be in effect.
  • “volatile” :
    Journal data is saved in memory and temporarily available under the /run/log/journal directory. The directory will be created if it does not exist.
  • “persistent” :
    Journal data is saved persistently on disk under the /var/log/journal directory. The directory will be created if it does not exist. If the disk volume is not accessible or writable, the files will be created under /run/log/journal.
  • “auto” :
    The storage mode is like persistent—data will be written to disk; however, if the /var/log/journal directory does not exist, it will be created under /run/log/journal.
journald 存的是壓縮檔(?),所以不能直接 cat,要用journalctl 來看..

沒有留言:

張貼留言