mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
logrotate qemu monitor logs
This commit is contained in:
parent
1c9968a2b1
commit
54f4ed6ba1
@ -1,3 +1,11 @@
|
||||
Tue 9 Dez 2008 21:08:43 CET Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
logrotate qemu monitor logs
|
||||
* src/qemu_driver.c: open logfile O_APPEND instead of O_TRUNC when
|
||||
running as root
|
||||
* qemud/Makefile.am: install logrotate configuration (by Harald Sraub)
|
||||
and create logdir
|
||||
|
||||
Mon Dec 8 13:22:06 +0100 2008 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
virsh.c: tweak options to produce more accurate help
|
||||
|
@ -134,7 +134,8 @@ endif
|
||||
|
||||
|
||||
default_xml_dest = libvirt/qemu/networks/default.xml
|
||||
install-data-local: install-init install-data-sasl install-data-polkit
|
||||
install-data-local: install-init install-data-sasl install-data-polkit \
|
||||
install-logrotate
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart
|
||||
$(INSTALL_DATA) $(srcdir)/default-network.xml \
|
||||
$(DESTDIR)$(sysconfdir)/$(default_xml_dest)
|
||||
@ -198,6 +199,17 @@ remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl remote_protocol.x
|
||||
perl -w $(srcdir)/remote_generate_stubs.pl -r $(srcdir)/remote_protocol.x > $@
|
||||
|
||||
|
||||
libvirtd.logrotate: libvirtd.logrotate.in
|
||||
sed \
|
||||
-e s!\@localstatedir\@!@localstatedir@!g \
|
||||
< $< > $@-t
|
||||
mv $@-t $@
|
||||
|
||||
install-logrotate: libvirtd.logrotate
|
||||
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
|
||||
$(INSTALL_DATA) $< $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
|
||||
|
||||
if LIBVIRT_INIT_SCRIPTS_RED_HAT
|
||||
install-init: libvirtd.init
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
|
||||
|
8
qemud/libvirtd.logrotate.in
Normal file
8
qemud/libvirtd.logrotate.in
Normal file
@ -0,0 +1,8 @@
|
||||
@localstatedir@/log/libvirt/qemu/*.log {
|
||||
daily
|
||||
missingok
|
||||
rotate 7
|
||||
compress
|
||||
delaycompress
|
||||
copytruncate
|
||||
}
|
@ -841,6 +841,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
unsigned int qemuCmdFlags;
|
||||
fd_set keepfd;
|
||||
const char *emulator;
|
||||
uid_t uid = geteuid();
|
||||
mode_t logmode;
|
||||
|
||||
FD_ZERO(&keepfd);
|
||||
|
||||
@ -884,8 +886,12 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
|
||||
S_IRUSR | S_IWUSR)) < 0) {
|
||||
logmode = O_CREAT | O_WRONLY;
|
||||
if (uid != 0)
|
||||
logmode |= O_TRUNC;
|
||||
else
|
||||
logmode |= O_APPEND;
|
||||
if ((vm->logfile = open(logfile, logmode, S_IRUSR | S_IWUSR)) < 0) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to create logfile %s: %s"),
|
||||
logfile, strerror(errno));
|
||||
|
Loading…
Reference in New Issue
Block a user