Archive and statistics » History » Version 9

Janez Barbic, 12.12.2010 16:31

1 1 Aleksander Bešir
h1. Archive and statistics
2 1 Aleksander Bešir
3 6 Janez Barbic
WIP - trenutno se delam na dokumentu, ne se brat :)
4 6 Janez Barbic
5 2 Aleksander Bešir
{{toc}}
6 2 Aleksander Bešir
7 5 Janez Barbic
TBD - to be discussed
8 5 Janez Barbic
TODO - to do :)
9 5 Janez Barbic
Tole sem pustil zaenkrat not, da lahko hitro najdem stvari, ki jih moram se dopolnit oziroma jih moramo se predebatirat. V koncni verziji se bom teh kratic znebil in tudi tega komentarja v slovenscini :)
10 1 Aleksander Bešir
11 6 Janez Barbic
h2. 1 Basic concept
12 3 Janez Barbic
13 3 Janez Barbic
TODO Zakaj syslog
14 3 Janez Barbic
15 3 Janez Barbic
Eneraptor is designed in a way that it could communicate with any device regardless of its operating system. Syslog, system for logging program messages offers a quick and easy solutions for such communications, because it allows separation of the software that generates messages from the system that stores them and the software that reports and analyzes them. It could refer to syslog protocol (TODO described below), 
16 3 Janez Barbic
17 3 Janez Barbic
h3. 1.1 Hardware
18 1 Aleksander Bešir
19 5 Janez Barbic
p. We will be using syslog-ng (I will be referring to it as syslog from now on), which has a few advantages over conventional syslog. Syslog daemon will run on proxy server. TBD it will be listening on a certain port for incoming messages from client(s). Our main syslog client will run on FRI-SMS system.
20 1 Aleksander Bešir
21 5 Janez Barbic
Client mode operation:
22 5 Janez Barbic
23 1 Aleksander Bešir
!https://lusy.fri.uni-lj.si/redmine/attachments/11/client_server_syslog.png!
24 1 Aleksander Bešir
25 5 Janez Barbic
p. In client mode, syslog-ng collects the local logs generated by the host and forwards them through a network connection to the central syslog-ng server. Clients can also log the messages locally into files.
26 5 Janez Barbic
27 5 Janez Barbic
28 5 Janez Barbic
TODO more details on syslog-ng advantages
29 5 Janez Barbic
30 5 Janez Barbic
h3. 1.2 Syslog protocol overview
31 5 Janez Barbic
32 5 Janez Barbic
TBD TCP/IP vs UDP
33 5 Janez Barbic
Message structure
34 5 Janez Barbic
TBD How do we plan to send messages to our daemon, via client (not always possible) or do we generate them ourselves?
35 5 Janez Barbic
TBD Using logfiles vs logging into database
36 5 Janez Barbic
37 5 Janez Barbic
h3. 1.3 Development steps
38 5 Janez Barbic
39 5 Janez Barbic
# Installing and configuring Syslog-ng daemon on proxy
40 5 Janez Barbic
# Installing and configuring Syslog-ng client on FRI-SMS
41 5 Janez Barbic
# TBD Designing Statistical Data Analysis Software to work with data collected by syslog daemon
42 5 Janez Barbic
# TBD Implementing SDA software
43 1 Aleksander Bešir
# TBD Testing?
44 6 Janez Barbic
45 6 Janez Barbic
46 6 Janez Barbic
h2. 2 Installing and configuring syslog-ng daemon on proxy
47 7 Janez Barbic
48 7 Janez Barbic
p. Syslog-ng supports wide variety of Operating Systems so we aren't really restricted here. Since our proxy and FRI-SMS both run Linux 2.6 our obvious choce is syslog-ng for Linux.
49 9 Janez Barbic
50 1 Aleksander Bešir
h3. 2.1 syslog-ng daemon on proxy
51 9 Janez Barbic
52 7 Janez Barbic
Configuration file location:
53 7 Janez Barbic
/opt/syslog-ng/etc/syslog-ng.conf
54 7 Janez Barbic
55 8 Janez Barbic
Basic syslog configuration:
56 8 Janez Barbic
TODO add filters
57 7 Janez Barbic
<pre><code class="ruby">
58 7 Janez Barbic
@version: 3.2
59 7 Janez Barbic
#Default configuration file for syslog-ng.
60 7 Janez Barbic
#
61 7 Janez Barbic
# For a description of syslog-ng configuration file directives, please read
62 7 Janez Barbic
# the syslog-ng Administrator's guide at:
63 7 Janez Barbic
#
64 7 Janez Barbic
# http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/bk01-toc.html
65 7 Janez Barbic
#
66 1 Aleksander Bešir
67 1 Aleksander Bešir
options {
68 8 Janez Barbic
   time_reap(30);
69 8 Janez Barbic
   mark_freq(10);
70 8 Janez Barbic
   keep_hostname(yes);
71 8 Janez Barbic
};
72 7 Janez Barbic
73 7 Janez Barbic
######
74 7 Janez Barbic
# sources
75 7 Janez Barbic
source s_local {
76 7 Janez Barbic
};
77 7 Janez Barbic
78 7 Janez Barbic
source s_net {
79 8 Janez Barbic
   tcp(ip("SERVER_ADDRESS") port(5140) keep-alive(yes)); 
80 7 Janez Barbic
};
81 7 Janez Barbic
82 7 Janez Barbic
######
83 7 Janez Barbic
# destinations
84 8 Janez Barbic
# should be able to point syslog to a database here
85 7 Janez Barbic
destination net_messages { file("/var/log/net_messages"); };
86 7 Janez Barbic
87 7 Janez Barbic
log {
88 7 Janez Barbic
source(s_net);
89 7 Janez Barbic
destination(net_messages);
90 7 Janez Barbic
};
91 7 Janez Barbic
</code></pre>
92 6 Janez Barbic
93 6 Janez Barbic
h3. 2.2 syslog-ng client on FRI-SMS
94 9 Janez Barbic
95 9 Janez Barbic
Configuration file location:
96 9 Janez Barbic
/opt/syslog-ng/etc/syslog-ng.conf
97 9 Janez Barbic
98 9 Janez Barbic
Basic syslog client configuration:
99 9 Janez Barbic
TODO add filters
100 9 Janez Barbic
101 9 Janez Barbic
<pre><code class="ruby">
102 9 Janez Barbic
@version: 3.2
103 9 Janez Barbic
#Default configuration file for syslog-ng.
104 9 Janez Barbic
#
105 9 Janez Barbic
# For a description of syslog-ng configuration file directives, please read
106 9 Janez Barbic
# the syslog-ng Administrator's guide at:
107 9 Janez Barbic
#
108 9 Janez Barbic
# http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/bk01-toc.html
109 9 Janez Barbic
#
110 9 Janez Barbic
111 9 Janez Barbic
options {
112 9 Janez Barbic
};
113 9 Janez Barbic
114 9 Janez Barbic
######
115 9 Janez Barbic
# sources
116 9 Janez Barbic
source s_local {
117 9 Janez Barbic
   # TBD what triggers our messages
118 9 Janez Barbic
   # message generated by Syslog-NG
119 9 Janez Barbic
   internal();
120 9 Janez Barbic
   # standard Linux log source (this is the default place for the syslog()
121 9 Janez Barbic
   # function to send logs to)
122 9 Janez Barbic
   unix-stream("/dev/log");
123 9 Janez Barbic
   # messages from the kernel
124 9 Janez Barbic
   file("/proc/kmsg" program_override("kernel"));
125 9 Janez Barbic
};
126 9 Janez Barbic
127 9 Janez Barbic
128 9 Janez Barbic
######
129 9 Janez Barbic
# destinations
130 9 Janez Barbic
# local
131 9 Janez Barbic
# destination d_messages { file("/var/log/messages"); };
132 9 Janez Barbic
# net
133 9 Janez Barbic
destination host { tcp("SERVER_ADDRESS" port(5140)); };
134 9 Janez Barbic
135 9 Janez Barbic
# logging locally
136 9 Janez Barbic
# log {
137 9 Janez Barbic
#   source(s_local);
138 9 Janez Barbic
#   destination(d_messages);
139 9 Janez Barbic
#};
140 9 Janez Barbic
141 9 Janez Barbic
# sending log messages
142 9 Janez Barbic
log {
143 9 Janez Barbic
   source(s_local);
144 9 Janez Barbic
   destination(host);
145 9 Janez Barbic
};
146 9 Janez Barbic
</code></pre>