-
Notifications
You must be signed in to change notification settings - Fork 3
/
01_pods.yaml
48 lines (48 loc) · 1.64 KB
/
01_pods.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
apiVersion: v1
kind: Pod
metadata:
namespace: default
name: command-demo-json
labels:
purpose: demonstrate-command-json
# annotations:
# co.elastic.logs/enabled: false # uncomment that if you don't want hints based autodiscover to fetch these logs
# For hints based autodiscover solution
# co.elastic.logs/processors.1.decode_json_fields.fields: ["message"]
# co.elastic.logs/processors.1.decode_json_fields.target: ""
# co.elastic.logs/processors.1.decode_json_fields.overwrite_keys: "true"
# co.elastic.logs/processors.1.decode_json_fields.add_error_key: "true"
spec:
containers:
- name: command-demo-container
image: endeveit/docker-jq
env:
- name: MESSAGE
#value: "{\"stream\": \"some_value\", \"edufield\": \"eduvalue\"}"
value: '{"stream": "custom_stream_name", "customfield1": "field-value-example"}'
command: ["/bin/sh"]
#args: ["-c", "while true; do echo $MESSAGE; sleep 10;done"]
args: ["-c", "while true; do echo $MESSAGE | jq -c .; sleep 10; done"]
restartPolicy: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
namespace: default
name: command-demo-text
labels:
purpose: demonstrate-command-text
# annotations:
# co.elastic.logs/enabled: false
# For hints based autodiscover solution
# co.elastic.logs/pipeline: ["custom-text-example"]
spec:
containers:
- name: command-demo-container
image: endeveit/docker-jq
env:
- name: MESSAGE
value: "field1value|field2value"
command: ["/bin/sh"]
args: ["-c", "while true; do echo \"$(date -u +\"%Y-%m-%dT%H:%M:%SZ\")|$MESSAGE\"; sleep 10; done"]
restartPolicy: OnFailure