How to use multitail with systemd's journalctl?

One of the things I miss about old-fashioned syslogs is the ability to use multitail.

Right now, I'm trying to figure out how to multitail with the logs from both postfix and nagios, but I'm unable to figure it out. Example:

~$ multitail -i <(journalctl -f -u postfix) -i <(journalctl -f -u nagios)
 --*- multitail 6.2.1 (C) 2003-2014 by [email protected] -*--

The following problem occured:
-----------------------------
Problem obtaining complete (real) path of file /dev/fd/63.
If this is a bug, please report the following information:
The last system call returned: 2 which means "No such file or directory"
multitail: utils.c:185: stop_process: Assertion `pid > 1' failed.
Aborted

Is this in fact possible with bare-bones systemd logs, or do I need to tell systemd to dump to syslog files?

Posted Feb 6, 2017, 1:56 AM UTC · edited

111
swordgeek•

Very simple: yum install rsyslogd

I can't say this strongly enough: FUCK JOURNALCTL!!!*
FUCK non-text logs with a rusty tire iron! This was the most eggregious garbage that has been created in the history of Linux.

4
jsproatOP•

Wow.

Personally, I was going to go with a sand-encrusted hockey stick handle wrapped in syphilis-flavored concertina wire, but a rusty tire iron gets the job done just as well.

You can definitely count me as one more disillusioned systemd refugee. I'm slowly getting over being enraged by the "new normal" in American politics, and so I figure if I can do that, then I can finally get used to systemd.

2
swordgeek•

Y'know, I'm not even going to get into the whole systemd mess. The intent was great, (and it's what Solaris had already done half a decade earlier), even if the execution is a nightmare.

Firewalld? More desktop stuff that doesn't translate well to the enterrprise. I can still just pretend to ignore it.

But dumping text-based log files? WHY?!! There is no significant advantage to doing so, and breaks all compatibility with 40 years of syslogd tools, scripts, and mindset. It is stupid stupid stupid, and I refuse to call it anything else.

Oh, and as a Canadian I have to say that we have more respect for our hockey sticks than that. ;-)

3
ralfwolf•

Have you tried the -L and -l options to multitail?

multitail -l "journalctl -f -u postfix" -L "journalctl -f -u nagios"

you could use named pipes as well instead if this doesn't work for some reason:

 mknod log1 p && mknod log2 && journalctl -f -u postfix > log1 & journalctl -f -u nagios > log2 & multitail -i log1 -i log2 ; kill %%; kill %%; rm log1 log2
2
jsproatOP•

Have you tried the -L and -l options to multitail?

Holy crow, that's it. I don't know how many times I read past these two options. Many thanks!

EDIT: ugh, journalctl is embedding ANSI color codes in the output. Apparently, we're supposed to use machine-parseable formats if we want to avoid this:

1
JuggleTux•

you can pass multiple '-u' to journalctl journalctl -f -u postfix -u nagios

2
jsproatOP•

Sure, but I want multitail to allocate one window per log source.

Maybe I'm going about this the wrong way. It's possible that journalctl will do what I want, but I haven't found it in the documentation I've read so far.

Key things I need, which I currently get from multitail:

  • follow logs in real time (journalctl -f)
  • follow multiple logs in separate panes (?)
  • interactive keyword highlighting (?)
  • interactive marking "place in time" (?)
1
JuggleTux•

oh sorry i don't know multitail so i didn't knew it prints on multiple panes also i don't think that journalctl has anything like this build in.

and since i use tmux with has panes and search functionality i never had this problem

sorry can't help you

2
IUseRhetoric•

/dev/fd/63

Is this by any chance a container?

1
jsproatOP•

Oh, I understand your question now.

/dev/fd/63

Is this by any chance a container?

No, that's the file descriptor for the pipe on my command line. I'm applying process substitution in order to use the stdout from journalctl commands as files for multitail to watch (see the <(whatevs) parts of my command line) ...but apparently multitail doesn't work so well with pipes.

2
jsproatOP•

Nope, fresh install of Debian Jessie.

I know that syslog storage is turned on by default on Debian, but that's not true on all systemd systems. I'm trying to figure out a process that works in most systemd cases.

Alternatively, if I have a colossal misunderstanding about how systemd logging works, then hopefully someone will correct me.

1