You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/004_Macros_of_syslog-ng.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,10 @@ facility letter can range from **A** to **Y**, where A corresponds to
37
37
facility number zero (LOG_KERN), B corresponds to facility 1
38
38
(LOG_USER), and so on.
39
39
40
+
## ${CONTEXT_ID}
41
+
42
+
The context_id for the pattern database rule that matched the message. see the context-id, context-timeout, and context-scope attributes of pattern database rules.
43
+
40
44
## Custom macros
41
45
42
46
CSV parsers and pattern databases can also define macros
@@ -155,6 +159,10 @@ ${ISOWEEK} macro.
155
159
156
160
Available in 3.24 and later.
157
161
162
+
## ${LEGACY_MSGHDR}
163
+
164
+
During default operation, {{ site.product.short_name }} stores the original incoming header of the log message. This is useful if the original format of a non-syslog-compliant message must be retained (as {{ site.product.short_name }} automatically corrects some non-compliant messages, the final result may slightly differ from the original).
165
+
158
166
## ${LEVEL_NUM}
159
167
160
168
The priority (also called severity) of the message,
@@ -533,6 +541,10 @@ Available in {{ site.product.short_name }} version 3.4 and later.
Copy file name to clipboardExpand all lines: doc/_admin-guide/120_Parser/010_JSON_parser/000_JSON_parser_options.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,36 @@
1
1
---
2
2
title: Options of JSON parsers
3
3
parser: json
4
+
prefix: empty
4
5
id: adm-parser-json-opt
5
6
description: >-
6
-
This section describes the options of the json-parser() in {{ site.product.short_name }}.
7
+
This section explains how to configure JSON parsing with extract-prefix() for subtree extraction, key-delimiter() for custom delimiters, marker() for identifying JSON messages, and prefix() for name-value pair prefixing in {{ site.product.short_name }}.
7
8
---
8
9
9
10
The JSON parser has the following options.
10
11
11
12
## extract-prefix()
12
13
13
-
| Synopsis: | extract-prefix() |
14
+
| Type: | string |
15
+
| Default: ||
14
16
15
17
*Description:* Extract only the specified subtree from the JSON message.
16
18
Use the dot-notation to specify the subtree. The rest of the message
17
19
will be ignored. For example, assuming that the incoming object is named
18
-
msg, the json-parser(extract-prefix(\"foo.bar\[5\]\")); parser is
19
-
equivalent to the msg.foo.bar\[5\] javascript code. Note that the
20
+
`msg`, the `json-parser(extract-prefix("foo.bar[5]"));` parser is
21
+
equivalent to the `msg.foo.bar[5]` javascript code. Note that the
20
22
resulting expression must be a JSON object in order to extract its
21
23
members into name-value pairs.
22
24
23
25
This feature also works when the top-level object is an array, because
24
26
you can use an array index at the first indirection level, for example:
25
-
json-parser(extract-prefix(\"\[5\]\")), which is equivalent to msg\[5\].
27
+
`json-parser(extract-prefix("[5]"))`, which is equivalent to `msg[5]`.
26
28
27
29
In addition to alphanumeric characters, the key of the JSON object can
28
30
contain the following characters:
29
-
!\"\#$%&\'()\*+,-/:;\<=\>?@\\\^\_\`{\|}\~
31
+
`` !"#$%&'()*+,-/:;<=>?@\^_`{|}~ ``
30
32
31
-
It cannot contain the following characters: .\]\[
33
+
It cannot contain the following characters: `.][`
32
34
33
35
### Example: Convert logstash eventlog format v0 to v1
34
36
@@ -56,22 +58,22 @@ parser p_jsoneventv0 {
56
58
## key-delimiter()
57
59
58
60
| Type: | character |
59
-
| Default: |. |
61
+
| Default: |`.`|
60
62
61
63
*Description:* The key-delimiter() option defines the used character when parsing flattened keys. Only single characters are supported.
62
64
63
-
Using the json-parser() without the key-delimiter() option, results in the dot(.) character being used:
65
+
Using the json-parser() without the key-delimiter() option, results in the dot`.` character being used:
64
66
65
67
```config
66
68
foo.key="value"
67
69
```
68
70
69
71
Using the json-parser() with the key-delimiter("~") option, results in the specified character being used:
70
72
71
-
72
73
## marker()
73
74
74
-
| Synopsis: | marker() |
75
+
| Type: | string |
76
+
| Default: ||
75
77
76
78
*Description:* Use a marker in case of mixed log messages, to identify
77
79
JSON encoded messages for the parser.
@@ -82,8 +84,8 @@ message only if it is present.
82
84
83
85
### Example: Using the marker option in JSON parser
84
86
85
-
This json parser parses log messages which use the \"@cee:\" marker in
86
-
front of the json payload. It inserts \".cee.\" in front of the name of
87
+
This json parser parses log messages which use the `@cee:` marker in
88
+
front of the json payload. It inserts `.cee.` in front of the name of
87
89
name-value pairs, so later on it is easier to find name-value pairs that
88
90
were parsed using this parser. (For details on selecting name-value
0 commit comments