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

File exercises-log-management-syslog-ng.txt, 1.8 KB (added by admin, 9 years ago)
Line 
1Advanced Registry Operations Curriculum
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. Configure your virtual routers to send syslog messages to your server:
55
56        (Note: since you are working with 1 router / 2 PCs, you will need
57        to configure your router send to 2 hosts:
58
59        Hint: Use rancid clogin!
60
61        rtrX# config terminal
62        rtrX(config)# logging PC1
63        rtrX(config)# logging PC2
64        rtrX(config)# logging facility local5
65        rtrX(config)# logging userinfo
66        rtrX(config)# exit
67        rtrX# write memory
68        rtrX# exit
69
70        logout from the router (exit)
71
726. On your PC, See if messages are starting to appear under
73
74        /var/log/network/2010/02/26/...
75
767. If not, try to login back into the router, and run some "config" commands,
77   then logout.
78