Skip to contentSkip to conversation

syslog/syslog-lib.sh: support systemd journal

PATCH In review Jeffrey Bastian 2 participants 12 messages Jul 8, 2015 – Jul 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald. Copy the imjournal lines from the system's /etc/rsyslog.conf if they exist.

---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -0
index ef33517aa92b..4a6514a3114e 100755
@@ -72,8 +72,10 @@ setup()
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
 		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
+		systemd_journal=$(grep -hoi "^[^#].*imjournal.*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
 		RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
+$systemd_journal
 $log_socket
 EOF
 )
Signature · 12 lines
1.9.4

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

----- Original Message -----

Quoted 7 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Wednesday, 8 July, 2015 9:41:14 PM
Subject: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald.

According to:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-interaction_of_rsyslog_and_journal.html

there are 2 ways rsyslog can get messages:
1) By default, rsyslogd uses the imjournal module as a default input mode for journal files.
2) As an alternative, configure rsyslogd to read from the socket provided by journal as an output for syslog-based applications. The path to the socket is /run/systemd/journal/syslog. $SystemLogSocketName /run/systemd/journal/syslog

Is 2) no longer supported?

Regards,
Jan

Quoted 29 lines

Copy the imjournal lines from the system's
/etc/rsyslog.conf if they exist.

---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -0
index ef33517aa92b..4a6514a3114e 100755
@@ -72,8 +72,10 @@ setup()
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
 		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf
 		/etc/rsyslog.d/ | head -1)
+		systemd_journal=$(grep -hoi "^[^#].*imjournal.*" -r /etc/rsyslog.conf
 /etc/rsyslog.d/)
 		RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
+$systemd_journal
 $log_socket

EOF
)
--
1.9.4

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

----- Original Message -----

Quoted 30 lines

From: "Jan Stancek" <[email protected]>
To: "Jeffrey Bastian" <[email protected]>
Cc: [email protected]
Sent: Thursday, 9 July, 2015 8:59:58 AM
Subject: Re: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

----- Original Message -----

Quoted 7 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Wednesday, 8 July, 2015 9:41:14 PM
Subject: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald.

According to:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-interaction_of_rsyslog_and_journal.html

there are 2 ways rsyslog can get messages:
1) By default, rsyslogd uses the imjournal module as a default input mode for journal files.
2) As an alternative, configure rsyslogd to read from the socket provided by journal as an output for syslog-based applications. The path to the socket is /run/systemd/journal/syslog.
$SystemLogSocketName /run/systemd/journal/syslog

Quoted 1 line

Is 2) no longer supported?

It still appears supported, but turned off by default in systemd 216:

CHANGES WITH 216:
+ * journald will no longer forward all local data to another

+          running syslog daemon. This change has been made because
+          rsyslog (which appears to be the most commonly used syslog
+          implementation these days) no longer makes use of this, and
+          instead pulls the data out of the journal on its own. Since
+          forwarding the messages to a non-existant syslog server is
+          more expensive than we assumed we have now turned this
+          off. If you run a syslog server that is not a recent rsyslog
+          version, you have to turn this option on again
+          (ForwardToSyslog= in journald.conf).

So I think we should use imjournal if possible, otherwise fall back to imuxsock. But I think it should be one or the other, using both in same config seems wrong to me.

Regards,
Jan

Quoted 47 lines

Regards,
Jan

Quoted 29 lines

Copy the imjournal lines from the system's
/etc/rsyslog.conf if they exist.

---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -0
index ef33517aa92b..4a6514a3114e 100755
@@ -72,8 +72,10 @@ setup()
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
 		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf
 		/etc/rsyslog.d/ | head -1)
+		systemd_journal=$(grep -hoi "^[^#].*imjournal.*" -r /etc/rsyslog.conf
 /etc/rsyslog.d/)
 		RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
+$systemd_journal
 $log_socket

EOF
)
--
1.9.4

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.

Quoted 9 lines

GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 2 lines · Jan Stancek

It still appears supported, but turned off by default in systemd 216:

<snip>

Quoted 4 lines

So I think we should use imjournal if possible, otherwise fall back to imuxsock. But I think it should be one or the other, using both in same config seems wrong to me.

I was testing with systemd-219 when I ran into this problem, hence my patch submission.

I think it's ok to leave both modules enabled, though. The default rsyslog.conf in Fedora (up to F21) had both enabled:

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) $ModLoad imjournal # provides access to the systemd journal

See http://pkgs.fedoraproject.org/cgit/rsyslog.git/tree/rsyslog.conf?h=f21#n9

(Fedora 22 dropped imuxsock with the rebase to rsyslog-8.8.0.)

Signature · 12 lines
Jeff Bastian

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#4 lore raw

----- Original Message -----

Quoted 10 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Thursday, 9 July, 2015 2:45:03 PM
Subject: Re: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

Quoted 2 lines · Jan Stancek

It still appears supported, but turned off by default in systemd 216:

<snip>

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

So I think we should use imjournal if possible, otherwise fall back to imuxsock. But I think it should be one or the other, using both in same config seems wrong to me.

I was testing with systemd-219 when I ran into this problem, hence my patch submission.

Do the testcases pass for you with this patch? They still fail for me with rsyslog-7.4.7-7.el7_0 and systemd-219-5.el7.

This is config used by syslogs tests:

# cat /etc/rsyslog.conf
$ModLoad imuxsock.so
$ModLoad imjournal # provides access to the systemd journal
$IMJournalStateFile imjournal.state
$SystemLogSocketName /run/systemd/journal/syslog
mail.debug      /var/log/maillog

which fails for me unless I add "$WorkDirectory" option. I'm guessing that's needed to find imjournal.state file:

# ll /var/lib/rsyslog
total 4
-rw-r--r--. 1 root root 124 Jul  9 09:21 imjournal.state
Quoted 3 lines

I think it's ok to leave both modules enabled, though. The default rsyslog.conf in Fedora (up to F21) had both enabled:

It seems to duplicate messages for me in quite unpredictable way. After running syslog02:

[root@ibm-ls21-04 bin]# cat /var/log/maillog

2015-07-09T09:33:44.681130-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:48.812349-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:52.943509-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:52.943588-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:52.943588-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:57.072698-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:33:57.072774-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:52.943588-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:57.072774-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:34:01.202191-04:00 ibm-ls21-04 syslogtst: syslogtst: mail warning test.
2015-07-09T09:34:01.202268-04:00 ibm-ls21-04 syslogtst: syslogtst: mail warning test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:52.943588-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:57.072774-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:34:01.202268-04:00 ibm-ls21-04 syslogtst: syslogtst: mail warning test.
2015-07-09T09:34:05.333899-04:00 ibm-ls21-04 syslogtst: syslogtst: mail notice test.
2015-07-09T09:34:05.333818-04:00 ibm-ls21-04 syslogtst: syslogtst: mail notice test.
2015-07-09T09:33:44.681379-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:33:48.812431-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:33:52.943588-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:33:57.072774-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:34:01.202268-04:00 ibm-ls21-04 syslogtst: syslogtst: mail warning test.
2015-07-09T09:34:05.333899-04:00 ibm-ls21-04 syslogtst: syslogtst: mail notice test.
2015-07-09T09:34:09.464783-04:00 ibm-ls21-04 syslogtst: syslogtst: mail info test.
2015-07-09T09:34:09.464862-04:00 ibm-ls21-04 syslogtst: syslogtst: mail info test.
2015-07-09T09:34:13.563791-04:00 ibm-ls21-04 syslogtst: syslogtst: mail debug test.
2015-07-09T09:34:13.563870-04:00 ibm-ls21-04 syslogtst: syslogtst: mail debug test.
Jul  9 09:34:13 ibm-ls21-04 syslogtst: syslogtst: mail debug test.

if I use only imjournal I get:

# cat /var/log/maillog
2015-07-09T09:37:30.452833-04:00 ibm-ls21-04 syslogtst: syslogtst: mail emerg test.
2015-07-09T09:37:34.583176-04:00 ibm-ls21-04 syslogtst: syslogtst: mail alert test.
2015-07-09T09:37:38.713671-04:00 ibm-ls21-04 syslogtst: syslogtst: mail crit test.
2015-07-09T09:37:42.843411-04:00 ibm-ls21-04 syslogtst: syslogtst: mail err test.
2015-07-09T09:37:46.975099-04:00 ibm-ls21-04 syslogtst: syslogtst: mail warning test.
2015-07-09T09:37:51.104797-04:00 ibm-ls21-04 syslogtst: syslogtst: mail notice test.
2015-07-09T09:37:55.236947-04:00 ibm-ls21-04 syslogtst: syslogtst: mail info test.
2015-07-09T09:37:59.366192-04:00 ibm-ls21-04 syslogtst: syslogtst: mail debug test.

Regards,
Jan

Quoted 12 lines

$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal

See http://pkgs.fedoraproject.org/cgit/rsyslog.git/tree/rsyslog.conf?h=f21#n9

(Fedora 22 dropped imuxsock with the rebase to rsyslog-8.8.0.)

--
Jeff Bastian

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw
Quoted 2 lines · Jan Stancek

Do the testcases pass for you with this patch? They still fail for me with rsyslog-7.4.7-7.el7_0 and systemd-219-5.el7.

...

Quoted 1 line

which fails for me unless I add "$WorkDirectory" option.

Hmm, it worked in my tests last night, but it's failing today. You're right, the $WorkDirectory option fixed it. Fortunately that's just a minor tweak to the regex in the patch; see attached for a new version of the patch.

::::::::::::
:: Before ::
::::::::::::
[root@localhost bin]# grep -i journal syslog-lib.sh [root@localhost bin]# syslog01 ; echo $?

syslog01    0  TINFO  :  Send messages to syslogd at some level
syslog01    0  TINFO  :  and facility and grep for those messages.
syslog01    0  TINFO  :  testing whether messages are logged into log file
syslog01    0  TINFO  :  restarting syslog daemon
syslog01    0  TINFO  :  restarting syslog daemon

1

:::::::::::
:: After ::
:::::::::::
[root@localhost bin]# grep -i journal syslog-lib.sh

                systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
$systemd_journal
[root@localhost bin]# syslog01 ; echo $?
syslog01    0  TINFO  :  Send messages to syslogd at some level 
syslog01    0  TINFO  :  and facility and grep for those messages.
syslog01    0  TINFO  :  testing whether messages are logged into log file
syslog01    0  TINFO  :  restarting syslog daemon
syslog01    0  TINFO  :  restarting syslog daemon

0

Quoted 5 lines
Quoted 2 lines

I think it's ok to leave both modules enabled, though. The default rsyslog.conf in Fedora (up to F21) had both enabled:

It seems to duplicate messages for me in quite unpredictable way. After running syslog02:

With the updated patch, it looks ok for me:

[root@localhost bin]# systemctl stop rsyslog [root@localhost bin]# cat /dev/null >/var/log/maillog [root@localhost bin]# systemctl start rsyslog [root@localhost bin]# syslog02
...
root@localhost bin]# cat /var/log/maillog

2015-07-09T10:32:10.383470-04:00 localhost syslogtst: syslogtst: mail emerg test.
2015-07-09T10:32:14.403420-04:00 localhost syslogtst: syslogtst: mail alert test.
2015-07-09T10:32:18.422884-04:00 localhost syslogtst: syslogtst: mail crit test.
2015-07-09T10:32:22.442509-04:00 localhost syslogtst: syslogtst: mail err test.
2015-07-09T10:32:26.461447-04:00 localhost syslogtst: syslogtst: mail warning test.
2015-07-09T10:32:30.480587-04:00 localhost syslogtst: syslogtst: mail notice test.
2015-07-09T10:32:34.499815-04:00 localhost syslogtst: syslogtst: mail info test.
2015-07-09T10:32:38.518913-04:00 localhost syslogtst: syslogtst: mail debug test.
Signature · 1 line
Jeff Bastian

commit 4caed564ffbf2f1ac1d889d598e0fa8269562929 (HEAD, rsyslog-imjournal)

Author: Jeffrey Bastian <[email protected]>
Date:   Wed Jul 8 14:06:48 2015 -0500

syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald. Copy the imjournal lines from the system's /etc/rsyslog.conf if they exist.

testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -0
index ef33517aa92b..d2a47112b493 100755
@@ -72,8 +72,10 @@ setup()
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
 		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
+		systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
 		RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
+$systemd_journal
 $log_socket
 EOF
 )

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#6 lore raw

----- Original Message -----

Quoted 75 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Thursday, 9 July, 2015 4:37:00 PM
Subject: Re: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

Quoted 2 lines · Jan Stancek

Do the testcases pass for you with this patch? They still fail for me with rsyslog-7.4.7-7.el7_0 and systemd-219-5.el7.

...

Quoted 1 line

which fails for me unless I add "$WorkDirectory" option.

Hmm, it worked in my tests last night, but it's failing today. You're right, the $WorkDirectory option fixed it. Fortunately that's just a minor tweak to the regex in the patch; see attached for a new version of the patch.

::::::::::::
:: Before ::
::::::::::::
[root@localhost bin]# grep -i journal syslog-lib.sh [root@localhost bin]# syslog01 ; echo $?

syslog01    0  TINFO  :  Send messages to syslogd at some level
syslog01    0  TINFO  :  and facility and grep for those messages.
syslog01    0  TINFO  :  testing whether messages are logged into log file
syslog01    0  TINFO  :  restarting syslog daemon
syslog01    0  TINFO  :  restarting syslog daemon

1

:::::::::::
:: After ::
:::::::::::
[root@localhost bin]# grep -i journal syslog-lib.sh

                systemd_journal=$(grep -Ehoi
                "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf
                /etc/rsyslog.d/)
$systemd_journal
[root@localhost bin]# syslog01 ; echo $?
syslog01    0  TINFO  :  Send messages to syslogd at some level
syslog01    0  TINFO  :  and facility and grep for those messages.
syslog01    0  TINFO  :  testing whether messages are logged into log file
syslog01    0  TINFO  :  restarting syslog daemon
syslog01    0  TINFO  :  restarting syslog daemon

0

Quoted 5 lines
Quoted 2 lines

I think it's ok to leave both modules enabled, though. The default rsyslog.conf in Fedora (up to F21) had both enabled:

It seems to duplicate messages for me in quite unpredictable way. After running syslog02:

With the updated patch, it looks ok for me:

[root@localhost bin]# systemctl stop rsyslog [root@localhost bin]# cat /dev/null >/var/log/maillog [root@localhost bin]# systemctl start rsyslog [root@localhost bin]# syslog02
...
root@localhost bin]# cat /var/log/maillog

2015-07-09T10:32:10.383470-04:00 localhost syslogtst: syslogtst: mail emerg
test.
2015-07-09T10:32:14.403420-04:00 localhost syslogtst: syslogtst: mail alert
test.
2015-07-09T10:32:18.422884-04:00 localhost syslogtst: syslogtst: mail crit
test.
2015-07-09T10:32:22.442509-04:00 localhost syslogtst: syslogtst: mail err
test.
2015-07-09T10:32:26.461447-04:00 localhost syslogtst: syslogtst: mail warning
test.
2015-07-09T10:32:30.480587-04:00 localhost syslogtst: syslogtst: mail notice
test.
2015-07-09T10:32:34.499815-04:00 localhost syslogtst: syslogtst: mail info
test.
2015-07-09T10:32:38.518913-04:00 localhost syslogtst: syslogtst: mail debug
Quoted 1 line

test.

Presumably because you are running new systemd. Can you try with "ForwardToSyslog=yes" set in journald.conf (which is the case for old systemd)?

That still gives me duplicated messages with v2 of the patch.

Regards,
Jan

Quoted 4 lines

--
Jeff Bastian

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#7 lore raw
Quoted 4 lines · Jan Stancek

Presumably because you are running new systemd. Can you try with "ForwardToSyslog=yes" set in journald.conf (which is the case for old systemd)?

That still gives me duplicated messages with v2 of the patch.

Ok, I see it now: systemd-208 gets duplicates with v2 of the patch, and systemd-219 with ForwardToSyslog=yes also gets duplicates.

This will complicate the patch a bit. If I understand it correctly, LTP proc01 needs to do something like this:

if ForwardToSyslog is enabled OR
(systemd version < 216 AND using default journald.conf)
then
use imuxsock
else
use imjournal
endif

I'll send a new patch soon.

Thanks,
Jeff

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#8 lore raw

----- Original Message -----

Quoted 18 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Thursday, 9 July, 2015 6:33:41 PM
Subject: Re: [LTP] [PATCH] syslog/syslog-lib.sh: support systemd journal

Quoted 5 lines · Jan Stancek

Presumably because you are running new systemd. Can you try with "ForwardToSyslog=yes" set in journald.conf (which is the case for old systemd)?

That still gives me duplicated messages with v2 of the patch.

Ok, I see it now: systemd-208 gets duplicates with v2 of the patch, and systemd-219 with ForwardToSyslog=yes also gets duplicates.

This will complicate the patch a bit. If I understand it correctly, LTP proc01 needs to do something like this:

Quoted 8 lines

if ForwardToSyslog is enabled OR
(systemd version < 216 AND using default journald.conf)
then
use imuxsock
else
use imjournal
endif

I think it's enough to look at rsyslog.conf to check if imjournal is in use. If it's in distro rsyslog.conf, we know we can use it too. If not, we fall back to imuxsock.

if rsyslog.conf is using imjournal then
use imjournal
else
use imuxsock

Regards,
Jan

Quoted 5 lines

I'll send a new patch soon.

Thanks,
Jeff

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#9 lore raw

rsyslog needs to use the imjournal module to communicate with systemd-journald instead of imuxsock. Check the system's /etc/rsyslog.conf to see if LTP should use imjournal or imuxsock

---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/syslog/syslog-lib.sh +10 -2
index ef33517aa92b..e166d3a45261 100755
@@ -71,12 +71,20 @@ setup()
 		CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
-		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
-		RSYSLOG_CONFIG=$(cat <<EOF
+		if grep -q -r '^\$ModLoad[[:space:]]*imjournal' /etc/rsyslog.conf /etc/rsyslog.d/ ; then
+			systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
+			RSYSLOG_CONFIG=$(cat <<EOF
+$systemd_journal
+EOF
+)
+		else
+			log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
+			RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
 $log_socket
 EOF
 )
+		fi
 	else
 		tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
 		cleanup 1
Signature · 12 lines
1.9.4

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Reviewed-by
#10 lore raw

----- Original Message -----

Quoted 10 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Friday, 10 July, 2015 12:16:12 AM
Subject: Re: [LTP] [PATCH v3] syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald instead of imuxsock. Check the system's /etc/rsyslog.conf to see if LTP should use imjournal or imuxsock

Looks good to me. I tried this patch with systemd-208 and systemd-219 with default journald config, the results were as expected with no duplicate messages.

I also tried reversing imuxsock/imjournal to be the opposite of the default rsyslog config, which worked too. As noted before, ForwardToSyslog=yes was required for systemd-219 when using imuxsock as that is no longer turned on by default. This should be of no concern, since we always try to construct rsyslog config which mimics distro default.

Regards,
Jan

Quoted 39 lines
---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/syslog/syslog-lib.sh +1 -2
index ef33517aa92b..e166d3a45261 100755
@@ -71,12 +71,20 @@ setup()
 		CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
-		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf
 /etc/rsyslog.d/ | head -1)
-		RSYSLOG_CONFIG=$(cat <<EOF
+		if grep -q -r '^\$ModLoad[[:space:]]*imjournal' /etc/rsyslog.conf

/etc/rsyslog.d/ ; then

testcases/kernel/syscalls/syslog/syslog-lib.sh +1 -0
+			systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r

/etc/rsyslog.conf /etc/rsyslog.d/)

testcases/kernel/syscalls/syslog/syslog-lib.sh +6 -0
+			RSYSLOG_CONFIG=$(cat <<EOF
+$systemd_journal
+EOF
+)
+		else
+			log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf

/etc/rsyslog.d/ | head -1)

testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -1
+			RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
 $log_socket
 EOF
 )
+		fi
 	else
 		tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
 		cleanup 1
--

1.9.4

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#11 lore raw

----- Original Message -----

Quoted 10 lines

From: "Jan Stancek" <[email protected]>
To: "Jeffrey Bastian" <[email protected]>
Cc: [email protected]
Sent: Monday, 13 July, 2015 1:43:16 PM
Subject: Re: [LTP] [PATCH v3] syslog/syslog-lib.sh: support systemd journal

Quoted 11 lines

----- Original Message -----

Quoted 10 lines

From: "Jeffrey Bastian" <[email protected]>
To: [email protected]
Sent: Friday, 10 July, 2015 12:16:12 AM
Subject: Re: [LTP] [PATCH v3] syslog/syslog-lib.sh: support systemd journal

rsyslog needs to use the imjournal module to communicate with systemd-journald instead of imuxsock. Check the system's /etc/rsyslog.conf to see if LTP should use imjournal or imuxsock

I modified commit message a bit and pushed the patch.

Thanks,
Jan

Quoted 69 lines

Looks good to me. I tried this patch with systemd-208 and systemd-219 with default journald config, the results were as expected with no duplicate messages.

I also tried reversing imuxsock/imjournal to be the opposite of the default rsyslog config, which worked too. As noted before, ForwardToSyslog=yes was required for systemd-219 when using imuxsock as that is no longer turned on by default. This should be of no concern, since we always try to construct rsyslog config which mimics distro default.

Regards,
Jan

Quoted 39 lines
---
 testcases/kernel/syscalls/syslog/syslog-lib.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/syslog/syslog-lib.sh +1 -2
index ef33517aa92b..e166d3a45261 100755
@@ -71,12 +71,20 @@ setup()
 		CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
 	elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
 		CONFIG_FILE="/etc/rsyslog.conf"
-		log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf
 /etc/rsyslog.d/ | head -1)
-		RSYSLOG_CONFIG=$(cat <<EOF
+		if grep -q -r '^\$ModLoad[[:space:]]*imjournal' /etc/rsyslog.conf

/etc/rsyslog.d/ ; then

testcases/kernel/syscalls/syslog/syslog-lib.sh +1 -0
+			systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r

/etc/rsyslog.conf /etc/rsyslog.d/)

testcases/kernel/syscalls/syslog/syslog-lib.sh +6 -0
+			RSYSLOG_CONFIG=$(cat <<EOF
+$systemd_journal
+EOF
+)
+		else
+			log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf

/etc/rsyslog.d/ | head -1)

testcases/kernel/syscalls/syslog/syslog-lib.sh +2 -1
+			RSYSLOG_CONFIG=$(cat <<EOF
 \$ModLoad imuxsock.so
 $log_socket
 EOF
 )
+		fi
 	else
 		tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
 		cleanup 1
--

1.9.4

Quoted 11 lines

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.

Quoted 9 lines

GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list