249 Commits

Author SHA1 Message Date
192ab107f2 imfile: Fixed an issue monitoring wrong files when using multiple imfile inputs
The bug was introduced by the changes for the multilevel wildcard feature
which has been added recently. We have to handle FileCreate events different
if the directory watch is configured or added dynamically.

closes https://github.com/rsyslog/rsyslog/issues/1452
2017-03-08 14:35:19 +01:00
a9b5b93e8d imfile: Fixed checkInstance when using wildcards in directorynames.
The check does not print warnings anymore if wildcards are used
in directory names.
2017-02-15 11:26:14 +01:00
faca9c8ced imfile: Fixed bug in dynamic dir watch found using testsuite.
testsuite: Also added msleep between directory and file creation
in imfile wildcard tests. Sometimes a directory watch was not created
before the testsuite created a logfile.
2017-01-19 13:41:00 +01:00
478f2762ae imfile: Fixed codestyle issues and restored code from previous commits. 2017-01-18 10:46:26 +01:00
ca3850c601 imfile: Moved getBaseDir to inotify functions 2017-01-17 15:24:04 +01:00
2f7b371017 imfile: Fixed an issue generating wrong statefiles when $workdirectory is unset
When $WorkDirectory was not configured in rsyslog configuration, invalid
path/filenames were generated for statefiles causing failure on
deleting statefiles and more.
2017-01-17 14:38:32 +01:00
8025057e39 imfile: Fixed multiple bugs in new wildcard directory handling
Fixed removal for directory watch and helper functions
Fixed invalid setupdirwatch indexes.
Changed logfile extensions for new tests
2017-01-17 14:38:32 +01:00
9a6b321b5b imfile: Added support for multilevel wildcards (inotify only)
imfile supports now wildcards on multiple levels.
Directories can be dynamically added and removed.
Each directory has its own inotify watch.

Initial coding is done, no propper tests have to be added.
2017-01-17 14:38:32 +01:00
Pascal Withopf
1198652e54 codestyle: check imfile.c 2017-01-11 11:45:22 +01:00
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Rainer Gerhards
448f16495c remove "inline" attribute from excessivly long functions 2016-10-26 11:50:15 +02:00
Rainer Gerhards
da4e6b0667 imfile: add "timeoutGranularity" module parameter
Also update testbench to use it at least in one test. We do not
add additional tests to not go overboard.
2016-10-10 15:47:32 +02:00
Rainer Gerhards
8eea909367 imfile: add "readTimeout" parameter
closes https://github.com/rsyslog/rsyslog/issues/1133
2016-10-10 15:45:45 +02:00
Rainer Gerhards
8cd14d2676 imfile: bugfix: ReopenOnTruncate processing, file open processing
This fixes
* ReopenOnTrucate was only honored when a state file existed
  see https://github.com/rsyslog/rsyslog/issues/1090
* open processing could run into a loop
  see https://github.com/rsyslog/rsyslog/issues/1174

This is done via refactoring the open file handling, which provides
overall cleaner and easier-to-follow code.

fixes https://github.com/rsyslog/rsyslog/issues/1090
fixes https://github.com/rsyslog/rsyslog/issues/1174
2016-10-06 10:39:28 +02:00
Rainer Gerhards
bbcbb03c64 fix compiler warnings 2016-07-22 15:00:28 +02:00
Rainer Gerhards
1211959064 prevent variable from potentially being clobbered 2016-06-03 16:03:47 +02:00
Rainer Gerhards
8a986092c6 fix old-style definitions (missing prototype in func def) 2016-06-03 10:08:57 +02:00
Rainer Gerhards
ed917ae317 imfile: fix data type usage 2016-06-01 14:52:44 +02:00
Brian Knox
9ee3082287 imfile: fix memory corruption bug when appending @cee 2016-04-15 11:47:46 -04:00
Rainer Gerhards
f28480b361 Merge branch 'master' of https://github.com/curu/rsyslog into master-candidate 2016-04-06 09:36:27 +02:00
Tomas Heinrich
fee0fb6e0c Fix a small memleak in imfile 2016-03-21 13:50:03 +01:00
Curu Wong
9f9e4c2a1f add FreshStartTail input parameter
when deploy rsyslog to a large number of servers. We may only care about new logs after the deployment. In this case, logs generated before should be discarded, otherwise, there may be vast useless message burst on the central rsyslog receiver.

set **FreshStartTail**  to *on* cause imfile to seek to the end/taill of input file at fresh start, which means only new log events will be processed.
2016-03-19 13:50:15 +08:00
Rainer Gerhards
876161553a imfile: reword error message
... as suggested by Peter Portante
2016-03-04 09:05:44 +01:00
Brian Knox
4afaba2a3c fix possible buffer overflow in imfile config parser 2016-03-03 09:49:25 -05:00
Rainer Gerhards
0e17c41aa5 imfile: fix race during startup that could lead to some duplication
If a to-be-monitored file was created after inotify was initialized
but before startup was completed, the first chunk of data from this
file could be duplicated. This should have happened very rarely in
practice, but caused occasional testbench failures.

closes https://github.com/rsyslog/rsyslog/issues/791
2016-02-16 12:55:11 +01:00
Rainer Gerhards
42155cd5b4 Merge branch 'trim-line-over-bytes' of https://github.com/JindongChen/rsyslog into merge-664
Conflicts:
	runtime/stream.h
2016-02-15 15:45:40 +01:00
Brian Knox
ecc71fa144 adds addceetag option to imfile 2016-02-08 11:56:44 -05:00
Rainer Gerhards
d681a373c1 build: suppress another API-induced alignment warning 2016-01-27 10:18:25 +01:00
Rainer Gerhards
16f51bee3f Merge branch 'reopen-on-truncate' of https://github.com/ymattw/rsyslog into master-candidate 2016-01-14 08:13:21 -05:30
Matthew Wang
c5b17ac629 Use setter function to set bReopenOnTruncate 2016-01-14 22:16:45 +08:00
Rainer Gerhards
40ec210d58 Merge branch 'fix-crash-in-frequently-rotate' of https://github.com/jopstools/rsyslog
Conflicts:
	plugins/imfile/imfile.c
2016-01-14 07:16:18 -05:30
Rainer Gerhards
1369c06d65 debug message cleanup 2016-01-14 07:08:16 -05:30
Rainer Gerhards
e15420b57a Merge branch 'fix-imfile' of https://github.com/portante/rsyslog
Conflicts:
	plugins/imfile/imfile.c
2016-01-14 07:05:10 -05:30
Rainer Gerhards
57e4eb7da3 Merge branch 'memory-corruption' of https://github.com/zacharyzhao/rsyslog into merge-imfile 2016-01-14 06:59:49 -05:30
Rainer Gerhards
51be5bef2d Merge branch 'unhandled-inotify-init-faild' of https://github.com/jopstools/rsyslog into master-candidate 2016-01-13 10:24:31 -05:30
Rainer Gerhards
f4e9da0e62 imfile: remove debug code originally intended to be temporary 2016-01-13 09:30:27 -05:30
Rainer Gerhards
92c5d43969 imfile: somewhat gracefully handle out-of-memory error
this also is not a good solution, but there is none...
2016-01-13 06:10:42 -05:30
Zhiyong Zhao
eddf173e53 Handling the condition of inotify instance's failed initialization 2016-01-12 12:41:09 +08:00
Zhiyong Zhao
112f190571 Fix crash in frequently rotate 2016-01-12 12:38:51 +08:00
Peter Portante
4f7ebfedc1 Remove bad use of an inotify_event structure
Fixes #718.
2015-12-31 07:58:41 -05:00
Peter Portante
82adfa20fe Trim whitespace 2015-12-30 20:15:43 -05:00
Zhiyong Zhao
9213531743 Fix #718 caused by writing to unallocated address
`evFileHelper.name` is not allocated and not used at all, in typical
case its address is the same as the local variable `etry` in the same
stack (compiler optimization), assigning to `evFileHelper.name[0]`
actually corrupts the etry data structure and crashes the program.

Here's an example output from gdb session.

```
(gdb) p &evFileHelper.name
$6 = (char (*)[]) 0x7ffff6dfc930
(gdb) p &etry
$7 = (wd_map_t **) 0x7ffff6dfc930
(gdb)
```
2015-12-30 20:13:10 +08:00
Peter Portante
2470f0f72b Remove use of sizeof(char) and sizeof(uchar)
Remove the use sizeof(char) or sizeof(uchar) in calculations for memory
allocation or string length.  There are no known platforms for which
sizeof(char) or sizeof(uchar) is not 1, and c99 has defined sizeof(char)
to be 1 (section 6.5.3.4 of c99).
2015-12-16 02:18:45 +00:00
Chen Jindong
7da93520ca Trim line when length of line over specified bytes 2015-12-11 13:58:37 +08:00
Rainer Gerhards
447f92cc26 imfile: replace dbgprintf by faster macro alternative 2015-12-04 14:23:45 +01:00
Rainer Gerhards
28c65f5ba3 imfile: fix incorrect usages of "const __restrict__" keyword 2015-12-04 14:22:11 +01:00
Rainer Gerhards
bd577e0a70 imfile: replace deprecated API 2015-12-04 14:15:04 +01:00
Rainer Gerhards
7e544622b9 imfile: cleanup 2015-12-04 14:14:08 +01:00
Rainer Gerhards
5fd8ef2968 imfile: fix nit found by clang static analyzer 2015-12-04 14:09:46 +01:00
Rainer Gerhards
be7b923a18 imfile: invalid handling of out-of-memory condition
detected by clang static analyzer
2015-12-04 14:03:11 +01:00