diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | README.linux | 11 | ||||
-rw-r--r-- | outchannel.h | 23 | ||||
-rw-r--r-- | rsyslog.conf.5 | 76 | ||||
-rw-r--r-- | syslogd.c | 7 | ||||
-rw-r--r-- | test.conf | 3 | ||||
-rw-r--r-- | version.h | 4 |
8 files changed, 130 insertions, 5 deletions
@@ -12,7 +12,7 @@ CC= gcc # enables the MySQL code. By default, that one is commented out # change the comment chars to activate it if you need MySQL! # In this case, also look down further to uncomment the libs -CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -D__LARGEFILE64 +CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce #CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DWITH_DB LDFLAGS= -s @@ -16,6 +16,15 @@ Version 0.9.0 (RGer) - changed some error messages during init to be sent to the console and/or emergency log. Previously, they were only seen if the -d (debug) option was present on the command line. +- fixed the "2gb file issue on 32bit systems". If a file grew to + more than 2gb, the syslogd was aborted with "file size exceeded". + Now, defines have been added according to + http://www.daimi.au.dk/~kasperd/comp.os.linux.development.faq.html#LARGEFILE + Testing revealed that they work ;) + HOWEVER, if your file system, glibc, kernel, whatever does not + support files larger 2gb, you need to set a file size limit with + the new output channel mechanism. +- updated man pages to reflect the changes --------------------------------------------------------------------------- Version 0.8.4 diff --git a/README.linux b/README.linux index 1b150d51..e247f200 100644 --- a/README.linux +++ b/README.linux @@ -49,7 +49,16 @@ New versions of this package and additional information will be available under www.monitorware.com/rsyslog as well as under the rsyslog project on sourceforge.net. +IMPORTANT +Starting with version 0.9.0, rsyslogd supports files larger than 2gb. +This was added simply by some c compiler definitions which ask the run +time library to include different code. Depending on your file system, +glibc, kernel or whatever, you might not be able to use this support. If +so, rsyslogd might be terminated by the operating system when a file +reaches 2gb of size. To guard against this, use the output channel +file size limitation (see man rsyslog.conf for details). + Best regards, Rainer Gerhards Adiscon -2005-04-04 +2005-06-22 diff --git a/outchannel.h b/outchannel.h new file mode 100644 index 00000000..45957407 --- /dev/null +++ b/outchannel.h @@ -0,0 +1,23 @@ +/* This is the header for the output channel code of rsyslog. + * Please see syslogd.c for license information. + * This code is placed under the GPL. + * begun 2005-06-21 rgerhards + */ +struct outchannel { + struct outchannel *pNext; + char *pszName; + int iLenName; + char *pszFileTemplate; + off_t uSizeLimit; + char *cmdOnSizeLimit; +}; + +struct outchannel* ochConstruct(void); +struct outchannel *ochAddLine(char* pName, char** pRestOfConfLine); +struct outchannel *ochFind(char *pName, int iLenName); +void ochDeleteAll(void); +void ochPrintList(void); + +/* + * vi:set ai: + */ diff --git a/rsyslog.conf.5 b/rsyslog.conf.5 index 6c91607c..0304be03 100644 --- a/rsyslog.conf.5 +++ b/rsyslog.conf.5 @@ -165,6 +165,74 @@ date-rfc3339 format as RFC 3339 date escape-cc NOT yet implemented .fi +.SH Output Channels +.B Output Channels +are a new concept first introduced in rsyslog 0.9.0. As of this writing, it +is still unclear if they will stay in rsyslog or go away. So if you use +them, be prepared to change you configuration file syntax when you +upgrade to a later release. + +The idea behind output channel definitions is that it shall provide an +umbrella for any type of output that the user might want. In essence, this +is the "file" part of selector lines (and this is why we are not sure +output channel syntax will stay after the next review). There is a difference, +though: selector channels both have filter conditions (currently facility and +severity) as well as the output destination. Output channels define the output +defintion, only. As of this build, they can only be used to write to files - not +pipes, ttys or whatever else. If we stick with output channels, this will change +over time. + +In concept, an output channel includes everything needed to know about +an output actions. In practice, the current implementation only carries +a filename, a maximum file size and a command to be issued when this +file size is reached. More things might be present in future version, which +might also change the syntax of the directive. + +Output channels are defined via an $outchannel directive. It's syntax is +as follows: + +$outchannel name,file-name,max-size,action-on-max-size + +name is the name of the output channel (not the file), file-name is +the file name to be written to, max-size the maximum allowed size +and action-on-max-size a command to be issued when the max size is reached. + +Please note that max-size is queried BEFORE writing the log message to +the file. So be sure to set this limit reasonably low so that any message +might fit. For the current release, setting it 1k lower than you expected +is helpful. The max-size must always be specified in bytes - there are no +special symbols (like 1k, 1m,...) at this point of development. + +Keep in mind that $outchannel just defines a channel with "name". It +does not activate it. To do so, you must use a selector line (see below). +That selector line includes the channel name plus an $ sign in front of +it. A sample might be: + +*.* $mychannel + +In its current form, output channels primarily provide the ability to +size-limit an output file. To do so, specify a maximum size. When this +size is reachead, rsyslogd will execute the action-on-max-size command +and then reopen the file and retry. The command should be something like +a log rotation script or a similar thing. + +.B WARNING: + +The current command logic is a quick hack. It simply issues the command +via a system() call, which is very dirty. Don't make rsyslogd a suid +binary and use action-on-max-size commands - this will mess up things. +Fixing this is on top of the todo list and the fix will hopefully +appear soon. + +If there is no action-on-max-size command or the command did not resolve +the situation, the file is closed and never reopened by rsyslogd (except, +of course, by huping it). This logic was integrated when we first experienced +severe issues with files larger 2gb, which could lead to rsyslogd dumping +core. In such cases, it is more appropriate to stop writing to a single +file. Meanwhile, rsyslogd has been fixed to support files larger 2gb, but +obviously only on file systems and operating system versions that do so. +So it can still make sense to enforce a 2gb file size limit. + .SH SELECTORS The selector field itself again consists of two parts, a .I facility @@ -355,6 +423,14 @@ template name can follow the connect information. This is as follows: .nf >dbhost,dbname,dbuser,dbpassword;dbtemplate .fi + +.SS Output Channel +Binds an output channel definition (see there for details) to this action. +Output channel actions must start with a $-sign, e.g. if you would like +to bind your output channel definition "mychannel" to the action, use +"$mychannel". Output channels support template definitions like all all other +actions. + .SH TEMPLATE NAME Every ACTION can be followed by a template name. If so, that template is used for message formatting. If no name is given, a hardcoded default template is @@ -101,6 +101,13 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#ifndef NOLARGEFILE +# define _GNU_SOURCE +# define _LARGEFILE_SOURCE +# define _LARGEFILE64_SOURCE +# define _FILE_OFFSET_BITS 64 +#endif + #if !defined(lint) && !defined(NO_SCCS) char copyright2[] = "@(#) Copyright (c) 1983, 1988 Regents of the University of California.\n\ @@ -146,7 +146,8 @@ $template WinSyslogFmt,"%HOSTNAME%,%timegenerated:1:10:date-rfc3339%,%timegenera #*.* @172.19.2.16;RFC3164fmt #*.* @172.19.2.16 #*.* >localhost,AdisconDB,root, -*.* /var/log/big +$outchannel big, /var/log/big, 0 +*.* $big #$outchannel rg, /home/rger/proj/rsyslog/size-file , 1000 , mv /home/rger/proj/rsyslog/size-file /home/rger/proj/rsyslog/size-file.old $outchannel rg, /home/rger/proj/rsyslog/size-file , 1000 *.* $rg;TraditionalFormat @@ -1,2 +1,2 @@ -#define VERSION "0.8" -#define PATCHLEVEL "4" +#define VERSION "0.9" +#define PATCHLEVEL "0" |