Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3135

Photon Linux のシステムログの永続化。(Journald)

$
0
0

VMware Photon Linux は、Journald でログ管理されています。

しかも、syslog はインストールされておらず、

ISO ファイルにも、Yum リポジトリにも syslog や、 rsyslog は用意されていないようです。

root [ ~ ]# cat /etc/photon-release

VMware Photon Linux 1.0 TP1

root [ ~ ]# mount /dev/cdrom /media/cdrom

mount: /dev/sr0 is write-protected, mounting read-only

root [ ~ ]# tdnf repolist

repo id             repo name                               status

photon-iso          VMWare Photon Linux 1.0(x86_64)         enabled

photon-updates      VMware Photon Linux 1.0(x86_64)Updates  enabled

photon-extras       VMware Photon Extras 1.0(x86_64)        enabled

photon              VMware Photon Linux 1.0(x86_64)         enabled

root [ ~ ]# tdnf list syslog rsyslog

Error(1011) : No matching packages to list

root [ ~ ]# tdnf search syslog

Error(1601) : No matches found ★RPM は無い様子。


Journald は、デフォルトで「Storage=auto」なので

CentOS 7.x / RHEL 7.x / Oracle Linux 7.x 同様、ログファイルは永続化されません。

 

デフォルトで保存されるのは、/run/log/journal ディレクトリ配下です。

root [ ~ ]# file /run/log/journal/*/system.journal

/run/log/journal/49ff8ac6e7c34805ba3c9db3afa77eb6/system.journal: Journal file, online, compressed

 

この領域はメモリベースのファイルシステムのため、

OS を再起動するとシステムログが消えてしまいます。

root [ ~ ]# df -h /run

Filesystem      Size  Used Avail Use% Mounted on

tmpfs           497M  496K  497M   1% /run

 

そこで、/var/log/journal ディレクトリ を作成して、Journald を再起動すると、

ログファイルの出力先が変更されて永続化されるようになります。

root [ ~ ]# mkdir /var/log/journal

root [ ~ ]# ls -a /var/log/journal

.  ..  ★まだログファイルはない。

root [ ~ ]# systemctl restart systemd-journald

root [ ~ ]#

root [ ~ ]# ls -a /var/log/journal

root [ ~ ]# file /var/log/journal/*/*

/var/log/journal/49ff8ac6e7c34805ba3c9db3afa77eb6/system.journal: Journal file, online, compressed

 

一方、OS 再起動して、これまでログが出力されていた /run/log ディレクトリを見ると、

journald ディレクトリはなくなり、ここにはログファイルも出力されなくなります。

root [ ~ ]# ls -a /run/log/

.  ..

 

ちなみに、Journald の設定ファイルは /etc/systemd/journald.conf です。

※デフォルトだと、パラメータすべてコメントアウトされています。

root [ ~ ]# cat /etc/systemd/journald.conf

#  This file is part of systemd.

#

#  systemd is free software; you can redistribute it and/or modify it

#  under the terms of the GNU Lesser General Public License as published by

#  the Free Software Foundation; either version 2.1 of the License, or

#  (at your option) any later version.

#

# See journald.conf(5) for details

 

[Journal]

#Storage=auto

#Compress=yes

#Seal=yes

#SplitMode=uid

#SyncIntervalSec=5m

#RateLimitInterval=30s

#RateLimitBurst=1000

#SystemMaxUse=

#SystemKeepFree=

#SystemMaxFileSize=

#RuntimeMaxUse=

#RuntimeKeepFree=

#RuntimeMaxFileSize=

#MaxRetentionSec=

#MaxFileSec=1month

#ForwardToSyslog=no

#ForwardToKMsg=no

#ForwardToConsole=no

#ForwardToWall=yes

#TTYPath=/dev/console

#MaxLevelStore=debug

#MaxLevelSyslog=debug

#MaxLevelKMsg=notice

#MaxLevelConsole=info

#MaxLevelWall=emerg

 

以上、Photon Linux のシステムログの永続化でした。


Viewing all articles
Browse latest Browse all 3135

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>