journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme
journalctl ile systemd günlüklerini okuyarak ve logrotate kullanarak günlük dosyalarının diskleri doldurmasını önleyerek otomatik sistemleri sağlıklı tutun.
journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme, CoddyKit'te ücretsiz bir Linux Command Line Mastery dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Linux Command Line Mastery öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Linux Command Line Mastery kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Automation Needs Logs
Cron jobs, systemd services, and shell functions all produce output. To run unattended systems you must capture, search, and rotate that output. Enter journalctl and logrotate.
What Is journald?
systemd-journald collects logs from services you manage with systemctl into a structured binary journal you query with journalctl.
Viewing Logs
Plain journalctl shows everything; -e jumps to the end (newest entries).
journalctl -eFiltering by Service
-u limits the journal to one unit, perfect for debugging a single service.
journalctl -u nginx.serviceFollowing Logs Live
-f streams new entries as they arrive, like tail -f for systemd.
journalctl -u nginx.service -fFiltering by Time and Priority
--since and -p narrow results. Here we show errors from the last hour.
journalctl --since '1 hour ago' -p errControlling Journal Size
Journals can grow large. --vacuum-size trims them to a target size.
sudo journalctl --vacuum-size=200MPlain-Text Logs and logrotate
Many apps still write to /var/log/*.log. logrotate rotates, compresses, and deletes these on a schedule so disks do not fill.
cat /etc/logrotate.confA logrotate Rule
Drop a config in /etc/logrotate.d/. This rotates daily, keeps 7 copies, and compresses old ones.
/var/log/myapp/*.log {
daily
rotate 7
compress
missingok
notifempty
}Testing logrotate
-d does a debug dry run that shows what would happen without changing files; -f forces an immediate rotation.
sudo logrotate -d /etc/logrotate.d/myappTying It to Automation
Have cron jobs and functions log to a dedicated file, manage that file with a logrotate rule, and use journalctl for everything run as a systemd service. Now nothing fills the disk silently.
Quick Check
Which journalctl option shows logs for a single systemd service?
Recap
You can keep automated systems observable and tidy:
journalctl -u,-f,--since,-pquery systemd logs--vacuum-sizetrims the journallogrotaterotates/compresses plain-text logs via/etc/logrotate.d/logrotate -ddry-runs your config
Sıkça Sorulan Sorular
“journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme” dersi ücretsiz mi?
Evet — “journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Linux Command Line Mastery kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Linux Command Line Mastery kursu toplamda 4 dersten oluşur.
“journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme” dersinde ne öğreneceğim?
journalctl ile systemd günlüklerini okuyarak ve logrotate kullanarak günlük dosyalarının diskleri doldurmasını önleyerek otomatik sistemleri sağlıklı tutun. Linux Command Line Mastery ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Linux Command Line Mastery öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Linux Command Line Mastery, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Linux Command Line Mastery dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Linux Command Line Mastery dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- İş Zamanlama: `cron` ve `at`
- Hizmet Yönetimi: `systemctl` (systemd)
- Kabuk İşlevleriyle Görev Otomasyonu
- journald ve logrotate ile Merkezi Günlük Kaydı ve Döndürme