Jonny Törnbom
f3bd7a2f5e
Add fixed-width option
...
Pads a string with spaces up to toChar field if string is shorter, if
string is equal then nothing is done and if string is longer then it
gets truncated.
2015-09-07 15:13:00 +02:00
Rainer Gerhards
7e8fbb1c32
bugfix: esoteric potential double free in template generation
...
This could happen after some memory has been damaged before. The
potential double free was discovered by clang's static analyzer.
2015-06-26 10:53:27 +02:00
Rainer Gerhards
9c362b96c3
cleanup
...
LogErr emits into debug log in any case...
2015-02-24 13:07:17 +01:00
RJ Bergeron
32de3f6741
Now that we have the ordinal day, we can easily get the week of the year. Expose that.
2014-08-05 11:37:50 -04:00
RJ Bergeron
6d90af8739
Add support for day-of-year (ordinal day) time formatting
2014-08-05 11:37:20 -04:00
Rainer Gerhards
eb89f4ddba
Merge branch 'v8-stable'
2014-07-13 13:07:19 +02:00
Rainer Gerhards
c2c8c26c87
Merge branch 'v7-stable' into v8-stable
...
Conflicts:
plugins/imfile/imfile.c
2014-07-13 13:07:08 +02:00
Tomas Heinrich
2ce6f44c86
bugfix: prevent a double free
...
cstrConvSzStrAndDestruct() frees it's first argument but doesn't set
it to NULL as rsCStrDestruct() does. In couple of cases the code using
it assumed it does which could have led to double free.
This commit aligns the prototype of cstrConvSzStrAndDestruct() with
rsCStrDestruct(). The callers were updated for the new behavior and
several potential memleaks were plugged.
Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/runtime/cfsysline.c:532: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/runtime/cfsysline.c:553: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").
Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/outchannel.c:113: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/outchannel.c:118: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").
Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/outchannel.c:181: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/outchannel.c:186: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").
Error: USE_AFTER_FREE (CWE-825):
rsyslog-7.4.10/template.c:480: freed_arg: "cstrConvSzStrAndDestruct(cstr_t *, uchar **, int)" frees "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:486:2: freed_arg: "free(void *)" frees parameter "pThis".
rsyslog-7.4.10/template.c:493: deref_arg: Calling "rsCStrDestruct(cstr_t **)" dereferences freed pointer "pStrB".
rsyslog-7.4.10/runtime/stringbuf.c:216:16: var_assign_parm: Assigning: "pThis" = "*ppThis".
rsyslog-7.4.10/runtime/stringbuf.c:218:2: deref_var: Dereferencing "pThis" (which is a copy of "*ppThis").
2014-07-11 15:19:43 +02:00
Rainer Gerhards
e3bcf3f0e8
add date-wday template option to complete date-related set
...
Was not requested, but makes sense to support it.
See also: https://github.com/rsyslog/rsyslog/issues/65
2014-04-30 11:47:47 +02:00
Rainer Gerhards
0ac1ce59dd
add remaining template options for date extraction
...
see also: https://github.com/rsyslog/rsyslog/issues/65
2014-04-30 11:20:07 +02:00
Rainer Gerhards
191ea63f3e
also support "wdayname" date format in list templates
2014-04-29 15:45:49 +02:00
Rainer Gerhards
25e8881d95
add date-wdayname property modifier
...
see also: https://github.com/rsyslog/rsyslog/issues/65
2014-04-29 13:13:51 +02:00
Rainer Gerhards
252c1b9652
improved error message for invalid field extraction in string template
...
see also: http://kb.monitorware.com/problem-with-field-based-extraction-t12299.html
2014-04-03 12:29:51 +02:00
Rainer Gerhards
5aaabc83da
Merge branch 'v7-stable'
...
Conflicts:
ChangeLog
configure.ac
doc/manual.html
plugins/ompgsql/ompgsql.c
2014-02-12 14:25:32 +01:00
Rainer Gerhards
771bc2fe5f
Merge branch 'v7-stable' into v7-devel
...
Conflicts:
ChangeLog
configure.ac
doc/manual.html
2014-02-12 13:01:21 +01:00
Alain
9d0fc675a5
json templates are improperly created
...
See also: https://github.com/rsyslog/rsyslog/issues/27
2014-02-12 10:31:58 +01:00
Nate Brown
1cd1ace0ff
Adding two new format types to import raw json strings as is
2014-01-24 16:39:29 -08:00
Rainer Gerhards
94729cd9f9
refactor ExtendBuf() interface for iparams
2013-12-06 10:03:32 +01:00
Rainer Gerhards
01de5afe83
refactor strgen interface once again
...
as this provides more flexibility and potentially better performance. We
try to squeueze all interface changes into as early an release as
possible.
2013-12-06 09:52:03 +01:00
Rainer Gerhards
a0d682ec1d
fix memory adressing error in refactored code
2013-12-04 17:17:45 +01:00
Rainer Gerhards
6ee2dc5ddd
do no longer use void* ptr in iparams as we know we deal with strings
2013-12-04 16:57:42 +01:00
Rainer Gerhards
4695ab7c3e
refactor output system string handling
2013-12-04 16:49:22 +01:00
Rainer Gerhards
69752635d2
refactor strgen interface
2013-12-04 11:55:36 +01:00
Rainer Gerhards
fb6dd02afc
refactor milestone: create first PoC of commitTransaction() entry point
2013-12-04 11:38:07 +01:00
Rainer Gerhards
140b5b22c0
cleanup/beautify
2013-12-03 18:57:05 +01:00
Rainer Gerhards
3b523a196a
reduced number of malloc/frees during string template processing
...
We now re-use once allocated string template memory for as long
as the worker thread exists. This saves us from doing new memory
allocs (and their free counterpart) when the next message is
processed. The drawback is that the cache always is the size of
the so-far largest message processed. This is not considered a
problem, as in any case a single messages' memory footprint should
be far lower than that of a whole set of messages (especially on
busy servers).
2013-12-03 17:03:22 +01:00
Rainer Gerhards
a16113442e
cleanup
2013-12-03 15:06:49 +01:00
Pavel Levshin
9c3a83f481
bugfix: regression in template processing
2013-11-08 15:55:05 +01:00
Rainer Gerhards
cdc306767d
fix small memleak introduced during refactoring
2013-10-23 16:10:55 +02:00
Rainer Gerhards
059a316824
refactor: align jsonFind() calling interface with recent changes
2013-10-23 15:59:23 +02:00
Rainer Gerhards
c0f4474389
refactor get.*PropVal() series of functions
2013-10-23 15:12:30 +02:00
Rainer Gerhards
eb9adf9baa
refactor: simplify JSON variable access
2013-10-23 13:08:56 +02:00
Rainer Gerhards
7d39740b3d
refactor: use common code for message property description processing
...
in all cases except script var access -- this comes next...
2013-10-22 17:55:35 +02:00
Rainer Gerhards
e4e1917629
refactor: more simplification in property handling
2013-10-21 17:33:46 +02:00
Rainer Gerhards
7a15d40a42
refactor: somewhat simplify property-name-to-id mapping
2013-10-21 17:22:32 +02:00
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