質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
logrotate

logrotateはログの世代管理やサイズ制限を行うLinux標準のツールです。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Red Hat Enterprise

Red Hat Enterpriseは、レッドハット社により開発・サポートが行われている業務向けLinuxディストリビューションです。オープンソースで無償で利用することができ、バイナリ版の入手・サポートは有償です。商用ディストリビューションとして人気が高く、代表的なLinuxの選択肢の一つです。

Q&A

解決済

1回答

944閲覧

rsyslogのファイル名について

ahahahahahaha

総合スコア21

logrotate

logrotateはログの世代管理やサイズ制限を行うLinux標準のツールです。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Red Hat Enterprise

Red Hat Enterpriseは、レッドハット社により開発・サポートが行われている業務向けLinuxディストリビューションです。オープンソースで無償で利用することができ、バイナリ版の入手・サポートは有償です。商用ディストリビューションとして人気が高く、代表的なLinuxの選択肢の一つです。

0グッド

0クリップ

投稿2018/09/05 05:58

/var/log 配下に作成される
syslog.2.gz
syslog.3.gz
syslog.4.gz

上記のファイル名を
syslog.YYY.MM.DD.gzに変更する方法を教えていただきたく。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

OS がわかりませんが、 linux なら rsyslog じゃなくて、logrotate ではないでしょうか?

logrotate のファイル名をデフォルトから変更する方法は、マニュアル
logrotate(8) - Linux man page の Configuration File に

dateext
Archive old versions of log files adding a daily extension like YYYYMMDD instead of simply adding a number. The extension may be configured using the dateformat option.

dateformat format_string
Specify the extension for dateext using the notation similar to strftime(3) function. Only %Y %m %d and %s specifiers are allowed. The default value is -%Y%m%d. Note that also the character separating log name from the extension is part of the dateformat string. The system clock must be set past Sep 9th 2001 for %s to work correctly. Note that the datestamps generated by this format must be lexically sortable (i.e., first the year, then the month then the day. e.g., 2001/12/01 is ok, but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later). This is because when using the rotate option, logrotate sorts all rotated filenames to find out which logfiles are older and should be removed.

とありますので、 /etc/logrotate.d/ にある対象ログファイルの設定ファイルに

ファイル名の形式が、log-YYYYMMDD なら dateext

ファイル名の形式が、log-YYYY.MM.DD なら dateformat %Y.%m.%d

設定してください。

投稿2018/09/05 07:59

編集2018/09/05 23:09
CHERRY

総合スコア25171

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

ahahahahahaha

2018/09/06 02:44

設定できました! 助かりました~
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問