upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/how-to/migration-scripts/30-extract-parse-failures.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docs/how-to/migration-scripts/30-extract-parse-failures.sh')
-rwxr-xr-xdocs/how-to/migration-scripts/30-extract-parse-failures.sh29
1 files changed, 27 insertions, 2 deletions
diff --git a/docs/how-to/migration-scripts/30-extract-parse-failures.sh b/docs/how-to/migration-scripts/30-extract-parse-failures.sh
index 410fcbc..d4f0ff2 100755
--- a/docs/how-to/migration-scripts/30-extract-parse-failures.sh
+++ b/docs/how-to/migration-scripts/30-extract-parse-failures.sh
@@ -236,6 +236,19 @@ main() {
236 exit 1 236 exit 1
237 fi 237 fi
238 238
239 # Validate service exists (check if journalctl can find any logs for it)
240 # Note: We don't require the service to be running, just that it has logs
241 if ! journalctl --no-pager -u "$service" -n 1 &>/dev/null; then
242 log_warn "Could not query logs for service: $service"
243 log_warn "This may indicate the service doesn't exist or you lack permissions."
244 log_warn ""
245 log_warn "To list available ngit-grasp services:"
246 log_warn " systemctl list-units 'ngit-grasp*' --all"
247 log_warn " journalctl --list-boots # Check if you have journal access"
248 log_warn ""
249 # Continue anyway - the service might exist but have no logs yet
250 fi
251
239 # Build journalctl command 252 # Build journalctl command
240 local journal_cmd="journalctl -u $service --no-pager -o short-iso" 253 local journal_cmd="journalctl -u $service --no-pager -o short-iso"
241 254
@@ -280,8 +293,20 @@ main() {
280 log_info "Extracting log entries..." 293 log_info "Extracting log entries..."
281 294
282 # Get raw log lines containing [PARSE_FAIL] 295 # Get raw log lines containing [PARSE_FAIL]
283 local raw_lines 296 # Capture stderr separately to detect journalctl errors
284 raw_lines=$(eval "$journal_cmd" 2>/dev/null | grep '\[PARSE_FAIL\]' || true) 297 local raw_lines journal_stderr journal_exit
298 local temp_stderr
299 temp_stderr=$(mktemp)
300
301 raw_lines=$(eval "$journal_cmd" 2>"$temp_stderr" | grep '\[PARSE_FAIL\]' || true)
302 journal_exit=$?
303 journal_stderr=$(cat "$temp_stderr" 2>/dev/null || true)
304 rm -f "$temp_stderr"
305
306 # Report any journalctl errors (but don't fail - empty logs are valid)
307 if [[ -n "$journal_stderr" ]]; then
308 log_warn "journalctl reported: $journal_stderr"
309 fi
285 310
286 if [[ -z "$raw_lines" ]]; then 311 if [[ -z "$raw_lines" ]]; then
287 log_warn "No [PARSE_FAIL] entries found in logs." 312 log_warn "No [PARSE_FAIL] entries found in logs."