systemd/journald for managing the application log

638 views
Skip to first unread message

Jérôme LAFORGE

unread,
Dec 16, 2015, 10:19:32 AM12/16/15
to golang-nuts
Hello all,

I try to delegate the log to systemd/journald?
I write this simple test go program that log into STDOUT: http://play.golang.org/p/QIfDMZ5Ssx

I use this systemd unit file:
[Unit]
Description=log testing
After=syslog.target network.target

[Service]
Type=simple
ExecStart=/tmp/log_testing
WorkingDirectory=/tmp/

[Install]
WantedBy=multi-user.target



When I try to access to my log with:
systemctl start log_testing.service



Some log line seems to be missing:
déc. 15 16:34:32 ... log_testing[29722]: 0
déc. 15 16:34:32 ... log_testing[29722]: 1
déc. 15 16:34:32 ... log_testing[29722]: 2
déc. 15 16:34:32 ... log_testing[29722]: 3
déc. 15 16:34:32 ... log_testing[29722]: 4
déc. 15 16:34:32 ... log_testing[29722]: 5
déc. 15 16:34:32 ... log_testing[29722]: 6
déc. 15 16:34:32 ... log_testing[29722]: 7
déc. 15 16:34:32 ... log_testing[29722]: 8
déc. 15 16:34:32 ... log_testing[29722]: 9
déc. 15 16:34:32 ... log_testing[29722]: 10


... no missing log between 10 and 995 ...

déc. 15 16:34:37 ... log_testing[29722]: 995
déc. 15 16:34:37 ... log_testing[29722]: 996
déc. 15 16:34:37 ... log_testing[29722]: 997
déc. 15 16:34:37 ... log_testing[29722]: 998
déc. 15 16:34:37 ... log_testing[29722]: 999
déc. 15 16:34:37 ... log_testing[29722]: 1000   
déc. 15 16:35:02 ... log_testing[29722]: 5841 
   <-- here, it is not expected number (so missing lines from 1001 to 5840)
déc. 15 16:35:02 ... log_testing[29722]: 5842
déc. 15 16:35:02 ... log_testing[29722]: 5843
déc. 15 16:35:02 ... log_testing[29722]: 5844
déc. 15 16:35:02 ... log_testing[29722]: 5845
déc. 15 16:35:02 ... log_testing[29722]: 5846
déc. 15 16:35:02 ... log_testing[29722]: 5847


Has someone already use systemd/journald with golang for managing the application log?
If yes, how can I see all the log? not only slice of 1000 lines?


Thx in adv


Brad Fitzpatrick

unread,
Dec 16, 2015, 12:45:03 PM12/16/15
to Jérôme LAFORGE, golang-nuts
journald has anti-flooding protections. It's configurable.

This isn't a Go issue, though.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Giulio Iotti

unread,
Dec 16, 2015, 12:48:07 PM12/16/15
to golang-nuts
On Wednesday, December 16, 2015 at 5:19:32 PM UTC+2, Jérôme LAFORGE wrote:
Has someone already use systemd/journald with golang for managing the application log?
If yes, how can I see all the log? not only slice of 1000 lines?

Looks like your syslog daemon allows max 1000 printed messages per minute from one client to prevent one client from filling your disk. Depending on which syslogd you are using, there might be an option to tune this.

-- 
Giulio Iotti 

Jérôme LAFORGE

unread,
Dec 16, 2015, 2:33:20 PM12/16/15
to golang-nuts
You got it.
I think the pb comes from here:
http://www.freedesktop.org/software/systemd/man/journald.conf.html#RateLimitInterval=

I will try it before the end of this week, and I will give you back the result.

Thx you both.

Jérôme LAFORGE

unread,
Dec 19, 2015, 6:28:02 AM12/19/15
to golang-nuts
http://www.freedesktop.org/software/systemd/man/journald.conf.html#RateLimitInterval=

I will try it before the end of this week, and I will give you back the result.

The problem has been fixed by changing the configuration of journald as described into the doc.
Just set RateLimitBurst=0 into journald.conf and restart journald.service.
Reply all
Reply to author
Forward
0 new messages