下記のサイトを参考にして「sshサーバ側で操作ログを取得」したい
設定致しました。
http://u888u.info/nuGo
(1).bash_profileに下記を記述
下記を一番下に追記
Auto_System Log.
P_PROC=ps aux | grep $PPID | grep sshd | grep -v 'cat*' | grep -v 'less*' | grep -v 'more*' | grep -v 'tac*' | grep -v 'tail*' | grep -v 'ls*' | awk '{ print $11 }'
if [ "$P_PROC" = sshd: ]; then
script -fq /var/log/auto_log/date +%Y%m%d_%H%M%S
_$USER.log
exit
fi
(2)/va/log/ 配下にログの吐き出しディレクトリを作成
mkdir auto_log
(3) etc/logrotate.d/ 配下に ログの出力ファイルを作成し、下記の実行内容記載
touch auto_log
vi auto_log
/var/log/auto_log/*log {
sharedscripts
postrotate
/bin/kill -HUP cat /var/run/syslogd.pid 2> /dev/null
2> /dev/null || true
endscript
}
■質問内容■
(1)で下記のコマンドで確認するための下記のコマンドの出力結果を
”除外したい”のですが、うまくいきません。
<除外対象>
cat
less
more
tac
tail
ls
どのように設定したらいいでしょうか。
#特にcat /var/log/messages 等の長いログの結果は表示したくありません。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/08/27 07:27
2015/08/27 12:21