📄 sysklogd.8
字号:
files. You must specificallymodify the configuration files to obtain the enhanced behavior..SH SUPPORT FOR REMOTE LOGGINGThese modifications provide network support to the syslogd facility.Network support means that messages can be forwarded from one noderunning syslogd to another node running syslogd where they will beactually logged to a disk file.To enable this you have to specify the.B "\-r"option on the command line. The default behavior is that.B syslogdwon't listen to the network.The strategy is to have syslogd listen on a unix domain socket forlocally generated log messages. This behavior will allow syslogd tointer-operate with the syslog found in the standard C library. At thesame time syslogd listens on the standard syslog port for messagesforwarded from other hosts. To have this work correctly the.BR services (5)files (typically found in.IR /etc )must have the followingentry:.IP.nf syslog 514/udp.fi.PPIf this entry is missing.B syslogdneither can receive remote messages nor send them, because the UDPport cant be opened. Instead .B syslogdwill die immediately, blowing out an error message.To cause messages to be forwarded to another host replacethe normal file line in the.I syslog.conffile with the name of the host to which the messages is to be sentprepended with an @..IPFor example, to forward.B ALLmessages to a remote host use thefollowing.I syslog.confentry:.IP.nf # Sample syslogd configuration file to # messages to a remote host forward all. *.* @hostname.fiTo forward all \fBkernel\fP messages to a remote host theconfiguration file would be as follows:.IP.nf # Sample configuration file to forward all kernel # messages to a remote host. kern.* @hostname.fi.PPIf the remote hostname cannot be resolved at startup, because thename-server might not be accessible (it may be started after syslogd)you don't have to worry..B Syslogdwill retry to resolve the name ten times and then complain. Anotherpossibility to avoid this is to place the hostname in.IR /etc/hosts .With normal.BR syslogd syou would get syslog-loops if you send out messages that were receivedfrom a remote host to the same host (or more complicated to a thirdhost that sends it back to the first one, and so on). In my domain(Infodrom Oldenburg) we accidently got one and our disks filled upwith the same single message. :-(To avoid this no messages received from aremote host are sent out to another (or the same) remote hostanymore. If you experience are setup in which you need this behaviour,please use the.B \-hcommand line switch.However, this option needs to be handled with caution since a syslogloop can fill up hard disks quite fast.If the remote host is located in the same domain as the host, .B syslogdis running on, only the simple hostname will be logged instead ofthe whole fqdn.In a local network you may provide a central log server to have allthe important information kept on one machine. If the network consistsof different domains you don't have to complain about logging fullyqualified names instead of simple hostnames. You may want to use thestrip-domain feature.B \-sof this server. You can tell the.B syslogdto strip off several domains other than the one the server is locatedin and only log simple hostnames.Using the.B \-loption there's also a possibility to define single hosts as localmachines. This, too, results in logging only their simple hostnamesand not the fqdns.The UDP socket used to forward messages to remote hosts or to receivemessages from them is only opened when it is needed. In releasesprior to 1.3-23 it was opened every time but not opened for reading orforwarding respectively..SH OUTPUT TO NAMED PIPES (FIFOs)This version of syslogd has support for logging output to named pipes(fifos). A fifo or named pipe can be used as a destination for logmessages by prepending a pipy symbol (``|'') to the name of thefile. This is handy for debugging. Note that the fifo must be createdwith the mkfifo command before syslogd is started..IPThe following configuration file routes debug messages from thekernel to a fifo:.IP.nf # Sample configuration to route kernel debugging # messages ONLY to /usr/adm/debug which is a # named pipe. kern.=debug |/usr/adm/debug.fi.LP.SH INSTALLATION CONCERNSThere is probably one important consideration when installing thisversion of syslogd. This version of syslogd is dependent on properformatting of messages by the syslog function. The functioning of thesyslog function in the shared libraries changed somewhere in theregion of libc.so.4.[2-4].n. The specific change was tonull-terminate the message before transmitting it to the .I /dev/logsocket. Proper functioning of this version of syslogd is dependent onnull-termination of the message.This problem will typically manifest itself if old statically linkedbinaries are being used on the system. Binaries using old versions ofthe syslog function will cause empty lines to be logged followed bythe message with the first character in the message removed.Relinking these binaries to newer versions of the shared librarieswill correct this problem.Both the.BR syslogd "(8) and the " klogd (8)can either be run from.BR init (8)or started as part of the rc.*sequence. If it is started from init the option \fI\-n\fR must be set,otherwise you'll get tons of syslog daemons started. This is because .BR init (8)depends on the process ID..SH SECURITY THREATSThere is the potential for the syslogd daemon to beused as a conduit for a denial of service attack. Thanks go to JohnMorrison (jmorriso@rflab.ee.ubc.ca) for alerting me to this potential.A rogue program(mer) could very easily flood the syslogd daemon withsyslog messages resulting in the log files consuming all the remainingspace on the filesystem. Activating logging over the inet domainsockets will of course expose a system to risks outside of programs orindividuals on the local machine.There are a number of methods of protecting a machine:.IP 1.Implement kernel firewalling to limit which hosts or networks haveaccess to the 514/UDP socket..IP 2.Logging can be directed to an isolated or non-root filesystem which,if filled, will not impair the machine..IP 3.The ext2 filesystem can be used which can be configured to limit acertain percentage of a filesystem to usage by root only. \fBNOTE\fPthat this will require syslogd to be run as a non-root process.\fBALSO NOTE\fP that this will prevent usage of remote logging sincesyslogd will be unable to bind to the 514/UDP socket..IP 4.Disabling inet domain sockets will limit risk to the local machine..IP 5.Use step 4 and if the problem persists and is not secondary to a rogueprogram/daemon get a 3.5 ft (approx. 1 meter) length of sucker rod*and have a chat with the user in question.Sucker rod def. \(em 3/4, 7/8 or 1in. hardened steel rod, malethreaded on each end. Primary use in the oil industry in WesternNorth Dakota and other locations to pump 'suck' oil from oil wells.Secondary uses are for the construction of cattle feed lots and fordealing with the occasional recalcitrant or belligerent individual..SH DEBUGGINGWhen debugging is turned on using.B "\-d"option then.B syslogdwill be very verbose by writing much of what it does on stdout. Wheneverthe configuration file is reread and re-parsed you'll see a tabular,corresponding to the internal data structure. This tabular consists offour fields:.TP.I numberThis field contains a serial number starting by zero. This numberrepresents the position in the internal data structure (i.e. thearray). If one number is left out then there might be an error in thecorresponding line in.IR /etc/syslog.conf ..TP.I patternThis field is tricky and represents the internal structureexactly. Every column stands for a facility (refer to.BR syslog (3)).As you can see, there are still some facilities left free for formeruse, only the left most are used. Every field in a column representsthe priorities (refer to.BR syslog (3))..TP.I actionThis field describes the particular action that takes place whenever amessage is received that matches the pattern. Refer to the.BR syslog.conf (5)manpage for all possible actions..TP.I argumentsThis field shows additional arguments to the actions in the lastfield. For file-logging this is the filename for the logfile; foruser-logging this is a list of users; for remote logging this is thehostname of the machine to log to; for console-logging this is theused console; for tty-logging this is the specified tty; wall has noadditional arguments..SH FILES.PD 0.TP.I /etc/syslog.confConfiguration file for.BR syslogd .See.BR syslog.conf (5)for exact information..TP.I /dev/logThe Unix domain socket to from where local syslog messages are read..TP.I /var/run/syslogd.pidThe file containing the process id of .BR syslogd ..PD.SH BUGSIf an error occurs in one line the whole rule is ignored..B Syslogddoesn't change the filemode of opened logfiles at any stage ofprocess. If a file is created it is world readable. If you want toavoid this, you have to create it and change permissions on your own.This could be done in combination with rotating logfiles using the .BR savelog (8)program that is shipped in the .B smail3.x distribution. Remember that it might be a security hole ifeverybody is able to read auth.* messages as these might containpasswords..SH SEE ALSO.BR syslog.conf (5),.BR klogd (8),.BR logger (1),.BR syslog (2),.BR syslog (3),.BR services (5),.BR savelog (8)..SH AUTHORSThe system log daemon.B syslogdis originally taken from BSD sources, Greg Wettstein <greg@wind.enjellic.com>performed the port to Linux, Martin Schulze <joey@infodrom.org>fixed some bugs, added several new features and took over maintenance.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -