diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-22 10:54:22 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-22 10:54:22 +0000 |
commit | c75bd2401298498efffd830dea0441dbb3d353fb (patch) | |
tree | 8b9c5c735b28fcbf3301c4c5a737b7ea2908c3ed /omfile.c | |
parent | cdcc0e6710a7e11bf1c528bf1728f886dba5a0af (diff) | |
download | rsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.tar.gz rsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.tar.xz rsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.zip |
- Greatly enhanced rsyslogd's filw write performance by disabling file
syncing capability of output modules by default. This feature is
usually not required, not useful and an extreme performance hit (both
to rsyslogd as well as the system at large). Unfortunately, most users
enable it by default, because it was most intuitive to enable it in
plain old sysklogd syslog.conf format. There is now a new config
setting which must be enabled in order to support syncing. By default
it is off. So even if the old-format config lines request syncing, it
is not done unless explicitely enabled. I am sure this is a very useful
change and not a risk at all. I need to think if I undo it under
compatibility mode, but currently this does not happen (I fear a lot of
lazy users will run rsyslogd in compatibility mode, again bringing up
this performance problem...).
- added $ActionfileEnableSync config directive
Diffstat (limited to 'omfile.c')
-rw-r--r-- | omfile.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -12,7 +12,7 @@ * of the "old" message code without any modifications. However, it * helps to have things at the right place one we go to the meat of it. * - * Copyright 2007 Rainer Gerhards and Adiscon GmbH. + * Copyright 2007, 2008 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -81,6 +81,7 @@ static uid_t fileGID; /* GID to be used for newly created files */ static uid_t dirUID; /* UID to be used for newly created directories */ static uid_t dirGID; /* GID to be used for newly created directories */ static int bCreateDirs; /* auto-create directories for dynaFiles: 0 - no, 1 - yes */ +static int bEnableSync = 0;/* enable syncing of files (no dash in front of pathname in conf): 0 - no, 1 - yes */ /* end globals for default values */ typedef struct _instanceData { @@ -603,8 +604,9 @@ again: errno = e; errmsg.LogError(NO_ERRCODE, "%s", pData->f_fname); } - } else if (pData->bSyncFile) + } else if (pData->bSyncFile) { fsync(pData->fd); + } finalize_it: RETiRet; @@ -660,11 +662,12 @@ CODESTARTparseSelectorAct return RS_RET_CONFLINE_UNPROCESSED; } - if (*p == '-') { + if(*p == '-') { pData->bSyncFile = 0; p++; - } else - pData->bSyncFile = 1; + } else { + pData->bSyncFile = bEnableSync ? 1 : 0; + } pData->f_sizeLimit = 0; /* default value, use outchannels to configure! */ @@ -793,6 +796,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a fCreateMode = 0644; fDirCreateMode = 0644; bCreateDirs = 1; + bEnableSync = 0; return RS_RET_OK; } @@ -823,6 +827,7 @@ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(omsdRegCFSLineHdlr((uchar *)"filecreatemode", 0, eCmdHdlrFileCreateMode, NULL, &fCreateMode, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"createdirs", 0, eCmdHdlrBinary, NULL, &bCreateDirs, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"failonchownfailure", 0, eCmdHdlrBinary, NULL, &bFailOnChown, STD_LOADABLE_MODULE_ID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionfileenablesync", 0, eCmdHdlrBinary, NULL, &bEnableSync, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); ENDmodInit /* |