0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

/var/log/messagesの日付フォーマットの変更

Posted at

概要

  • ラズパイの/var/logm/messegesの日付フォーマットを変更
  • 変更前:Aug 13 21:36:37
  • 変更後:2022/08/13 22:06:41

実行コマンド

# /etc/rsyslog.d/にtemplate.confを作成
touch /etc/rsyslog.d/template.conf
chmod 644 /etc/rsyslog.d/template.conf

# 以下を書き込み
$template template, "%timegenerated:::date-year%/%timegenerated:::date-month%/%timegenerated:::date-day% %timegenerated:::date-hour%:%timegenerated:::date-minute%:%timegenerated:::date-second% %HOSTNAME% %syslogtag% %msg%\n"
# 日付をyyyy/MM/ddの形で表示

# rsyslog.confの編集(以下は編集結果)
# diff /etc/rsyslog.conf_org /etc/rsyslog.conf
87c87
<       mail,news.none          -/var/log/messages
---
>       mail,news.none          -/var/log/messages;template

# プロセス再起動
systemctl restart rsyslog
systemctl status rsyslog

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?