Skip to content

Commit 5c7b82a

Browse files
committed
Adding YAML examples to JSON parser doc. Part of issue #1865.
Signed-off-by: Eric D. Schabell <[email protected]>
1 parent 933e836 commit 5c7b82a

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

pipeline/parsers/json.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,34 @@ The _JSON_ parser transforms JSON logs by converting them to internal binary rep
44

55
For example, the default parsers configuration file includes a parser for parsing Docker logs (when the Tail input plugin is used):
66

7-
```python
7+
{% tabs %}
8+
{% tab title="parsers.yaml" %}
9+
10+
```yaml
11+
parsers:
12+
- name: docker
13+
format: json
14+
time_key: time
15+
time_format: '%Y-%m-%dT%H:%M:%S %z'
16+
```
17+
18+
{% endtab %}
19+
{% tab title="parsers.conf" %}
20+
21+
```text
822
[PARSER]
923
Name docker
1024
Format json
1125
Time_Key time
1226
Time_Format %Y-%m-%dT%H:%M:%S %z
1327
```
1428

29+
{% endtab %}
30+
{% endtabs %}
31+
1532
The following log entry is valid content for the previously defined parser:
1633

17-
```javascript
34+
```text
1835
{"key1": 12345, "key2": "abc", "time": "2006-07-28T13:22:04Z"}
1936
```
2037

@@ -24,4 +41,4 @@ After processing, its internal representation will be:
2441
[1154103724, {"key1"=>12345, "key2"=>"abc"}]
2542
```
2643

27-
The time was converted to a UTC timestamp and the map was reduced to each component of the original message.
44+
The time was converted to a UTC timestamp and the map was reduced to each component of the original message.

0 commit comments

Comments
 (0)