0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

今さならながらsyslog

0
Posted at

syslog動作を確認

syslogをまともに意識したことがなかったので、syslog serverを立てて、動作を確認することとした。

環境

Topology.png

例によって、GNS3環境利用。一番右にある機器が、syslog server (by Ubuntu)、その左隣が、syslog clientかつルーター(Cisco相当)である。そのさらに左隣のルーター(R1)とEIGRPで繋がり、EIGRPメッセージや起動時の情報がログ化され、syslog sererに送られる、、、というもの。IPアドレスは記載のとおり。

設定

関連する部分のみ記載。

syslog client

interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.0

interface Ethernet1/0
 ip address 10.1.1.1 255.255.255.0

router eigrp 10
 network 10.1.1.0 0.0.0.255
 network 192.168.1.0

logging host 10.1.1.2

最後の”logging host”で、syslog serverであるUbuntuのIPアドレスを指定している。

R1

interface FastEthernet0/0
 ip address 192.168.1.2 255.255.255.0

interface FastEthernet1/0
 ip address 172.16.1.1 255.255.255.0

router eigrp 10
 network 172.16.1.0 0.0.0.255
 network 192.168.1.0
 auto-summary

syslog server

/etc/rsyslog.conf
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")

# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
$ sudo systemctl restart rsyslog

検証

ロギング開始

syslog clientでのロギング開始の状況。

Router(config)#logging host 10.1.1.2
Router(config)#
*Mar 22 05:06:16.586: %SYS-6-LOGGINGHOST_STARTSTOP: Logging to host 10.1.1.2 port 514 started - CLI initiated

syslog clientクライアントでのアクションおよびsyslog serverでの記録状況(/var/log/syslog)

インターフェースDownUp

syslog clientクライアントであるインターフェースをDownさせ、再度Upする。

Router(config)#interface ethernet 0/0
Router(config-if)#shut

*Mar 22 05:09:48.174: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 22 05:09:49.178: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down

Router(config-if)#no shut

*Mar 22 05:10:14.625: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar 22 05:10:15.633: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

この時のsyslog serverの/var/log/syslog

2026-03-22T05:09:49.186238+00:00 10.1.1.1 68: *Mar 22 05:09:48.174: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
2026-03-22T05:09:49.186238+00:00 10.1.1.1 69: *Mar 22 05:09:49.178: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down

2026-03-22T05:10:15.609392+00:00 10.1.1.1 70: *Mar 22 05:10:14.625: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
2026-03-22T05:10:16.614140+00:00 10.1.1.1 71: *Mar 22 05:10:15.633: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

近接ルーターインターフェースDownUpによるEIGRP状況通知

syslog clientがEIGRPの状態変化を検知し、syslog serverに情報を送った状況(/var/log/syslog)。まずは、Down(shut)。

2026-03-24T11:23:01.718667+00:00 10.1.1.1 60: *Mar 24 11:23:00.520: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 192.168.1.2 (Ethernet0/0) is down: holding time expired

再度Up(no shut)。

2026-03-24T11:23:38.295115+00:00 10.1.1.1 61: *Mar 24 11:23:37.093: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 192.168.1.2 (Ethernet0/0) is up: new adjacency

Wiresharkで取得したデータ

syslog clientとsyslog serverとの間で取得したキャプチャデータの紹介

syslog1のコピー.png
syslog2のコピー.png

当たり前ではあるが、/var/log/syslogに記録されている情報が転送されていることがわかる。このCiscoルーターはUDPを利用しているようだ。

EOF

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?