Last Updated: January 21, 2017
·
381
· phaus

delete logadm configurations for deleted kvm VMs

sometime you the a warning from logadm like this one:

logadm: Warning: /zones/b3a4a0c2-34da-e595-be7d-a192a730518e/root/tmp/vm.log: No such file or directory

The problem is, that logadm tries to log events for a KVM VM that was already deleted.
You can cleanup the config with this one-liner:

for l in $(logadm -V | awk '/zones/ {print $1}'); do v=$(echo $l |  awk -F/ '{print $3}'); \
exist=$(vmadm lookup uuid=$v); [[ -z "$exist" ]] && logadm -r $l; done