@@ -443,15 +443,63 @@ func linuxLogs(execToPathFn func(outputFileName string, command string, args ...
443443 ),
444444 execToPathFn (
445445 "cloud-init.log" ,
446- "cat " , "/var/log/cloud-init.log" ,
446+ "sudo " , "sh" , "-c" , "if [ -f /var/log/cloud-init.log ]; then sudo cat /var/log/cloud-init.log; else echo 'cloud-init.log not found'; fi " ,
447447 ),
448448 execToPathFn (
449449 "cloud-init-output.log" ,
450- "cat" , "/var/log/cloud-init-output.log" ,
450+ "sudo" , "sh" , "-c" , "echo 'Waiting for cloud-init to complete before collecting output log...' && cloud-init status --wait && echo 'Cloud-init completed, collecting output log...' && if [ -f /var/log/cloud-init-output.log ]; then echo 'Found cloud-init-output.log, reading contents:' && sudo cat /var/log/cloud-init-output.log; else echo 'cloud-init-output.log not found after cloud-init completion'; fi" ,
451+ ),
452+ execToPathFn (
453+ "cloud-init-journal.log" ,
454+ "sudo" , "journalctl" , "--no-pager" , "--output=short-precise" , "-u" , "cloud-init" , "-u" , "cloud-config" , "-u" , "cloud-final" ,
455+ ),
456+ execToPathFn (
457+ "cloud-init-status.txt" ,
458+ "sudo" , "cloud-init" , "status" , "--long" ,
459+ ),
460+ execToPathFn (
461+ "cloud-init-all-logs.txt" ,
462+ "sudo" , "sh" , "-c" , "echo '=== cloud-init logs from journal ===' && journalctl --no-pager -u cloud-init-local -u cloud-init -u cloud-config -u cloud-final --output=short-precise && echo && echo '=== cloud-init result.json ===' && cat /run/cloud-init/result.json 2>/dev/null || echo 'result.json not found' && echo && echo '=== cloud-init instance-data.json ===' && cat /run/cloud-init/instance-data.json 2>/dev/null || echo 'instance-data.json not found'" ,
463+ ),
464+ execToPathFn (
465+ "cloud-init-file-details.txt" ,
466+ "sudo" , "sh" , "-c" , "echo '=== Cloud-init file existence and permissions ===' && echo 'Timestamp: '$(date) && echo 'Cloud-init status:' && cloud-init status && echo && echo 'Files in /var/log/ matching cloud-init*:' && ls -la /var/log/cloud-init* 2>/dev/null || echo 'No cloud-init files found in /var/log/' && echo && echo 'Files in /run/cloud-init/:' && ls -la /run/cloud-init/ 2>/dev/null || echo '/run/cloud-init/ not found' && echo && echo 'Checking for sentinel file:' && ls -la /run/cluster-api/ 2>/dev/null || echo '/run/cluster-api/ not found' && echo && echo 'SELinux context (if applicable):' && ls -laZ /var/log/cloud-init* 2>/dev/null || echo 'No SELinux or cloud-init files'" ,
467+ ),
468+ execToPathFn (
469+ "cloud-init-output-comprehensive.log" ,
470+ "sudo" , "sh" , "-c" , "echo '=== Comprehensive cloud-init output collection ===' && echo 'Method 1: Direct sudo cat:' && sudo cat /var/log/cloud-init-output.log" ,
471+ ),
472+ execToPathFn (
473+ "cloud-init-output-methods.log" ,
474+ "sudo" , "sh" , "-c" , "echo 'Method 2: sudo tail:' && sudo tail -n +1 /var/log/cloud-init-output.log && echo && echo 'Method 3: sudo dd:' && sudo dd if=/var/log/cloud-init-output.log 2>/dev/null && echo && echo 'Method 4: File readability test:' && sudo test -r /var/log/cloud-init-output.log && echo 'File readable with sudo' || echo 'File not readable with sudo'" ,
475+ ),
476+ execToPathFn (
477+ "cloud-init-userdata.log" ,
478+ "sudo" , "cloud-init" , "query" , "userdata" ,
451479 ),
452480 execToPathFn (
453481 "sentinel-file-dir.txt" ,
454- "ls" , "/run/cluster-api/" ,
482+ "ls" , "-la" , "/run/cluster-api/" ,
483+ ),
484+ execToPathFn (
485+ "var-log-dir.txt" ,
486+ "ls" , "-la" , "/var/log/" ,
487+ ),
488+ execToPathFn (
489+ "system-info.txt" ,
490+ "sudo" , "sh" , "-c" , "echo '=== OS Release ===' && cat /etc/os-release && echo && echo '=== Uptime ===' && uptime && echo && echo '=== Free memory ===' && free -h" ,
491+ ),
492+ execToPathFn (
493+ "dmesg.log" ,
494+ "sudo" , "dmesg" ,
495+ ),
496+ execToPathFn (
497+ "systemd-analyze.txt" ,
498+ "sudo" , "systemd-analyze" , "blame" ,
499+ ),
500+ execToPathFn (
501+ "cloud-init-run-dir.txt" ,
502+ "sudo" , "ls" , "-la" , "/run/cloud-init/" ,
455503 ),
456504 execToPathFn (
457505 "cni.log" ,
0 commit comments