Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: The -l/--full option in journalctl is not wrapping long lines. systemctl --full does wrap properly though. It's mentioned here: https://plus.google.com/+ElisonNiven/posts/P86Pjns3Jvq that --full should wrap long lines. We do need an option to wrap long lines somewhow so there's a bug here somewhere. Version-Release number of selected component (if applicable): systemd-208-21.fc20.x86_64 How reproducible: always Steps to Reproduce: 1. journalctl -l Actual results: long lines are not wrapped Expected results: long lines are wrapped
Wrapping of lines is not done by systemd. It is done by the pager (less by default). You can toggle line wrapping in less by typing <minus>S<enter>. I'll close this, since it seems to be just a misunderstanding. Feel free to comment/ask/reopen if necessary.
I'm not sure how to get the following experience (I don't fully understand how systemd does output so I could just not know how to get what I want): If I do systemctl normally (trimmed the output for space): $ systemctl status smartd.service smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon Loaded: loaded (/usr/lib/systemd/system/smartd.service; enabled) Active: active (running) since Thu 2014-10-16 21:27:08 EDT; 48min ago Main PID: 707 (smartd) CGroup: /system.slice/smartd.service └─707 /usr/sbin/smartd -n -q never Oct 16 21:27:19 localhost smartd[707]: Device: /dev/... Oct 16 21:27:19 localhost smartd[707]: Monitoring 2 ... Hint: Some lines were ellipsized, use -l to show in full. So I can do "-l" to get what I want for word wrapping properly: $ systemctl -l status smartd.service smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon Loaded: loaded (/usr/lib/systemd/system/smartd.service; enabled) Active: active (running) since Thu 2014-10-16 21:27:08 EDT; 50min ago Main PID: 707 (smartd) CGroup: /system.slice/smartd.service └─707 /usr/sbin/smartd -n -q never Oct 16 21:27:19 localhost smartd[707]: Device: /dev/sdb [SAT], is SMART capable. Adding to "monitor" list. Oct 16 21:27:19 localhost smartd[707]: Monitoring 2 ATA and 0 SCSI devices That's good, I just need to use -l all the time for systemctl. no problem. I can do that. It does seem for different contexts -l does different things... I notice "systemctl -l" does not word wrap because of the type of "table output" I guess. fine. Now for journalctl, it doesn't "ellipsize"/show those "...", but it just cuts off output (trimming/cleaning output for space again): $ journalctl -n -- Logs begin at Fri 2014-03-21 17:20:54 EDT, end at Thu 2014-10-16 22:01:02 EDT Oct 16 22:01:02 localhost systemd[1706]: Starting Defau Oct 16 22:01:02 localhost systemd[1706]: Reached target Oct 16 22:01:02 localhost systemd[1706]: Startup finish Oct 16 22:01:02 localhost systemd[1]: Started User Mana Oct 16 22:01:02 localhost run-parts[1715]: (/etc/cron.h Oct 16 22:01:02 localhost anacron[1749]: Anacron starte I thought "journalctl -l -n" might wordwrap, but it's the same output. This is what I thought the bug is. If it's not a bug, then sorry to be thickheaded, what is the incantation to wordwrap? Is it really "journalctl -n | less"? That seems like throwing out the baby with the bathwater? I get none of the nice coloring output that way. :)
(In reply to Zing from comment #2) systemctl status doesn't do paging, i.e. it prints the output directly to your terminal. journactl is different, it launches a pages (less) by itself, and pipes the output to the pager, and the pager is reponsible for displaying stuff. (This can be changed by using --no-pager or setting SYSTEMD_PAGER=cat, in which case no pager is used. You can also set SYSTEMD_PAGER or PAGER to override the pager that is used.) > Now for journalctl, it doesn't "ellipsize"/show those "...", but it just > cuts off output (trimming/cleaning output for space again): > > $ journalctl -n > -- Logs begin at Fri 2014-03-21 17:20:54 EDT, end at Thu 2014-10-16 22:01:02 > EDT > Oct 16 22:01:02 localhost systemd[1706]: Starting Defau > Oct 16 22:01:02 localhost systemd[1706]: Reached target > Oct 16 22:01:02 localhost systemd[1706]: Startup finish > Oct 16 22:01:02 localhost systemd[1]: Started User Mana > Oct 16 22:01:02 localhost run-parts[1715]: (/etc/cron.h > Oct 16 22:01:02 localhost anacron[1749]: Anacron starte > > I thought "journalctl -l -n" might wordwrap, but it's the same output. This > is what I thought the bug is. If it's not a bug, then sorry to be > thickheaded, what is the incantation to wordwrap? This looks like using a pager. Try pressing the right arrow to scroll to the right, or type -S<enter> to instruct the pager to turn on line wrapping. > Is it really "journalctl -n | less"? That seems like throwing out the baby > with the bathwater? I get none of the nice coloring output that way. :) journalctl already does that for you, no need to do it by hand. BTW., make sure that you don't have SYSTEMD_PAGER or PAGER environment variables set, they might be messing things up.
Ahh, ok, thank you for your help... I believe now I can get what I need with journalctl with: SYSTEMD_PAGER="less +-^PS" Unfortunately that messes with systemctl output... I'll have to separate out new scripts with different environments for each tool. inelegant, but that should work.
So why does less, when called by journalctl, behave as though having the -S (i.e. --chop-long-lines) flag preset? This is not the default behaviour of less (per its man page) and I don't see this behaviour with other programs that call less automatically, so I assume this is done by journalctl on purpose. It's extremely annoying.
You can use SYSTEMD_PAGER to set whatever behaviour you want. Line-chopping is what we thought to work best by default.