diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-13 09:39:21 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-13 09:39:21 +0000 |
commit | 18bea60667f4ced5ac65e91fbd7c7a00ba22b319 (patch) | |
tree | 01513cac707247724ed93ffa9594cb3e81c77f6c /plugins/imfile/imfile.c | |
parent | 7e91b2298d3e3f0cced47fa32697b2b095638489 (diff) | |
download | rsyslog-18bea60667f4ced5ac65e91fbd7c7a00ba22b319.tar.gz rsyslog-18bea60667f4ced5ac65e91fbd7c7a00ba22b319.tar.xz rsyslog-18bea60667f4ced5ac65e91fbd7c7a00ba22b319.zip |
added ability to monitor file accross rotation
Diffstat (limited to 'plugins/imfile/imfile.c')
-rw-r--r-- | plugins/imfile/imfile.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 3f266a43..44832d67 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -117,7 +117,7 @@ static rsRetVal pollFile(fileInfo_t *pThis) /* open file */ CHKiRet(strmConstruct(&pThis->pStrm)); CHKiRet(strmSettOperationsMode(pThis->pStrm, STREAMMODE_READ)); - CHKiRet(strmSetsType(pThis->pStrm, STREAMTYPE_FILE_SINGLE)); + CHKiRet(strmSetsType(pThis->pStrm, STREAMTYPE_FILE_MONITOR)); CHKiRet(strmSetFName(pThis->pStrm, pThis->pszFileName, strlen((char*) pThis->pszFileName))); CHKiRet(strmConstructFinalize(pThis->pStrm)); /* move to offset */ @@ -200,7 +200,7 @@ CODESTARTrunInput pollFile(&files[i]); } - srSleep(1,0); + srSleep(3, 0); /* ------------------------------------------------------------------------------------------ * * DO NOT TOUCH the following code - it will soon be part of the module generation macros! */ @@ -328,9 +328,12 @@ RUNLOG_VAR("%d", iFilPtr); pThis = &files[iFilPtr]; ++iFilPtr; /* TODO: check for strdup() NULL return */ - pThis->pszFileName = (uchar*) strdup((char*) pszFileName); - pThis->pszTag = (uchar*) strdup((char*) pszFileTag); - pThis->pszStateFile = (uchar*) strdup((char*) pszStateFile); + if(pszFileName != NULL) + pThis->pszFileName = (uchar*) strdup((char*) pszFileName); + if(pszFileTag != NULL) + pThis->pszTag = (uchar*) strdup((char*) pszFileTag); + if(pszStateFile != NULL) + pThis->pszStateFile = (uchar*) strdup((char*) pszStateFile); pThis->iSeverity = iSeverity; pThis->iFacility = iFacility; pThis->offsLast = 0; |