516 Commits

Author SHA1 Message Date
Rainer Gerhards
dd62a34c66 config: permit 4-digit file creation modes
permit 4-digit file creation modes (actually 5 with the leading zero) so
that the setgid bit can also be set (and anything else on that position.

closes https://github.com/rsyslog/rsyslog/issues/1092
2018-05-14 15:34:03 +02:00
Rainer Gerhards
dc95ef09bd remove no longer needed --enable-libcurl configure switch
The --enable-libcurl switch was added to be able to disable libcurl
functionality inside the rsyslog core, see 46f4f43. As libcurl is no
longer used inside the core (due to introducing function modules),
--enable-libcurl needs to be removed.

closes https://github.com/rsyslog/rsyslog/issues/2628
2018-05-07 14:21:05 +02:00
Rainer Gerhards
d09323324f cosmetic bugfix: valgrind complain in some error conditions
When a "call" script statement was used with a non-existing ruleset AND
debug logginf was active for rainerscript.c, valgrind complained and
one debug message could potentially be incorrect (stating a queue
where non was).

This was caused by not initializing a variable which was probed in
debug mode before it was set. Non-debug mode was not affected.

see also https://github.com/rsyslog/rsyslog/issues/2399#issuecomment-384890873
2018-04-27 13:04:51 +02:00
Rainer Gerhards
0ca21d9190 core: config optimizer did not handle call_indirect
closes https://github.com/rsyslog/rsyslog/issues/2665
2018-04-26 13:17:26 +02:00
Rainer Gerhards
26d3fd0ef9
Merge pull request #2465 from CodeHarsh/master
adding hash64 and hash64mod functions support in rainerscript
2018-04-17 15:29:09 +02:00
Rainer Gerhards
1dead064dc
Merge pull request #2622 from rgerhards/all-warnings
QA: re-enable some compiler warnigs AX_COMPILER_FLAGS disables
2018-04-13 17:44:53 +02:00
Rainer Gerhards
48c397374d fix some __attribute__((unused)) and add missing ones
as it looks, some compiler versions (e.g. gcc 7) seem to be rather
picky on the position where this attribute is applied. So this
commit moves them to the position where they are properly detected.

We also add missing attributes. Some are missing due to conditional
compilation what we did not detect in our regular development
environments. This now comes up as we have enabled the corresponding
warning globally, and so they now also show up on those platforms.
2018-04-10 14:44:58 +02:00
Jan Gerhards
debea3785b remove unnecessary debug output
was used while implementing function modules, but were
not removed due to oversight.
2018-04-10 10:31:24 +02:00
Jan Gerhards
065022e551 rainerscript: mark unused parameters as such 2018-04-05 13:24:34 +02:00
Rainer Gerhards
76dccef817 fix cosmetic Coverity Scan ID 185316 2018-03-29 18:52:21 +02:00
Harshvardhan Shrivastava
006ba9c5b1 making hashXX function module 2018-03-28 19:13:17 +05:30
Rainer Gerhards
7bb1a91bac core: disable script optimizer warning
... as it causes issues. Plan is to fix and re-enable with next release.

see also https://github.com/rsyslog/rsyslog/issues/2524
2018-03-27 11:52:39 +02:00
Harshvardhan Shrivastava
17738f25a8 Merge remote-tracking branch 'upstream/master' 2018-03-27 14:11:02 +05:30
Harshvardhan Shrivastava
c9720547d9 merge master 2018-03-27 14:10:50 +05:30
Jan Gerhards
22fc00e897 rscript: make function modules loadable
function modules add functions to rainerscript dynamically,
change http_request into such a module (enabled by default).
This module can be used as a sample for future function modules.
2018-03-19 11:49:36 +01:00
Jan Gerhards
89e16c53dc rscript: refactor to use function pointers for script functions
calling and identifying a script function now works via
a function pointer. Going forward, this will be used when
making loadable functions in rainerscript.
2018-03-14 09:33:13 +01:00
Jan Gerhards
ae79fba280 rscript: refactor all functions
this is to estabilsh a common interface for all rainerscript functions
to enable calling them via function pointer (to be done
at a later stage).
2018-03-06 17:01:20 +01:00
Harshvardhan.s
50222abbdc fixing indentation 2018-02-22 12:14:40 +05:30
Harshvardhan Shrivastava
67514ee06d fixing ci issues and renaming file 2018-02-20 17:28:54 +05:30
Rainer Gerhards
fb44a28495 cleanup/config: remove redundant lexer rule
This rule was never applied, actually flex even complained about it.
It should not have been there in the first place. The match is actually
done right at the top of the <EXPR> block.
2018-02-11 18:26:57 +01:00
Thomas Deutschmann
be731c5f09
Fix building with --disable-libcurl
We missed the header include in commit d9475f133e3c79875a7c4ccd92038b7123c1f155.

See: https://github.com/rsyslog/rsyslog/issues/2374
Bug: https://bugs.gentoo.org/646262
2018-02-10 00:13:43 +01:00
Harshvardhan Shrivastava
ade17f9259 adding hash64 and hash64mod functions support in rainerscript
removing logmsg

fixing typo in Makefile.am

fixing typo

making default hash static

fixing cast issue

fixing test
2018-02-08 20:09:52 +05:30
Rainer Gerhards
edb81c0283 conf optimizer: small improvement
now that we have NOP-removal, we can restructre if compression a
bit to make it more straightforward
2018-01-27 18:06:21 +01:00
Rainer Gerhards
a48cce29c9 conf optimizer: remove left-over NOPs
First step in optimizer is to replace unneded statements by NOP,
which are now removed in step 2.

closes see also https://github.com/rsyslog/rsyslog/issues/2432
2018-01-27 18:03:01 +01:00
Rainer Gerhards
56cfe01974 conf optimizer: detect empty "if" and replace by NOP
see also https://github.com/rsyslog/rsyslog/issues/2432
2018-01-27 17:16:32 +01:00
Rainer Gerhards
ef48d2e878
Merge pull request #2439 from rgerhards/cid187116
config: fix file handle leak in backtick parameters
2018-01-27 12:12:26 +01:00
Rainer Gerhards
6daf835cd0 fix build warnings on alpine linux
Alpine compiles with size optimization, and then the compiler
finds a couple of inline functions that are really not worth it.
2018-01-26 17:26:44 +01:00
Rainer Gerhards
a479b78cd1 config: fix file handle leak in backtick parameters
This is a very recent regression from this week's merge, not in
any released code.

detected by Coverity Scan, CID 187116
2018-01-25 12:04:26 +01:00
Rainer Gerhards
548067fcc0 config: add ability to disable config parameter ("config.enable")
For auto-generated configs, it is useful to have the ability to disable some
config constructs even though they may be specified inside the config. This
can now be done via the ```config.disable``` parameter, applicable to all
script objects. If set to ```on``` or not specified, the construct will be
used, if set to any other value, it will be ignored. This can be used
together with the backtick functionality to configure enable and disable
from either a file or environment variable.

Example:
Let's say we want to conditionally load a module. Environment variable ```LOAD_IMPTCP```will be either unset or ```off``` . Then we can use this config construct:
```
module(load="imptcp" config.enabled=`echo $LOAD_IMPTCP`)
```
It the variable is set to ```off```, the module will **not** be loaded.

closes https://github.com/rsyslog/rsyslog/issues/2431
2018-01-24 16:16:45 +01:00
Rainer Gerhards
8cb9c5b3d2 script: implement cat file backticks capablity
gets us a bit closer to (essential) shell backtick capability
2018-01-23 16:51:28 +01:00
Rainer Gerhards
6327e43ea9 config: add include() script object
This permits to include files (like legacy $IncludeConfig) via a
script object. Needless to say, the script object offers more
features:

- include files can now be
  - required, with rsyslog aborting when not present
  - required, with rsyslog emitting an error message but otherwise
    continuing when not present
  - optional, which means non-present include files will be
    skipped without notice
  This is controlled by the "mode" parameter.
- text can be included form e.g. an environment variable
  --> ex: include(text=`echo $ENVVAR`)

This finally really obsoletes $IncludeConfig.

closes https://github.com/rsyslog/rsyslog/issues/2151
2018-01-22 18:36:03 +01:00
Rainer Gerhards
96f59eeb83 config: add ability to use environment variables for config params
We introduce strings enclosed in backticks, which is along the lines
of what the shell does. However, we currently only support
"echo $VARNAME" -- but this may be extended later on.

closes https://github.com/rsyslog/rsyslog/issues/2416
2018-01-21 12:46:44 +01:00
Rainer Gerhards
cdc7271232 script bugfix: memory leak in parse_json() function
This is a bad memory leak, it grows with each function invocation.

closes https://github.com/rsyslog/rsyslog/issues/2391
2018-01-16 12:25:41 +01:00
Michael Biebl
50205ced0f build system: Don't link core against libcurl if explicitly requested
When using --disable-libcurl, libgrammar should not be linked against
libcurl unconditionally as CURL_LIBS might be set if one of the modules
using libcurl, like elasticsearch, is enabled.
2018-01-14 12:21:42 +01:00
Rainer Gerhards
a87de59f6d
Merge pull request #2341 from bayaro/master
doFuncReplace(): add tail of src if tail is partially similar to 'replaceWith'
2018-01-12 11:48:56 +01:00
Dan Molik
d9475f133e
Fix building with --disable-libcurl
Fixes: https://github.com/rsyslog/rsyslog/issues/2374
2018-01-11 18:39:16 +01:00
baya
9c7413beb7 doFuncReplace(): add tail of src if tail is partially similar to 'replaceWith'
if the tail of message similar to replacement string. Example:
msg: 1234567890
replacement: 8906
the last N (amount of similar symbols in tail of message and the begin of replacement,
in current example = 3) will never be assigned in dst message. And will contain a garbage.
As longer replacement string as more garbage will be in dst message instead of a required
src tail.

The length of dst message is right. The tail of dst message filled with garbage.
Because of memory for dst message is allocated with right size, but didn't filled if
the tail of message partially equals to a beginning of a replacement string.
2018-01-09 12:22:21 +02:00
Rainer Gerhards
9a7481aa43
Merge pull request #2335 from rgerhards/i326
config processing: bare variable root access not permitted
2018-01-05 17:12:27 +01:00
Matt Ezell
b411445968 Report unknown function calls as parser errors 2018-01-03 12:38:19 -05:00
Rainer Gerhards
e5e42e6034 RainerScript: on bare empty var root access evalVar() misadressed
This most probably could not happen in the past as bare variable root
references were not permitted by grammar. However, we haven't done a
thougrough check if there still was a possibility to trigger this bug
somehow, so we do this in our own commit.
2018-01-03 16:20:32 +01:00
Rainer Gerhards
5be917268d config processing: bare variable root access not permitted
closes https://github.com/rsyslog/rsyslog/issues/326
2018-01-03 16:20:32 +01:00
baya
57bde72767 traling spaces removed 2018-01-02 21:56:54 +02:00
Jan Gerhards
f5eef34361 rscript: add int2Hex
closes https://github.com/rsyslog/rsyslog/issues/2224
2017-12-24 11:46:57 +01:00
Rainer Gerhards
8cb0a95a38 code style: fix too-long lines 2017-12-23 18:25:37 +01:00
Rainer Gerhards
49f9b26601
Merge pull request #2246 from mrworkman/rscript-is-timestamp
Add is_time() RainerScript function.
2017-12-22 12:49:02 +01:00
PascalWithopf
29c9fb1f9a codestyle: reduce line length to 120
lines are still checked for a length of 125 because
these are just some of the lines
2017-12-21 17:09:32 +01:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
Stephen Workman
027e4f685e Refactor into separate function. 2017-12-19 09:12:09 -05:00
Stephen Workman
cdc779760b Add is_time() RainerScript function. 2017-12-19 09:12:09 -05:00
Rainer Gerhards
4642df4388
Merge pull request #2252 from rgerhards/i-352
import BSD project and Solaris patches
2017-12-19 08:11:02 +01:00