Skip to contentSkip to conversation

rsyslog: fix configuration file for logrotate

PATCH In review [email protected] 2 participants 6 messages Aug 3, 2018 – Aug 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rsyslog: fix configuration file for logrotate

From: Chen Qi <[email protected]>

The logrotate.rsyslog file uses 'cat /var/run/rsyslogd.pid' to determine the pid of rsyslogd daemon. This is incorrect, because rsyslogd may start in a way that does not create rsyslog.pid file.

Failing to send HUP signal to rsyslogd daemon will result in unexpected behaviour. e.g. rsyslogd is writing to /var/log/messages-xxxx instead of /var/log/messages.

We should really use pkill to send HUP signal to rsyslogd to ensure correct behaviour.

---
 meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate | 4 ++--
 meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb         | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate +2 -2
index 94ec517..5f8568f 100644
@@ -9,7 +9,7 @@
         delaycompress
         compress
         postrotate
-		/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+		@BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
 
@@ -34,6 +34,6 @@
         delaycompress
         sharedscripts
         postrotate
-		/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+		@BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -0
index 9737892..d90695a 100644
@@ -125,6 +125,7 @@ do_install_append() {
     install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+    sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
 }
 
 FILES_${PN} += "${bindir}"
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 rsyslog: add PACKAGECONFIG for imjournal

From: Chen Qi <[email protected]>

Add PACKAGECONFIG for imjournal, and add corresponding configuration to /etc/rsyslog.conf when it's enabled. Default to disable it.

---
 meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +5 -0
index d90695a..1bcbde1 100644
@@ -67,6 +67,7 @@ PACKAGECONFIG[imfile] = "--enable-imfile,--disable-imfile,,"
 PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp,"
 PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
 PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
+PACKAGECONFIG[imjournal] = "--enable-imjournal,--disable-imjournal,"
 PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,"
 PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
 PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"
@@ -126,6 +127,10 @@ do_install_append() {
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
     sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+
+    if ${@bb.utils.contains('PACKAGECONFIG', 'imjournal', 'true', 'false', d)}; then
+        echo '$ModLoad imjournal' >> ${D}${sysconfdir}/rsyslog.conf
+    fi
 }
 
 FILES_${PN} += "${bindir}"
Signature · 1 line
1.9.1
#2 lore raw

Re: [meta-oe][PATCH 2/2] rsyslog: add PACKAGECONFIG for imjournal

Quoted 24 lines · On Fri, Aug 3, 2018 at 3:03 AM <[email protected]> wrote:

From: Chen Qi <[email protected]>

Add PACKAGECONFIG for imjournal, and add corresponding configuration to /etc/rsyslog.conf when it's enabled. Default to disable it.

---
 meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -0
index d90695a..1bcbde1 100644
@@ -67,6 +67,7 @@ PACKAGECONFIG[imfile] = "--enable-imfile,--disable-imfile,,"
 PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp,"
 PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
 PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
+PACKAGECONFIG[imjournal] = "--enable-imjournal,--disable-imjournal,"
 PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,"
 PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
 PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"

meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb do_install_append() { · line 133

Quoted 7 lines
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +4 -0
@@ -126,6 +127,10 @@ do_install_append() {
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
     sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+
+    if ${@bb.utils.contains('PACKAGECONFIG', 'imjournal', 'true', 'false', d)}; then
+        echo '$ModLoad imjournal' >> ${D}${sysconfdir}/rsyslog.conf
+    fi

perhaps its time to add something like

$IncludeConfig /etc/rsyslog.d/*.conf

in main etc/rsyslog.conf and then such fragments can be places as individual config
files inside that directory

Quoted 11 lines
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +0 -1
 }
 
 FILES_${PN} += "${bindir}"
--

1.9.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#3 lore raw

Re: [meta-oe][PATCH 2/2] rsyslog: add PACKAGECONFIG for imjournal

Quoted 33 lines · Khem Raj
Quoted 23 lines · On Fri, Aug 3, 2018 at 3:03 AM <[email protected]> wrote:

From: Chen Qi <[email protected]>

Add PACKAGECONFIG for imjournal, and add corresponding configuration to /etc/rsyslog.conf when it's enabled. Default to disable it.

---
  meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb | 5 +++++
  1 file changed, 5 insertions(+)
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -0
index d90695a..1bcbde1 100644
@@ -67,6 +67,7 @@ PACKAGECONFIG[imfile] = "--enable-imfile,--disable-imfile,,"
  PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp,"
  PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
  PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
+PACKAGECONFIG[imjournal] = "--enable-imjournal,--disable-imjournal,"
  PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,"
  PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
  PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"

meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb do_install_append() { · line 133

Quoted 7 lines
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +4 -0
@@ -126,6 +127,10 @@ do_install_append() {
      install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
      install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
      sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+
+    if ${@bb.utils.contains('PACKAGECONFIG', 'imjournal', 'true', 'false', d)}; then
+        echo '$ModLoad imjournal' >> ${D}${sysconfdir}/rsyslog.conf
+    fi

perhaps its time to add something like

Quoted 5 lines

$IncludeConfig /etc/rsyslog.d/*.conf

in main etc/rsyslog.conf and then such fragments can be places as individual config
files inside that directory

I agree. I'll send out V2.

Best Regards,
Chen Qi

Quoted 11 lines
Quoted 11 lines
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +0 -1
  }
 
  FILES_${PN} += "${bindir}"
--

1.9.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw
In reply to [email protected]

is this patch any different from last posted patch ?

https://patchwork.openembedded.org/patch/153125/

If not then there is no need to resend, if yes then please describe the change and mark
patch as v2, v3 and so on. Save some time for reviewers

Quoted 61 lines · On Fri, Aug 3, 2018 at 3:02 AM <[email protected]> wrote:

From: Chen Qi <[email protected]>

The logrotate.rsyslog file uses 'cat /var/run/rsyslogd.pid' to determine the pid of rsyslogd daemon. This is incorrect, because rsyslogd may start in a way that does not create rsyslog.pid file.

Failing to send HUP signal to rsyslogd daemon will result in unexpected behaviour. e.g. rsyslogd is writing to /var/log/messages-xxxx instead of /var/log/messages.

We should really use pkill to send HUP signal to rsyslogd to ensure correct behaviour.

---
 meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate | 4 ++--
 meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb         | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate +2 -2
index 94ec517..5f8568f 100644
@@ -9,7 +9,7 @@
         delaycompress
         compress
         postrotate
-               /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+               @BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
 
@@ -34,6 +34,6 @@
         delaycompress
         sharedscripts
         postrotate
-               /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+               @BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
         endscript
 }
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -1
index 9737892..d90695a 100644
@@ -125,6 +125,7 @@ do_install_append() {
     install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+    sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
 }
 
 FILES_${PN} += "${bindir}"
--

1.9.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#5 lore raw
Quoted 3 lines · Khem Raj

is this patch any different from last posted patch ?

https://patchwork.openembedded.org/patch/153125/

There's is no difference.
I sent it out again because the second patch also modifies the do_install function and I thought if I send them out together, it will be more convenient.

Best Regards,
Chen Qi

Quoted 64 lines

If not then there is no need to resend, if yes then please describe the change and mark
patch as v2, v3 and so on. Save some time for reviewers

Quoted 60 lines · On Fri, Aug 3, 2018 at 3:02 AM <[email protected]> wrote:

From: Chen Qi <[email protected]>

The logrotate.rsyslog file uses 'cat /var/run/rsyslogd.pid' to determine the pid of rsyslogd daemon. This is incorrect, because rsyslogd may start in a way that does not create rsyslog.pid file.

Failing to send HUP signal to rsyslogd daemon will result in unexpected behaviour. e.g. rsyslogd is writing to /var/log/messages-xxxx instead of /var/log/messages.

We should really use pkill to send HUP signal to rsyslogd to ensure correct behaviour.

---
  meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate | 4 ++--
  meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb         | 1 +
  2 files changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog/rsyslog.logrotate +2 -2
index 94ec517..5f8568f 100644
@@ -9,7 +9,7 @@
          delaycompress
          compress
          postrotate
-               /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+               @BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
          endscript
  }
 
@@ -34,6 +34,6 @@
          delaycompress
          sharedscripts
          postrotate
-               /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
+               @BINDIR@/pkill -HUP rsyslogd 2> /dev/null || true
          endscript
  }
meta-oe/recipes-extended/rsyslog/rsyslog_8.36.0.bb +1 -1
index 9737892..d90695a 100644
@@ -125,6 +125,7 @@ do_install_append() {
      install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
      install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
      install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
+    sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
  }
 
  FILES_${PN} += "${bindir}"
--

1.9.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel