54 Commits

Author SHA1 Message Date
Rainer Gerhards
6c9332b2e0
scripting: add endswith operator to property filters and RainerScript
This Implements suffix comparison similar to startswith. Note that we
do intentionally not use libestr functions in order to speed up adaption.
It would otherwise probably take years for distros to upgrade libestr.

With some help of the Codex and Gemini AI Agents.

closes https://github.com/rsyslog/rsyslog/issues/1255
2025-07-06 14:19:33 +02:00
Rainer Gerhards
d247c31888
add 'exists()' script function to check if variable exists
This implements a way to check if rsyslog variables (e.g. '$!path!var') is
currently set of not.

Sample: if exists($!somevar) then ...

closes https://github.com/rsyslog/rsyslog/issues/4385
2020-10-05 12:38:58 +02: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
c45df26475 cleanup: reduce the number of warning-avoidance pragmas 2017-11-07 12:03:04 +01:00
Rainer Gerhards
0f65df6a12 exp: remove #pragma causing trouble with newer clang 2017-11-04 18:11:26 +01:00
Rainer Gerhards
d8d7fc58cd rainerscript: implement new "call_indirect" statement
closes https://github.com/rsyslog/rsyslog/issues/1318
2016-12-11 12:06:28 +01:00
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Rainer Gerhards
799cbb9524 generate somewhat better syntax error messages on startup 2016-08-24 08:48:21 +02:00
Rainer Gerhards
bbcbb03c64 fix compiler warnings 2016-07-22 15:00:28 +02:00
Rainer Gerhards
87063ea683 shut off unevitable compiler warnings in lexer subsystem
they are caused by generated code that we cannot change
2016-06-03 10:43:46 +02:00
Rainer Gerhards
a9ff73b628 do not break build if compiler does not understand pragma
this is the case for older gcc
2016-06-02 12:53:21 +02:00
Rainer Gerhards
5e3b075d53 fix compiler warnings 2016-06-02 12:08:55 +02:00
Janmejay Singh
79d1bdbc03 reload_lookup_table second-param(stub-value to be used in case of reload failure) made optional 2015-12-22 01:10:36 +05:30
Janmejay Singh
bf43179381 moved to async(dispatched on a different thread) lookup-table reload (stub param is still mandatory, making it optional requires more work) 2015-12-21 23:42:11 +05:30
Janmejay Singh
0f9bffc2f1 rscript based control for reload and stubbing of lookup-table 2015-12-18 20:04:16 +05:30
Janmejay Singh
4ca5e217e2 Adds support for 'reset' statement (it has syntax similar to set 'set', but _unlike_ 'set' always force-sets the given value insteed of conditionally merging it, or not saving it because it is trying to replace an object with a leaf value etc).
Syntax:

reset $.foo = $!bar;

etc.
2014-12-17 11:39:31 +01:00
Janmejay Singh
66d459daa9 foreach for rscript + test (completes json-array support, except documentation) 2014-12-17 11:39:30 +01:00
Janmejay Singh
2e3266b097 enhanced rainerscript to allow chained dereference of json-arrays + fixed a bug json-array dereference handling + added a test for rainerscript using chained json-array dereference
Conflicts:
	tests/Makefile.am
2014-12-17 11:39:30 +01:00
Janmejay Singh
9c28cc9955 support for addressing json array members 2014-12-17 11:39:30 +01:00
Rainer Gerhards
fcd7fcc5a7 permit empty rulesets 2014-11-21 14:54:29 +01:00
Rainer Gerhards
618bd2844c Merge branch 'v7-stable' into v8-stable
Conflicts:
	grammar/grammar.y
2014-05-22 15:44:22 +02:00
Rainer Gerhards
e06d8242c9 update license to ASL 2.0 2014-05-22 15:33:24 +02:00
Rainer Gerhards
a6b6bf306d fix build problems on solaris 2014-04-08 12:11:57 +02:00
Rainer Gerhards
6bc4613674 Merge branch 'v7-stable' 2012-10-29 10:16:49 +01:00
Rainer Gerhards
d1d0b27fc4 bugfix: ruleset()-object did only support a single statement 2012-10-27 15:06:29 +02:00
Rainer Gerhards
316ad4e4c9 permit action-like statements (stop, call, ...) in action lists 2012-10-22 10:16:42 +02:00
Rainer Gerhards
fa541af577 implement "continue" RainerScript statement 2012-10-01 18:52:58 +02:00
Rainer Gerhards
873e806df0 implement RainerScript "call" statement 2012-10-01 17:48:36 +02:00
Rainer Gerhards
c0ccd3ff25 implement string arrays for config objects
as a tester, imudp now supports binding to multiple options
based on a string array
2012-10-01 10:29:38 +02:00
Rainer Gerhards
e3a611ac62 cleanup 2012-09-28 17:46:50 +02:00
Rainer Gerhards
04c0124eb7 rainerscript: add basic plumbing for arrays
can be used in expressions, but always evaluate to the first
element, only
2012-09-28 14:45:34 +02:00
Rainer Gerhards
38cdf1abad Implement RainerScript ruleset() statement 2012-09-28 11:06:16 +02:00
Rainer Gerhards
447f0e6421 new ruleengine: implement script concatenation (& operator) 2012-09-17 16:23:15 +02:00
Rainer Gerhards
8fe7507de1 cleanup 2012-09-17 08:00:12 +02:00
Rainer Gerhards
e162d378c7 Add set/unset stmt to grammar & AST
... but not yet to executing engine
2012-09-13 15:26:22 +02:00
Rainer Gerhards
a65ddad865 new ruleengine: properly handle $ruleset directive 2012-09-12 11:31:45 +02:00
Rainer Gerhards
92c030bb76 new ruleengine: more cleanup 2012-09-10 16:59:20 +02:00
Rainer Gerhards
3dd73d7f71 new ruleengine: legacy action object properly constructed 2012-09-04 15:54:40 +02:00
Rainer Gerhards
72f9fe88b2 new ruleengine: v6+ action object properly constructed 2012-09-04 15:18:37 +02:00
Rainer Gerhards
c596f1c1b2 new ruleengine: PROP and PRI legacy filter structures properly created 2012-09-04 14:51:35 +02:00
Rainer Gerhards
b473bae2d7 new ruleengine: skeleton for reading conf file in place
code still does not work, actual functions not implemented
2012-09-04 12:35:36 +02:00
Rainer Gerhards
68b9fe72b8 new ruleengine: script block correctly built 2012-09-04 12:00:01 +02:00
Rainer Gerhards
493ddeaa77 new ruleengine: add &-operator (legacy action list) 2012-09-04 11:05:19 +02:00
Rainer Gerhards
0bf6991bf6 new ruleengine: first code for stmt handling 2012-09-04 10:50:07 +02:00
Rainer Gerhards
07527fbd38 new ruleengine: first shot at grammar 2012-09-03 15:53:31 +02:00
Rainer Gerhards
3d56820f13 add capability to configure outname for constant (inside template)
also some cleanup
2012-08-25 19:21:12 +02:00
Rainer Gerhards
76e9968c08 milestone: LIST-type templates work, but no all options yet present 2012-08-25 17:17:27 +02:00
Rainer Gerhards
6258cb42fd milestone: base plumbing for LIST-type templates mostly in place 2012-08-25 13:30:53 +02:00
Rainer Gerhards
ab7b1b381a add base plumbing for template() config object to grammar 2012-08-24 15:08:12 +02:00
Rainer Gerhards
da6489743c milestone/[PARTWORK]: made sure all legacy selectors work
... except for the not guaranteed $outchannel construct, which we
could not fix without syntax change. Shouldn't hurt too many.
2011-07-09 17:33:12 +02:00