如何在 MacOS Sierra 中查看時間機器日誌?

如何在 MacOS Sierra 中查看時間機器日誌?

在先前版本的 OSX 中,我能夠查看過去 Time Machine 備份作業的結果:

sudo syslog -F '$Time $Message' -k Sender com.apple.backupd

現在系統日誌不再是作業系統的一部分。它已被替換為“紀錄」。

我無法使用“找到有關時間機器作業的資訊”紀錄

有什麼建議麼?

答案1

macOS Sierra 使用統一日誌記錄(記憶體和資料儲存;不再有文字檔案)。

但是,使用該log(1)實用程序,您可以查看、過濾、操作等日誌。請參閱man log,這裡有幾個特定於 TimeMachine 的範例:

即時串流日誌(如tail):

log stream --style syslog --predicate 'senderImagePath contains[cd] "TimeMachine"' --info

不流式傳輸,僅顯示日誌並退出:

log show --style syslog --predicate 'senderImagePath contains[cd] "TimeMachine"' --info

答案2

我有類似的問題。我寫這個 shell 腳本是為了從日誌中顯示過去 12 小時的 Time Machine 活動,然後繼續即時追蹤日誌。

我稱之為tm-log

#!/bin/sh

filter='processImagePath contains "backupd" and subsystem beginswith "com.apple.TimeMachine"'

# show the last 12 hours
start="$(date -j -v-12H +'%Y-%m-%d %H:%M:%S')"

echo ""
echo "[History (from $start)]"
echo ""

log show --style syslog --info --start "$start" --predicate "$filter"

echo ""
echo "[Following]"
echo ""

log stream --style syslog --info --predicate "$filter"

答案3

對於那些希望在 GUI 控制台應用程式中即時查看 Time Machine 訊息的用戶,請在「操作」功能表中啟用「包含資訊訊息」。

然後,有用的 Time Machine 狀態訊息將會顯示,並且可以透過類似 的搜尋進行過濾Category:TMLogInfo

看起來log(1)需要查看歷史記錄,因為控制台在打開之前沒有顯示任何內容。

答案4

目前,我的解決方案是使用log stream --style syslog --predicate 'subsystem == "com.apple.TimeMachine"' --info.但我對此不太滿意,所以我仍在尋找更好的方法。

相關內容