• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.

Linux Sistemlerinde "Systemd Servisi Journalctl" Kavramı Ve Kullanımı

TRWE_2012

لِيَغْفِرَ لَكَ اللّٰهُ مَا تَقَدَّمَ مِنْ ذَنْبِك
Moderatör
Konum
BERTUNA
Forum Yaşı
6 Yıl
Mesajlar
5,457
Tepkime puanı
17,030
Systemd altyapısı loglarını journal denen formatta /run/log/journal/ dizinine atmaktadır. Buradaki amaç logların indexlenerek , binary bir dosyada saklanması ve istenen log satırlarının komutlarla hızlıca bulunması (normalde syslog loglarını grep veya tail -f ile incelemekteyiz).

1.Systemd logları journald vasıtasıyla tutmaktadır.

2.Bu loglar /run/log/journal dizininde bulunmakta ve her sistem reboot edilişinde tekrar oluşturulmaktadır

3.Eğer bu log dosyalarının kalıcı olması isteniyorsa /var/log/journal dizini oluşturulup ilgili systemd-journald servisi tekrar başlatılmalıdır. (systemctl restart systemd-journald.service)

4.Journald loglarını görmek için ve loglarda arama yapmak için journalctl komutu kullanılır.

Örnek journalctl komutu kullanımı:

Sistem boot ettikten sonraki bütün journal loglarını görmek için:

Kod:
# journalctl -b

Sadece belirli prioritydeki logları görmek için, misallen error seviyesindeki

Kod:
# journalctl -p err

ÖRNEK ÇIKTI :

Kod:
root@notebookpc://# journalctl -p err
-- Logs begin at Fri 2020-12-18 21:36:01 +03, end at Fri 2020-12-18 22:39:51 +03. --
Ara 18 21:36:01 notebookpc kernel: ACPI BIOS Error (bug): \_SB.PCI0._OSC: Excess arguments - ASL declared 5, ACPI requires 4 (20160831/nsarg
Ara 18 21:36:16 notebookpc avahi-daemon[530]: chroot.c: open() failed: No such file or directory
Ara 18 21:36:27 notebookpc minissdpd[645]: setsockopt(udp, IP_ADD_MEMBERSHIP)(0.0.0.0): No such device
Ara 18 21:37:06 notebookpc pulseaudio[1103]: [pulseaudio] pid.c: Daemon already running.
Ara 18 21:50:47 notebookpc sudo[1229]: pam_unix(sudo:auth): conversation failed
Ara 18 21:50:47 notebookpc sudo[1229]: pam_unix(sudo:auth): auth could not identify password for [battalgazi]
Ara 18 21:50:47 notebookpc sudo[1229]: battalgazi : 1 incorrect password attempt ; TTY=unknown ; PWD=/home/battalgazi ; USER=root ; COMMAND=

Bu yukarıdaki çıktı da şu hata ;

Kod:
[u][i][i][b]Ara 18 21:36:01 notebookpc kernel: ACPI BIOS Error (bug): \_SB.PCI0._OSC: Excess arguments - ASL declared 5, ACPI requires 4 (20160831/nsarg[/b][/i][/i][/u] hatanın çözümü [url=https://askubuntu.com/questions/160036/how-do-i-disable-acpi-when-booting]https://askubuntu.com/questions/160036/how-do-i-disable-acpi-when-booting[/url] adresinde çözümü bulunmaktadır.

Tail -f komutundaki gibi yeni gelen logları takip için:

Kod:
# journalctl -f

Belirli bir tarihten sonraki logları görmek için:

Kod:
# journalctl -p warning --since="yıl-ay-gün saat:dakika:saniye"

ÖRNEK ÇIKTI:

Kod:
# journalctl -p warning --since="2020-12-18 21:36:01"

Kod:
-- Logs begin at Fri 2020-12-18 21:36:01 +03, end at Fri 2020-12-18 22:50:21 +03. --
Ara 18 21:36:01 notebookpc kernel: core: PEBS disabled due to CPU errata
Ara 18 21:36:01 notebookpc kernel: Simple Boot Flag value 0x5 read from CMOS RAM was invalid
Ara 18 21:36:01 notebookpc kernel: mtrr: your CPUs had inconsistent variable MTRR settings
Ara 18 21:36:01 notebookpc kernel: [Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness
Ara 18 21:36:01 notebookpc kernel: ACPI BIOS Error (bug): \_SB.PCI0._OSC: Excess arguments - ASL declared 5, ACPI requires 4 (20160831/nsarg
Ara 18 21:36:01 notebookpc kernel: pnp 00:00: disabling [io  0x164e-0x164f] because it overlaps 0000:00:1e.0 BAR 13 [io  0x1000-0x1fff]
Ara 18 21:36:06 notebookpc kernel: ACPI Warning: SystemIO range 0x0000000000000428-0x000000000000042F conflicts with OpRegion 0x000000000000
Ara 18 21:36:06 notebookpc kernel: ACPI Warning: SystemIO range 0x0000000000000428-0x000000000000042F conflicts with OpRegion 0x000000000000
Ara 18 21:36:06 notebookpc kernel: ACPI Warning: SystemIO range 0x0000000000000500-0x000000000000052F conflicts with OpRegion 0x000000000000
Ara 18 21:36:06 notebookpc kernel: lpc_ich: Resource conflict(s) found affecting gpio_ich

Kaynaklar:

Kod:
http://www.freedesktop.org/wiki/Software/systemd/
https://access.redhat.com/articles/754933
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html
http://0pointer.de/blog/projects/why.html
https://wiki.debian.org/systemd
 
Geri
Üst