Agenda: exercises-log-management-syslog-ng.txt

File exercises-log-management-syslog-ng.txt, 1.7 KB (added by regnauld, 8 years ago)
Line 
1Network Management & Monitoring
2Using syslog-ng
3
4Notes:
5------
6* Commands preceded with "$" imply that you should execute the command as
7  a general user - not as root.
8* Commands preceded with "#" imply that you should be working as root.
9* Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>")
10  imply that you are executing commands on remote equipment, or within
11  another program.
12
13Exercises
14---------
15
161. Install syslog-ng
17
18        # apt-get install syslog-ng
19
202. Edit /etc/syslog-ng/syslog-ng.conf
21
22Find the lines:
23
24        # (this is equivalent to the "-r" syslogd flag)
25        # udp();
26
27and change it to:
28
29        # (this is equivalent to the "-r" syslogd flag)
30        udp();
31
32At the bottom of the file, add:
33
34filter f_routers { facility(local5); };
35log {
36        source(s_all);
37        filter(f_routers);
38        destination(routers);
39};
40destination routers {
41 file("/var/log/network/$YEAR/$MONTH/$DAY/$HOST-$YEAR-$MONTH-$DAY-$HOUR.log"
42 owner(root) group(root) perm(0644) dir_perm(0755) create_dirs(yes)
43 template("$YEAR $DATE $HOST $MSG\n"));
44};
45
463. Create the directory /var/log/network/
47
48        # mkdir /var/log/network/
49
504. Restart syslog-ng:
51
52        # /etc/init.d/syslog-ng restart
53
545. If you haven't not already done so during the presentation:
55
56Configure your virtual routers to send syslog messages to your server:
57
58        rtrX# config terminal
59        rtrX(config)# logging 10.10.X.1
60        rtrX(config)# logging facility local5
61        rtrX(config)# logging userinfo
62        rtrX(config)# exit
63        rtrX# write memory
64        rtrX# exit
65
66        logout from the router (exit)
67
686. On your PC, See if messages are starting to appear under
69
70        /var/log/network/2010/02/26/...
71
727. If not, try to login back into the router, and run some "config" commands,
73   then logout.
74