Bug 1153747 - journalctl --full is not word wrapping
Summary: journalctl --full is not word wrapping
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-16 17:16 UTC by Zing
Modified: 2017-01-03 16:42 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-10-16 21:43:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Zing 2014-10-16 17:16:35 UTC
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

Comment 1 Zbigniew Jędrzejewski-Szmek 2014-10-16 21:43:34 UTC
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.

Comment 2 Zing 2014-10-17 02:35:38 UTC
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.  :)

Comment 3 Zbigniew Jędrzejewski-Szmek 2014-10-17 02:49:55 UTC
(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.

Comment 4 Zing 2014-10-20 19:30:52 UTC
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.

Comment 5 dkasak 2015-02-18 12:23:37 UTC
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.

Comment 6 Zbigniew Jędrzejewski-Szmek 2015-02-18 13:38:06 UTC
You can use SYSTEMD_PAGER to set whatever behaviour you want. Line-chopping is what we thought to work best by default.


Note You need to log in before you can comment on or make changes to this bug.