NetScreenのログをSyslogサーバに送信する

UDP 514番ポートを使用

NetScreenのログをSyslogサーバに送信する設定

Configuration > Report Settings > Syslog

☑Enable syslog messages

Syslog servers

No. x
Enable
IP/Hostname xxx.xxx.xxx.xxx
Port 514
Security Facility LOCAL7
Facility LOCAL7
Event Log 任意
Traffic Log 任意
TCP

rsyslogの設定(Ubuntu 10.04)

$ cd /etc/rsyslog.d
$ sudo vi netscreen.conf
------------------------
$ModLoad imudp
$UDPServerRun 514
local7.* /var/log/netscreen.log
------------------------

設定を有効にするためにデーモンを再起動する
$ sudo /etc/init.d/rsyslog restart
!! *.* ってなってるところにもログが残るから注意して !!

NetScreenのログを簡略化するスクリプト

#!/usr/bin/env ruby

STDIN.each_line{|line|
  if line =~ /.+device_id=(\S+)\s+.+start_time="(.*)".+duration=(\S+).+src=(\S+)\s+dst=(\S+)\s+src_port=(\S+)\s+dst_port=(\S+)\s+/
    print "device_id=" + $1
    print " start_time=" + $2
    print " duration=" + $3
    print " src=" + $4 + ":" + $6
    print " dest=" + $5 + ":" + $7
    print "\n"
  end
}

あってる?