summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorAnh Vo <anhvo@microsoft.com>2020-11-19 13:38:27 -0500
committerGitHub <noreply@github.com>2020-11-19 11:38:27 -0700
commit73e704e3690611625e3cda060a7a6a81492af9d2 (patch)
tree6e9849319a11ffd1ca5fa12192faa16816e30091 /cloudinit
parent9707a08a82161cd4129f6cdd10978cde50bea747 (diff)
downloadvyos-cloud-init-73e704e3690611625e3cda060a7a6a81492af9d2.tar.gz
vyos-cloud-init-73e704e3690611625e3cda060a7a6a81492af9d2.zip
DataSourceAzure: push dmesg log to KVP (#670)
Pushing dmesg log to KVP to help troubleshoot VM boot issues
Diffstat (limited to 'cloudinit')
-rwxr-xr-xcloudinit/sources/helpers/azure.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py
index 2b3303c7..d3055d08 100755
--- a/cloudinit/sources/helpers/azure.py
+++ b/cloudinit/sources/helpers/azure.py
@@ -224,7 +224,8 @@ def push_log_to_kvp(file_name=CFG_BUILTIN['def_log_file']):
based on the file size.
The first time this function is called after VM boot, It will push the last
n bytes of the log file such that n < MAX_LOG_TO_KVP_LENGTH
- If called again on the same boot, it continues from where it left off."""
+ If called again on the same boot, it continues from where it left off.
+ In addition to cloud-init.log, dmesg log will also be collected."""
start_index = get_last_log_byte_pushed_to_kvp_index()
@@ -245,6 +246,15 @@ def push_log_to_kvp(file_name=CFG_BUILTIN['def_log_file']):
"Exception when dumping log file: %s" % repr(ex),
logger_func=LOG.warning)
+ LOG.debug("Dumping dmesg log to KVP")
+ try:
+ out, _ = subp.subp(['dmesg'], decode=False, capture=True)
+ report_compressed_event("dmesg", out)
+ except Exception as ex:
+ report_diagnostic_event(
+ "Exception when dumping dmesg log: %s" % repr(ex),
+ logger_func=LOG.warning)
+
@azure_ds_telemetry_reporter
def get_last_log_byte_pushed_to_kvp_index():