@@ -443,15 +443,55 @@ func linuxLogs(execToPathFn func(outputFileName string, command string, args ...
443
443
),
444
444
execToPathFn (
445
445
"cloud-init.log" ,
446
- "cat " , "/var/log/cloud-init.log" ,
446
+ "sudo " , "sh" , "-c" , "if [ -f /var/log/cloud-init.log ]; then cat /var/log/cloud-init.log; else echo 'cloud-init.log not found'; fi " ,
447
447
),
448
448
execToPathFn (
449
449
"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:' && 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 'Attempting multiple methods to read cloud-init-output.log...' && echo && echo 'Method 1: Direct cat of /var/log/cloud-init-output.log:' && cat /var/log/cloud-init-output.log 2>&1 && echo && echo 'Method 2: Using tail on cloud-init-output.log:' && tail -n +1 /var/log/cloud-init-output.log 2>&1 && echo && echo 'Method 3: Reading with dd:' && dd if=/var/log/cloud-init-output.log 2>/dev/null || echo 'dd failed' && echo && echo 'Method 4: File info and access test:' && test -r /var/log/cloud-init-output.log && echo 'File is readable' || echo 'File is not readable' && echo && echo 'Method 5: Cloud-init show all output:' && cloud-init query userdata 2>/dev/null || echo 'userdata query failed'" ,
451
471
),
452
472
execToPathFn (
453
473
"sentinel-file-dir.txt" ,
454
- "ls" , "/run/cluster-api/" ,
474
+ "ls" , "-la" , "/run/cluster-api/" ,
475
+ ),
476
+ execToPathFn (
477
+ "var-log-dir.txt" ,
478
+ "ls" , "-la" , "/var/log/" ,
479
+ ),
480
+ execToPathFn (
481
+ "system-info.txt" ,
482
+ "sudo" , "sh" , "-c" , "echo '=== OS Release ===' && cat /etc/os-release && echo && echo '=== Uptime ===' && uptime && echo && echo '=== Free memory ===' && free -h" ,
483
+ ),
484
+ execToPathFn (
485
+ "dmesg.log" ,
486
+ "sudo" , "dmesg" ,
487
+ ),
488
+ execToPathFn (
489
+ "systemd-analyze.txt" ,
490
+ "sudo" , "systemd-analyze" , "blame" ,
491
+ ),
492
+ execToPathFn (
493
+ "cloud-init-run-dir.txt" ,
494
+ "sudo" , "ls" , "-la" , "/run/cloud-init/" ,
455
495
),
456
496
execToPathFn (
457
497
"cni.log" ,
0 commit comments