Re: SOLUTION: Re: journal / systemd colours ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 30 Jun 2023 14:46:38 +0100
Barry Scott <barry@xxxxxxxxxxxxxxxx> wrote:

> > On 30 Jun 2023, at 14:15, stan via users
> > <users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> > This is correct.  After I posted this, I found that it is
> > impossible to actually set the colors in journalctl because they
> > are hard coded as escape sequences when the data is written into
> > the journal.  What I had done is remove the R option to less, which
> > turns off such escape sequences.  In my case, the less options I
> > set for color then seems to highlight the ESC in light red, so I
> > know which lines journalctl wants to highlight, but not their
> > status.  That isn't optimal, but the horrible dark blue on black
> > background is gone, so I can live with it.  
> 
> I would be nice to be able to configure the colours used. Would need
> a PR against systemd I expect to get this changed.
> 
> One hack would be to edit the output and replace the escape sequence
> for the poor colour to use a replacement using sed I guess.
> 
> For example change the blue to red.
> 
> SYSTEMD_COLORS=16 journalctl  | sed 's/\x1b\[0;34m/\x1b\[0;31m/g' |
> more
> 
> I use more not less and notice that less does not show the coloured
> output.
> 
> Barry

Thanks, this worked for me with both more and less, and the red is much
more palatable. I think the default for less is not to have --use-color
set, so that is probably why it didn't work for you.  I set it on login.

This could be put as a function in .bashrc so that invoking something
like jrctl would run it automatically.  I'm not sure how that would
work for the OP who wanted to use cat though.

I tried 
$ SYSTEMD_COLORS=16 journalctl -r  | sed 's/\x1b\[0;34m/\x1b\[0;31m/g' | cat -
and it worked to send the output colored correctly to stdout, but there
was no paging, it just was a continuous stream.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux