>From: Josh Wilsdon [mailto:jwils...@joyent.com] >Sent: 星期三, 四月 12, 2017 0:25 >To: smartos-discuss@lists.smartos.org >Subject: Re: [smartos-discuss] rotate-kvm-log
>Yes. But "/usr/vm/sbin/rotate-kvm-logs.sh script" won't add entries in >"/var/logadm/timestamps" like following: >"/zones/c3f09892-f36e-4784-9853-b4ceb3e762da/root/tmp/vm.log -P 'Wed Jan 4 >05:20:15 2017'" >The weirdness is how this type of entry has been added per every kvm instance? >Fred, >That's exactly what the entries look like that come from running >rotate-kvm-logs.sh. What evidence do you have that it's not that script? When >I manually ran rotate-kvm-logs.sh without any cron involved, it just generated >an entry: >/zones/3d93a436-3a86-4406-ae69-fbaaf67b45b7/root/tmp/vm.log -P 'Tue Apr 11 >16:20:40 2017' Josh, I think I see exactly the same issue (https://github.com/joyent/smartos-live/issues/319). The reason why I haven't got the concerning entry is lines from #36 to #38 of the source (https://github.com/joyent/smartos-live/blob/64998c0b5a7c33287eb7dd118fef4aea42e5a6f3/src/vm/sbin/rotate-kvm-logs.sh#L36) -- " if [[ ! -s ${logfile} ]]; then # file doesn't exist or is empty return; fi ". Because all my ${logfile} has size of 0, rotate_log() returns. And the script won't go to lines from #72 to #78(https://github.com/joyent/smartos-live/blob/64998c0b5a7c33287eb7dd118fef4aea42e5a6f3/src/vm/sbin/rotate-kvm-logs.sh#L72) -- " logadm \ -c \ -s 1b \ -p now \ -t '$dirname/vm.log.rotating' \ -R "cat \$file >> ${destfile} && rm -f \$file" \ ${logfile} " Plus, I also notice that there is logadm invocation during "vmadm create" in lines from #625 to #641 of source (https://github.com/joyent/smartos-live/blob/64998c0b5a7c33287eb7dd118fef4aea42e5a6f3/src/vm/sbin/vmadmd.js#L625) -- " unction rotateKVMLog(vm_uuid) { setTimeout(function () { execFile('/usr/vm/sbin/rotate-kvm-logs.sh', [vm_uuid], function (error, stdout, stderr) { if (error) { log.error({err: error, stdout: stdout, stderr: stderr}, 'failed to rotate kvm log for just-booted ' + vm_uuid); return; } log.debug({stdout: stdout, stderr: stderr}, 'rotated kvm log ' + 'for just-booted ' + vm_uuid); return; } ); }, 30 * 1000); } " Thanks. Fred ------------------------------------------- smartos-discuss Archives: https://www.listbox.com/member/archive/184463/=now RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00 Modify Your Subscription: https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb Powered by Listbox: http://www.listbox.com