The text of a manual · part 25 of 49
Cyclades-TS User Guide: Chapter 3 - Additional Features, pages 237 to 246
Pages 237 to 246 of 454, from Cyclades-TS User Guide
The original document is the PDF (4.3 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Cyclades TS2000 and Avocent TS2000
Page 237
Chapter 3 - Additional Features Screen 4: *********************************************************** ********* C O N F I G U R A T I O N W I Z A R D ********* *********************************************************** Current configuration: (The ones with the '#' means it's not activated.) conf.facility : 7 conf.DB_facility : 0 Are these configuration(s) all correct? (y/n) [n] : If you type 'n' Type 'c' to go back and CORRECT these parameters or 'q' to QUIT : Typing 'c' repeats the application, typing 'q' exits the entire wiz application If you type 'y' it leads to Screen 5. Screen 5: *********************************************************** ********* C O N F I G U R A T I O N W I Z A R D ********* *********************************************************** (Note: If you are NOT connected to this unit through a console, and you have just reconfigured the IP of this unit, activating the new configurations may cause you to lose connection. In that case, please reconnect to the unit by the new IP address, and manually issue a saveconf to save your configurations to flash.)
Do you want to activate your configurations now? (y/n) [y] :
User Guide
237
Page 238
Syslog Screen 6: *********************************************************** ********* C O N F I G U R A T I O N W I Z A R D ********* *********************************************************** Flash refers to a type of memory that can be erased and reprogrammed in units of memory known as blocks rather than one byte at a time; thus, making updating to memory easier. If you choose to save to flash, your configurations thus far will still be in the memory of the system even after you reboot it. If you don't save to flash and if you were to reboot the system, all your new configurations will be lost and you will have to reconfigure the system. Do you want to save your configurations to flash? (y/n) [n] :
CLI Method To configure certain parameters for a specific serial port: Step 1: At the command prompt, type in the appropriate command to configure desired parameters. To activate the serial port. <string> should be ttyS<serial port number> : config configure line <serial port number> tty <string> To configure conf.facility: config configure conf facility <number> To configure DB_facility: config configure conf dbfacility <number>
238
Cyclades-TS
Page 239
Chapter 3 - Additional Features Tip. You can configure all the conf parameters in one line. config configure conf facility <number> dbfacility <number>
Step 2: Activate and Save. To activate your new configurations and save them to flash, type: config write (This is essentially typing signal_ras hup and saveconf from the normal terminal prompt.)
The Syslog Functions This section shows the characteristics of the syslog-ng that is implemented for all members of the Cyclades-TS family. It is divided into three parts: 1.
Syslog-ng and its Configuration
2.
Syslog-ng Configuration to use with Syslog Buffering Feature
3.
Syslog-ng Configuration to use with Multiple Remote Syslog Servers
Syslog-ng and its Configuration The five tasks previously mentioned are detailed below. Task 1: Specify Global Options. You can specify several global options to syslog-ng in the options statement: options { opt1(params); opt2(params); ... }; where optn can be any of the following:
User Guide
239
Page 240
Syslog time_reopen(n)
The time to wait before a dead connection is reestablished.
time_reap(n)
The time to wait before an idle destination file is closed.
sync_freq(n)
The number of lines buffered before written to file. (The file is synced when this number of messages has been written to it.)
mark_freq(n)
The number of seconds between two MARKS lines.
log_fifo_size(n)
The number of lines fitting to the output queue.
chain_hostname (yes/no) or long_hostname (yes/no)
Enable/disable the chained hostname format.
use_time_recvd (yes/no)
Use the time a message is received instead of the one specified in the message.
use_dns (yes/no)
Enable or disable DNS usage. syslog-ng blocks on DNS queries, so enabling DNS may lead to a Denial of Service attach.
gc_idle_threshold(n)
Sets the threshold value for the garbage collector, when syslogng is idle. GC phase starts when the number of allocated objects reach this number. Default: 100.
gc_busy_threshold(n)
Sets the threshold value for the garbage collector. When syslogng is busy, GC phase starts.
create_dirs(yes/no)
Enable the creation of new directories.
owner(name)
Set the owner of the created file to the one specified. Default: root.
group(name)
Set the group of the created file to the one specified. Default: root.
perm(mask)
Set the permission mask of the created file to the one specified. Default: 0600.
240
Cyclades-TS
Page 241
Chapter 3 - Additional Features Task 2: Define sources. To define sources use this statement: source <identifier> { source-driver([params]); source driver([params]); ...}; where: identifier
Has to uniquely identify this given source.
source-driver
Is a method of getting a given message.
params
Each source-driver may take parameters. Some of them are required, some of them are optional.
The following source-drivers are available: a) internal() b) unix-stream (filename [options]) and unix-dgram (filename [options])
User Guide
Messages are generated internally in syslog-ng. They open the given AF_UNIX socket, and start listening for messages. Options: owner(name), group(name), perm(mask) are equal global options keep-alive(yes/no) - Selects whether to keep connections opened when syslog-ng is restarted. Can be used only with unix_stream. Default: yes max-connections(n) - Limits the number of simultaneously opened connections. Can be used only with unix_stream. Default: 10.
241
Page 242
Syslog c) tcp([options]) and udp([options])
d) file(filename) e) pipe(filename)
These drivers let you receive messages from the network, and as the name of the drivers show, you can use both TCP and UDP. None of tcp() and udp() drivers require positional parameters. By default they bind to 0.0.0.0:514, which means that syslog-ng will listen on all available interfaces. Options: ip(<ip address>) - The IP address to bind to. Default: 0.0.0.0. port(<number>) - UDP/TCP port used to listen messages. Default: 514. max-connections(n) - Limits the number of simultaneously opened connections. Default: 10. Opens the specified file and reads messages. Opens a named pipe with the specified name, and listens for messages. (You'll need to create the pipe using mkfifo command).
Some Examples of Defining Sources 1) To read from a file: source <identifier> {file(filename);}; Example to read messages from “/temp/file1” file: source file1 {file(‘/temp/file1’);}; Example to receive messages from the kernel: source s_kernel { file(‘/proc/kmsg’); }; 2) To receive messages from local syslogd clients: source sysl {unix-stream(‘/dev/log’);}; 3) To receive messages from remote syslogd clients: source s_udp { udp(ip(<cliente ip>) port(<udp port>)); }; Example to listen to messages from all machines on UDP port 514: source s_udp { udp(ip(0.0.0.0) port(514));};
242
Cyclades-TS
Page 243
Chapter 3 - Additional Features Example to listen to messages from one client (IP address=10.0.0.1) on UDP port 999: source s_udp_10 { udp(ip(10.0.0.1) port(999)); };
Task 3: Define filters. To define filters use this statement: filter <identifier> { expression; }; where: identifier
Has to uniquely identify this given filter.
expression
Boolean expression using internal functions, which has to evaluate to true for the message to pass.
The following internal functions are available: a) facility(<facility code>)
Selects messages based on their facility code.
b) level(<level code>) or priority(<level code>)
Selects messages based on their priority.
c) program(<string>)
Tries to match the <string> to the program name field of the log message.
d) host(<string>)
Tries to match the <string> to the hostname field of the log message.
e) match(<string>)
Tries to match the <string> to the message itself.
Some Examples of Defining Filters 1) To filter by facility: filter f_facilty { facility(<facility name>); };
User Guide
243
Page 244
Syslog Examples: filter f_daemon { facility(daemon); }; filter f_kern { facility(kern); }; filter f_debug { not facility(auth, authpriv, news, mail); }; 2) To filter by level: filter f_level { level(<level name>);}; Examples: filter f_messages { level(info .. warn)}; filter f_emergency { level(emerg); }; filter f_alert { level(alert); }; 3) To filter by matching one string in the received message: filter f_match { match(‘string’); }; Example to filter by matching the string “named”: filter f_named { match(‘named’); }; 4) To filter ALARM messages (note that the following three examples should be one line): filter f_alarm { facility(local[0+<conf.DB_facility>]) and level(info) and match('ALARM') and match('<your string>'); } ; Example to filter ALARM message with the string “kernel panic”: filter f_kpanic { facility(local[0+<conf.DB_facility>]) and level(info) and match('ALARM') and match('kernel panic'); }; Example to filter ALARM message with the string “root login”: filter f_root { facility(local[0+<conf.DB_facility>]) and level(info) and match('ALARM') and match('root login'); };
244
Cyclades-TS
Page 245
Chapter 3 - Additional Features 5) To eliminate sshd debug messages: filter f_sshd_debug { not program('sshd') or not level(debug); }; 6) To filter the syslog_buffering: filter f_syslog_buf { facility(local[0+<conf.DB_facility>]) and level(notice); };
Task 4: Define Actions. To define actions use this statement (note that the statement should be one line): destination <identifier> { destination-driver([params]); destination-driver([param]); ..}; where: identifier
Has to uniquely identify this given destination.
destination driver
Is a method of outputting a given message.
params
Each destination-driver may take parameters. Some of them required, some of them are optional.
The following destination drivers are available: a) file(filename [options]) This is one of the most important destination drivers in syslog-ng. It allows you to output log messages to the named file. The destination filename may include macros (by prefixing the macro name with a '$' sign) which gets expanded when the message is written. Since the state of each created file must be tracked by syslog-ng, it consumes some memory for each file. If no new messages are written to a file within 60 seconds (controlled by the time_reap global option), it's closed, and its state is freed.
User Guide
245
Page 246
Syslog Available macros in filename expansion: HOST - The name of the source host where the message originated from. FACILITY - The name of the facility the message is tagged as coming from. PRIORITY or LEVEL - The priority of the message. PROGRAM - The name of the program the message was sent by. YEAR, MONTH, DAY, HOUR, MIN, SEC - The year, month, day, hour, min, sec of the message was sent. TAG - Equals FACILITY/LEVEL. FULLHOST - The name of the source host and the source-driver: <source-driver>@<hostname> MSG or MESSAGE - The message received. FULLDATE - The date of the message was sent. Available options: log_fifo_size(number) - The number of entries in the output file. sync_freq(number) - The file is synced when this number of messages has been written to it. owner(name), group(name), perm(mask) - Equals global options. template(“string”) - Syslog-ng writes the “string” in the file. You can use the MACROS in the string. encrypt(yes/no) - Encrypts the resulting file. compress(yes/no) - Compresses the resulting file using zlib. b) pipe(filename [options]) This driver sends messages to a named pipe. Available options: owner(name), group(name), perm(mask) - Equals global options. template(“string”) - Syslog-ng writes the “string” in the file. You can use the MACROS in the string. c) unix-stream(filename) and unix-dgram(filename) This driver sends messages to a UNIX socket in either SOCKET_STREAM or SOCK_DGRAM mode. d) udp("<ip address>" port(number);) and tcp("<ip address>" port(number);) This driver sends messages to another host (ip address/port) using either UDP or TCP protocol. e) usertty(<username>) This driver writes messages to the terminal of a logged-in username.
246
Cyclades-TS