283 Commits

Author SHA1 Message Date
Rainer Gerhards
f4f2a493b0 work a bit toward string handling unification 2013-10-21 17:12:07 +02:00
Rainer Gerhards
8d4a5152cb Merge branch 'v7-stable' 2013-09-03 11:54:20 +02:00
hwoarang
1c71b9628b make rsyslog use the new json-c pkgconfig file if available 2013-09-03 11:38:01 +02:00
Rainer Gerhards
4ecd6bb946 first shot at global variables (without proper sync so far) 2013-07-22 17:38:31 +02:00
Rainer Gerhards
4c2bef51d1 milestone: basic local variable functionality available
but some nits, like do not work with disk queues
2013-07-17 11:37:53 +02:00
Rainer Gerhards
d4ca9a48d6 refactor in preparation of local variables
local variables require a second json root; this refactoring makes
sure we can basically use common functions for json handling
2013-07-17 09:47:14 +02:00
Rainer Gerhards
6ded646baf bugfix: $template statement with multiple spaces lead to invalid tpl name
If multiple spaces were used in front of the template name, all but one
of them became actually part of the template name. So
$template   a,"..." would be name "  a", and as such "a" was not
available, e.g. in
*.* /var/log/file;a
This is a legacy config problem. As it was unreported for many years,
no backport of the fix to old versions will happen.
This is a long-standing bug that was only recently reported by forum
user mc-sim.
Reference: http://kb.monitorware.com/post23448.html
2013-05-27 11:01:29 +02:00
Rainer Gerhards
7b45d0b4d2 Merge branch 'v7-stable-info'
Conflicts:
	ChangeLog
	template.c
2013-03-29 16:09:19 +01:00
Rainer Gerhards
474877b9d7 permit substring extraction relative to end-of-string in templates 2013-03-29 16:04:21 +01:00
Rainer Gerhards
8339d54ddc optimize: do date() call in template processing only if actually needed 2013-01-13 14:40:17 +01:00
Rainer Gerhards
42d1d27a01 Merge branch 'v7-stable-newmsglock' into master-newmsglock
Conflicts:
	runtime/msg.c
	runtime/queue.c
	tools/syslogd.c
2012-12-06 17:27:37 +01:00
Rainer Gerhards
886ce6653d fix display problem with some date-format template options 2012-11-29 15:59:22 +01:00
Rainer Gerhards
cea19ee31a Merge branch 'v7-stable' 2012-11-29 12:36:42 +01:00
Rainer Gerhards
0f795af591 bugfix: template "type" parameter is mandatory (but was not) 2012-11-29 12:36:24 +01:00
Rainer Gerhards
1e39f3dd01 refactor error processing in string template handling 2012-11-29 12:15:46 +01:00
Rainer Gerhards
5e863f50de bugfix: no error message for invalid string template parameters
rather a malformed template was generated, and error information emitted
at runtime. However, this could be quite confusing. Note that with this
"bugfix" user experience changes: formerly, rsyslog and the affected
actions properly started up, but the actions did not produce proper
data. Now, there are startup error messages and the actions are NOT
executed (due to missing template due to template error).
2012-11-29 11:21:09 +01:00
Rainer Gerhards
eb659a82de Merge branch 'v7-stable' 2012-11-14 17:48:35 +01:00
Rainer Gerhards
25a33416e9 bugfix: garbled message if field name was used with jsonf property option
The length for the field name was invalidly computed, resulting in either
truncated field names or including extra random data. If the random data
contained NULs, the rest of the message became unreadable.
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=374
2012-11-14 15:21:42 +01:00
Rainer Gerhards
7ab0af28e7 Merge branch 'v7-stable' 2012-11-08 18:03:42 +01:00
Rainer Gerhards
12a4101573 Merge branch 'v6-stable' into v7-stable 2012-11-08 18:02:37 +01:00
Rainer Gerhards
b05d4a6db4 bugfix: no error msg on invalid field option in legacy/string template 2012-11-08 18:02:23 +01:00
Rainer Gerhards
00edf1573f bugfixes in string-type template()S
Both are closely related and thus rolled into a single commit.
- bugfix: improper handling of backslash in string-type template()s
- bugfix: leading quote (") in string-type template() lead to thight loop
  on startup
2012-11-08 17:41:10 +01:00
Rainer Gerhards
3421209cd5 optimize property replacer: reduce runtime for simple processing 2012-10-11 11:33:16 +02:00
Rainer Gerhards
b184158a6e Merge branch 'master' into master-newtemplate
Conflicts:
	template.c
2012-10-11 10:18:28 +02:00
Rainer Gerhards
224ec91613 remove some assert()'s - valgrind does a better job... 2012-10-11 10:05:40 +02:00
Rainer Gerhards
98a94a68b6 Merge branch 'v6-devel'
Conflicts:
	template.c
2012-10-11 09:41:53 +02:00
Rainer Gerhards
9de5fb77eb fix small memory leak with string-type templates 2012-10-11 09:37:34 +02:00
Rainer Gerhards
e1037b5b1f remove some assert()'s - valgrind does a better job... 2012-10-11 09:36:27 +02:00
Rainer Gerhards
d5b9d43f6a fix small memory leak with string-type templates 2012-10-11 09:35:29 +02:00
Rainer Gerhards
f85690620b do "template date call" only when actually needed 2012-10-11 09:12:20 +02:00
Rainer Gerhards
dc724fcd2e optimize: do "template time() call" only once per batch
This still needs more optimizing as the call is very often
NOT needed - but we need to know about the templates in that
case.
2012-10-10 19:34:08 +02:00
Rainer Gerhards
9b4a225c59 refactor tpl processor so that date is queried once per template
Things like $YEAR, $MONTH required a time() call each.
2012-10-10 19:20:19 +02:00
Rainer Gerhards
bda0ef62f0 bugfix: subtree-type template incorrectly handled 2012-09-21 08:41:17 +02:00
Rainer Gerhards
d88b0e0baf subtree template parameter requires variable name, not CEE path
This was changed to keep things in rsyslog.conf consistent. Can also
come handy if at some time we want to have a global (disjunct) CEE path.
2012-09-18 17:56:52 +02:00
Rainer Gerhards
037eaa0d69 new ruleengine: implement template type "subtree" 2012-09-18 11:32:45 +02:00
Rainer Gerhards
1aa39821f3 Merge branch 'v6-devel'
Conflicts:
	template.c
2012-09-17 09:28:14 +02:00
Rainer Gerhards
76300a1342 Fix other small memory leaks in template() processing 2012-09-17 08:58:29 +02:00
Rainer Gerhards
0569f2e581 bugfix: small memory leaks in template() statements
these were one-time memory leaks during startup, so they did NOT grow
during runtime
2012-09-17 08:51:26 +02:00
Miloslav Trmač
ddea340e66 Fix reference counting
When adding a JSON object to the template output, make sure to increment
its reference count.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:21:03 +02:00
Miloslav Trmač
18ff8d54dd Don't leak configuration value arrays
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:20:33 +02:00
Miloslav Trmač
64599e9412 Don't leak property name
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:19:48 +02:00
Miloslav Trmač
d8f0029818 Fix a memory leak in "outname"
In all cases, the variable already contains a newly allocated copy.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:17:47 +02:00
Miloslav Trmač
080825632b Free a temporary object for the "name" property
Fixes a memory leak.

Another option is to use cstrConstructFromESStr, but that would change
semantics of NUL handling.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:17:16 +02:00
Miloslav Trmač
b38fa5219f Set value of a mandatory JSON field to null
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2012-09-04 10:16:58 +02:00
Rainer Gerhards
197d9ef643 add native json-passing to output modules using JSON API 2012-08-31 14:12:49 +02:00
Rainer Gerhards
672f45733b Merge branch 'master' into v7-devel 2012-08-31 12:18:27 +02:00
Rainer Gerhards
0426ad7dd2 switch field default to "mandatory" and implement that mode 2012-08-30 18:56:23 +02:00
Rainer Gerhards
a9f80019dc add capability to specify "optional" attribute for list-type templates, too 2012-08-29 16:10:54 +02:00
Miloslav Trmač
a73058031f Add support for optional fields 2012-08-29 16:07:23 +02:00
Rainer Gerhards
d18a93e943 default outname for $!<property> is now without $! prefix
also some type cleanup and simplification
2012-08-29 16:00:20 +02:00