LoginSignup
2
2

More than 5 years have passed since last update.

syslogの出力をsyslogdのrestart毎にファイル分割する

Posted at

rsyslogの場合はキーワードが違うのでそのままでは使えません。
messagesのファイル名はRHEL5までのファイル名に合わせてあります。

split_syslog_restart.sh
FILE="tmp"; for i in messages.4 messages.3 messages.2 messages.1 messages; do while read LINE; do if echo $LINE|grep -q restart; then FILE="`echo $LINE|awk '{ print $1$2$3 }'`.log"; fi; echo $LINE >> $FILE; done < $i; done
2
2
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
2
2