LoginSignup
8

More than 5 years have passed since last update.

posted at

updated at

Buffalo AirStation WSR-300HPのsyslog設定手順

本体設定

syslogサーバーにIPアドレスを入れるだけです
rapture_20170827001002.png


サーバー設定

環境

raspberry pi2 on centos7

# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

設定手順

コメントアウトを外して、syslogサーバーを有効にする。
user.* /var/log/任意の名前.logを追記する。

/etc/rsyslog.conf
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

---
user.*                                                  /var/log/router.log

ポートを開ける

  • firewalldを使用
# firewall-cmd --get-services | grep syslog
syslog が存在することを確認

# firewall-cmd --add-service=syslog --zone=public --permanent
success

# firewall-cmd --reload
success

# iptables -L -n
Chain IN_public_allow (1 references)
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:514 ctstate NEW
  • rsyslog再起動
# sudo service rsyslog restart

以上

トラブルシューティング。苦労した点。

WSR-300HP syslogサーバー設定でググっても当該ルータのファシリティ情報がない。
いちおうBuffaloの古い機種で、local1を使っているようなので、そちらを設定したが、書き込まれない。
(だからこれ書いたってのもある)

ポート待受を確認

# netstat -ano | grep :514
udp        0      0 0.0.0.0:514             0.0.0.0:*                           off (0.00/0/0)
udp6       0      0 :::514                  :::*

パケット調査

ちゃんとデータ受け取ってるか。

# tcpdump -s0 -i eth0 -X port 514
00:57:43.799229 IP gateway.35228 > gw01.syslog: SYSLOG user.warning, length: 75
        0x0000:  4500 0067 0000 4000 4011 b836 c0a8 00fe  E..g..@.@..6....
        0x0010:  c0a8 0001 899c 0202 0053 8f92 3c31 323e  .........S..<12>
        0x0020:  5b38 383a 3537 3a45 453a 3933 3a38 303a  [88:57:EE:xx:xx:
        0x0030:  4331 5d20 4150 3338 4742 2041 5554 483a  xx].AP.AUTH:
        0x0040:  2041 7574 6865 6e74 6963 6174 6564 2055  .Authenticated.U
        0x0050:  7365 7220 2d20 4530 3a35 463a 3435 3a43  ser.-.E0:5F:45:x
        0x0060:  443a 3841 3a42 33                        x:xx:xx
00:57:43.883136 IP gateway.35228 > gw01.syslog: SYSLOG user.warning, length: 88
        0x0000:  4500 0074 0000 4000 4011 b829 c0a8 00fe  E..t..@.@..)....
        0x0010:  c0a8 0001 899c 0202 0060 f295 3c31 323e  .........`..<12>
        0x0020:  5b38 383a 3537 3a45 453a 3933 3a38 303a  [88:57:EE:xx:xx:
        0x0030:  4331 5d20 4150 3338 4742 2057 4952 454c  xx].AP.WIREL
        0x0040:  4553 533a 2041 2077 6972 656c 6573 7320  ESS:.A.wireless.
        0x0050:  636c 6965 6e74 2063 6f6e 6e65 6374 6564  client.connected
        0x0060:  202d 2045 303a 3546 3a34 353a 4344 3a38  .-.E0:5F:45:xx:x
        0x0070:  413a 4233                                x:xx

ファシリティの調査

/etc/rsyslog.conf
~
$template out1,"%timegenerated% %syslogpriority-text% %syslogfacility-text% %msg%\n"
*.*    /var/log/all.log;out1
~
/var/log/all.log
Aug 26 09:10:27 warning user xx:xx:xx:xx:xx] WSR-300HP WIRELESS: A wireless client connected - xx:xx:xx:xx:xx:xx
Aug 26 09:10:27 info user xx:xx:xx:xx:xx] WSR-300HP DHCPS: received DISCOVER : xx:xx:xx:xx:xx:xx
Aug 26 09:10:27 info user xx:xx:xx:xx:xx] WSR-300HP DHCPS: sending OFFER of 192.168.0.130
Aug 26 09:10:27 info user xx:xx:xx:xx:xx] WSR-300HP DHCPS: received REQUEST : xx:xx:xx:xx:xx:xx
Aug 26 09:10:27 info user xx:xx:xx:xx:xx] WSR-300HP DHCPS: IP: 192.168.0.130 to MAC address xx:xx:xx:xx:xx:xx

どうやらlocal0~7どれでもなく、userだったと、ここで気づいた。
というか、tcpdumpでもfacilityを確認できるのをこれを書いてる最中に気づいた。
touch /var/log/local0~7やったり、tcpの514有効にしたり、いろいろ試行錯誤して2時間位かかった。
syslogについてだいぶ勉強になりました。

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
What you can do with signing up
8