2

I use journalctl and want to use an output format with which I can specify the output fields to be shown. These are for example verbose or json.

But as soon as I set these output formats, a giant UTC timestamp is automatically also added which confuses a lot and leads to very long outputs.

Can I specify the output fields to be displayed while I shut-down the timestamp?

I found this: journalctl remove fields starting with underscore but there is no answer to that question. Thanking you in advance

regatta
  • 21
  • 4
  • 1
    I would be happy if someone can tell me if a) there is no solution to my question (journald cannot be configured like that) b) my question is misplaced or somehow stupid c) my question could not be understood Thanks a lot – regatta Jan 26 '22 at 07:30

1 Answers1

0

maybe it's too late to answer but,
you can print the formatted output using awk
something like this :

journalctl -u apache2 | awk '{ for (i = 6; i <= NF; i++) printf "%s ",$i;print "" }'

that transform

Jul 12 23:20:01 vmi1118987 systemd[1]: Starting The Apache HTTP Server...
Jul 12 23:20:02 vmi1118987 systemd[1]: Started The Apache HTTP Server.
Jul 12 23:40:01 vmi1118987 systemd[1]: Stopping The Apache HTTP Server...

into the

Starting The Apache HTTP Server...
Started The Apache HTTP Server.
Stopping The Apache HTTP Server...
Koorosh Ghorbani
  • 507
  • 4
  • 14