From fdfec20273f69d87412b03be066e8f041c0c2beb Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Wed, 27 Nov 2024 23:42:49 -0800 Subject: [PATCH 1/2] Ignore GetLogPage error message --- readjson.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readjson.go b/readjson.go index e163dcb..0658c3a 100644 --- a/readjson.go +++ b/readjson.go @@ -154,6 +154,12 @@ func jsonIsOk(logger *slog.Logger, json gjson.Result) bool { if messages.Exists() { for _, message := range messages.Array() { if message.Get("severity").String() == "error" { + // if the string contains "GetLogPage failed", then ignore it + // this is a known issue with Apple internal SSDs + if strings.Contains(message.Get("string").String(), "GetLogPage failed") { + logger.Warn("Ignoring GetLogPage failed error", "device", json.Get("device.name").String(), "message", message.Get("string").String()) + continue + } logger.Error(message.Get("string").String()) return false } From 525776295455b2b35c5c4b21b3b22bca4811a4b5 Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Wed, 27 Nov 2024 23:43:17 -0800 Subject: [PATCH 2/2] Return the entire input string if cannot extract device name --- smartctl.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smartctl.go b/smartctl.go index 472cd01..5d5a936 100644 --- a/smartctl.go +++ b/smartctl.go @@ -63,7 +63,9 @@ func extractDiskName(input string) string { return strings.Join(name, "_") } - return "" + + // If the regex doesn't match, return the entire input string + return input } // NewSMARTctl is smartctl constructor