2012-11-05から1日間の記事一覧

rubyでsyslog監視1

PG

rubyの勉強です。syslogを監視して、決めたキーワードの時にメッセージを送る。 [root@ns ruby_test 22:53:58]# cat read_msg.rb pattern = Regexp.new("apache") filename = "/var/log/messages" file = open(filename) while text = file.gets do if patte…