Manipulating journalctl output
by Suvayu Ali
Hi,
Lately I have been facing a lot of difficulty trying to get the
information I want easily using journalctl. I find the manpage of
limited use; as in, it has the basic information but the more advanced
information is scattered in several manpages and the text is littered
with jargon more appropriate for developers (IMO this last point holds
true for most of systemd documentation)!
So I thought it might be useful to share a few methods I know, followed
by some questions. Maybe others can share their tricks too. This
thread could then serve as a more accessible documentation for users
(which could then be ported to a wiki page).
Some basic comments:
1. If your journal size is large, piping to grep is quite a bit slow.
2. To run journalctl as a regular user, you need to add yourself to the
group systemd-journal, logout, and login again.
Useful commandline switches I'm familiar with:
1. Most recent entries first, `-r/--reverse'.
2. To follow, `-f/--follow'.
3. To limit logs by timestamp, `--since/--until'; it takes absolute
timestamps (2013-12-31) as well as relative time stamps (-2d, -10m).
BTW, the manpage does not say anything about the units for relative
times. I had to find out by trial-and-error m stands for minutes,
not months.
4. Limit output from this boot, `-b/--this-boot'.
$ journalctl -b 'bootid'.
I find the more general interface to filter by _BOOT_ID most
ridiculous. How is the user supposed to know what was the boot-id
for any of the previous sessions?
5. Filter by unit files, `-u/--unit'.
$ journalctl -u <unit_file> # .service extension optional
6. To filter by journal fields, just pass FIELD=<value>.
7. The actual useful documentation for (4), (5) & (6) is really in
systemd.journal-fields(7). No mention is made of this other than the
`SEE ALSO' section at the very end. The fields manpage is also the
perfect example of documentation written for developers instead of
users (another one would be journald.conf(5)).
8. You can list valid values for the fields in (6) with `-F/--field'.
Example, for all known boot-ids do this:
$ journalctl -F _BOOT_ID
Now my questions:
1. How can I filter messages printed to the logs from my cron jobs? I
will try to explain by example:
$ journalctl -ru crond --since=-3d
-- Logs begin at Sun 2013-11-17 02:48:46 CET, end at Wed 2014-01-01 20:31:27 CET. --
$ journalctl -r --since -3d | grep rsnapshot
Jan 01 04:34:08 <hostname> rsnapshot[15294]: /usr/bin/rsnapshot daily: completed successfully
Jan 01 04:30:01 <hostname> CROND[15270]: (root) CMD (/usr/bin/rsnapshot daily)
Jan 01 04:00:07 <hostname> rsnapshot[15198]: /usr/bin/rsnapshot monthly: completed successfully
Jan 01 04:00:01 <hostname> CROND[15196]: (root) CMD (/usr/bin/rsnapshot monthly)
Dec 31 04:35:45 <hostname> rsnapshot[11360]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsnapshot daily: completed, but with some errors
Dec 31 04:35:45 <hostname> rsnapshot[11359]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsync returned 255 while processing user@host:/etc/
Dec 31 04:33:37 <hostname> rsnapshot[11353]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsync returned 255 while processing user@host:/home/user/
Dec 31 04:30:01 <hostname> CROND[11334]: (root) CMD (/usr/bin/rsnapshot daily)
Dec 30 04:36:05 <hostname> rsnapshot[8265]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsnapshot daily: completed, but with some errors
Dec 30 04:36:05 <hostname> rsnapshot[8264]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsync returned 255 while processing user@host:/etc/
Dec 30 04:33:58 <hostname> rsnapshot[8254]: /usr/bin/rsnapshot daily: ERROR: /usr/bin/rsync returned 255 while processing user@host:/home/user/
Dec 30 04:30:02 <hostname> CROND[8237]: (root) CMD (/usr/bin/rsnapshot daily)
What I understand from this is `-u <unit>' only tells me what happened
when the unit file was (un)loaded, not what the process prints to the
log files. How do I get this information? Is cron special in this
regard?
2. I would like to filter logs that typically go into /var/log/secure
(or other similar files); how do I do that? Is grep my only option
for cases like these?
Thanks in advance for any answers.
Cheers,
--
Suvayu
Open source is the future. It sets us free.
10 years, 3 months
akmod isn't reliable
by Powell, Michael
I guess this is more of a general question, but sometimes after updating the kernel or nvidia drivers an akmod isn't regenerated and my system will begin to boot, fedora logo will show, but eventually it will dump to the systemd log of services being started and just sit there. I have all the required dependencies before the update because I can simply reboot to runlevel 1 or if I have an older kernel boot it and then manually `akmods --kernels`.
So the question is... why isn't regeneration of the akmod reliable?
10 years, 3 months
sendmail ignoring .forward?
by SternData
Ignore the previous cron messages. It seems that the mail is going into
space because sendmail is not respecting the .forward in my home directory.
/home/sdstern/.forward contains
\root(a)sterndata.com
which is a valid, external email account
but mail sent to "sdstern" goes to "sdstern(a)sterndata.com", which is
another valid external email account. I found all my missing cron mail
there.
$ ll .forward
-rw-------. 1 sdstern sdstern 21 Jan 3 10:51 .forward
Apparently, this has been going on since December 13.
--
-- Steve
10 years, 3 months
Dual boot Windows 8.1 Pro and Fedora 20
by Ger van Dijck
Hello everybody ,
I have a problem :
Laptop Dell 17 R model 3721 ,disk 1Tb , mem 8 Gb , vga : Radeon 8730 m and
Intel 4000 hd.
I did fresh install Windows 8.1. Pro : No problems everyting runs fine.
Therafter I did fresh install Fedora 20 (Mate , all groups) : Runs
perfectly fine , but when rebooting , Windows 8.1 Pro does not appear in
the GRUB boot menu.
So I did run grub2-mkconfig -o /boot/grub2/grub.cfg and rebooted : No
Windows 8.1 Pro displayed in GRUB display.
After updating Fedora 20 and having a new version of the kernel , I did
run grub2-config etc. and rebooted : No Windows 8.1 dispayed in GRUB
display.
Looking in grub.cfg shows to me , that the menutree for the two kernel
versions and fedora rescue is correct generated.
Setting Bios , Uefi is a.f.: boot mode set to legacy , secure boot off.
load legacy option ROM.
boot list option legacy.
Disk layout is a.f.:
Fedora 20
---------
DATA : /home 322,28 Gb
fedora home
bios boot 1 Mb
sda 6
SYSTEM: /boot 500 Mb
sda 8
/ 51,2 Mb
fedora root
swap 2,44 Mb
fedora swap
Windows 8.1 Pro
---------------
sda1 ntfs 300 Mb
sda2 efi syspartition 100 Mb
sda3 unknown 128 Mb
sda4 ntfs 199,47 Mb
sda5 ntfs 376,93 Gb
sda6 bios boot 1 Mb
sda7 ext4 500 Mb
Question : How can I manage ,that Windows 8.1 Pro appears in the GRUB boot
menu , so I can not only boot Fedora 20 , but also Windows 8.1 Pro ?
Begging for help ,
Ger van Dijck.
10 years, 3 months
since F20 update, cron has stopped sending mail
by SternData
With F19, I got email from cron on all jobs that produced output. I no
longer get those mails after upgrading to F20. I have verified that the
jobs are run. There are no entries in /var/log/maillog for them. Other
system tasks, not run through cron, send their emails as usual.
crontab has a "Mail to" line in it:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
Any idea what I need to do to get my cron email restored?
--
-- Steve
10 years, 3 months
Password to shutdown as user -
by Bob Goodwin
Fedora-20 64 bit XFCE system.
Requires a password to shut down as bobg. I've never had that problem
before and not certain I had it on the initial install. It is a real
annoyance ... and then it waits for "stop job is running for cups
printing service," obviously I have something messed up but not sure
what to do to fix it. One of the printers rand out of paper the other
day which caused some confusion but that is all back to normal and I've
used one of them since. Not sure that is related to the password problem
but it is suspect I suppose?.
Bob
--
http://www.qrz.com/db/w2bod
Box10 Fedora-20/64bit Linux
10 years, 3 months
after upgrade to fedora 20 error with grub file missing
by Rafnews
Hi,
after upgrading fedora 19 with fedora 20, i got the following error
message with grub is loading:
Welcome to GRUB!
error: file '/grub2/locale/en.mo.gz' not found
how is it possible after using fedup --network 20 to upgrade (in VMWare
worstation) ?
thx
10 years, 3 months
Fedora on a Dell XPS 15?
by CS DBA
Hi All;
I'm looking for a replacement for my 15" macbook pro retina, I tried to
switch to mac but Linux is just too good.
Thinking of buying a Dell XPS 15 (specs below), anyone have any thoughts
on if Fedora will run on this machine?
Thanks in advance
Specs:
Note that this laptop has ONLY a Mini DisplayPort for an external monitor
*
Processor*
4th Generation Intel® Core^(TM) i7-4702HQ processor (6M Cache, up to 3.2
GHz)
*Memory*
16GB Dual Channel DDR3L 1600MHz (8GBx2)
*Hard Drive**s*
1TB 5400 rpm SATA Hard Drive + 32GB mSATA Solid State Drive
*
Video Card*
NVIDIA® GeForce® GT 750M 2GB GDDR5
*Display*
15.6 inch LED Backlit Touch Display with Truelife and QHD+ resolution
(3200 x 1800)
*Wireless*
Intel® Centrino® Wireless-AC 7260 + Bluetooth 4.0
*External Chassis Connections*
USB 3.0 w/PowerShare (3), USB 2.0 with PowerShare (1), mini DisplayPort
(1), HDMI (1), 3-in-1 media card reader supporting SD, SDIO, SDXC,
headset jack (1), Noble lock
*Keyboard*
Full size, backlit chiclet keyboard
*Touchpad*
Glass integrated button touchpad
10 years, 3 months
f20 - gedit
by Robert Moskowitz
Well here comes the questions on 'where is it now'. Of course since I
skipped f18 & f19, these may be 'old' issues....
So with gedit, where 'preferences'? I need to turn off line wrap so I
can use it to edit various config files. Meanwhile, back to vi.
10 years, 3 months