-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Expand file tree
/
Copy pathflattened.csv-spec
More file actions
315 lines (271 loc) · 11.9 KB
/
flattened.csv-spec
File metadata and controls
315 lines (271 loc) · 11.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
flattened root fields
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| SORT @timestamp ASC
| LIMIT 2
;
@timestamp:date | attributes:unsupported | resource.attributes:unsupported
2020-01-01T00:02:48.461Z | null | null
2020-01-01T00:07:43.000Z | null | null
;
// ----------------------------------------------------
flattened KEEP subfield
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| KEEP @timestamp, resource.attributes.host.name
| SORT @timestamp ASC
;
@timestamp:date | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T00:58:35.557Z | infra-filebeat-mdvqm
2020-01-01T10:12:02.675Z | filebeat-8pmfj
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
2020-01-01T11:43:13.255Z | filebeat-6t7v6
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683
2020-01-01T21:03:55.497Z | infra-filebeat-z5mjq
2020-01-01T21:38:06.655Z | infra-filebeat-cpcmv
;
// ----------------------------------------------------
flattened DROP subfield
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| DROP resource.attributes.agent.type
| KEEP @timestamp, resource.attributes.host.name
| SORT @timestamp ASC
;
@timestamp:date | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T00:58:35.557Z | infra-filebeat-mdvqm
2020-01-01T10:12:02.675Z | filebeat-8pmfj
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
2020-01-01T11:43:13.255Z | filebeat-6t7v6
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683
2020-01-01T21:03:55.497Z | infra-filebeat-z5mjq
2020-01-01T21:38:06.655Z | infra-filebeat-cpcmv
;
// ----------------------------------------------------
flattened DROP subfield after KEEP
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| KEEP @timestamp, resource.attributes.host.name, resource.attributes.agent.type
| DROP resource.attributes.agent.type
| SORT @timestamp ASC
;
@timestamp:date | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T00:58:35.557Z | infra-filebeat-mdvqm
2020-01-01T10:12:02.675Z | filebeat-8pmfj
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
2020-01-01T11:43:13.255Z | filebeat-6t7v6
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683
2020-01-01T21:03:55.497Z | infra-filebeat-z5mjq
2020-01-01T21:38:06.655Z | infra-filebeat-cpcmv
;
// ----------------------------------------------------
flattened subfield with WHERE
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| WHERE resource.attributes.host.name == "infra-filebeat-6vjxr"
| SORT @timestamp ASC
;
@timestamp:date | attributes:unsupported | resource.attributes:unsupported | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | null | null | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | null | null | infra-filebeat-6vjxr
;
// ----------------------------------------------------
flattened subfield with WHERE and KEEP *
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| WHERE resource.attributes.host.name == "infra-filebeat-6vjxr"
| KEEP *
| SORT @timestamp ASC
;
@timestamp:date | attributes:unsupported | resource.attributes:unsupported | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | null | null | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | null | null | infra-filebeat-6vjxr
;
// ----------------------------------------------------
flattened subfield with WHERE and KEEP specific subfields
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| WHERE resource.attributes.host.name == "infra-filebeat-6vjxr"
| KEEP @timestamp, resource.attributes.host.name
| SORT @timestamp ASC
;
@timestamp:date | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
;
// ----------------------------------------------------
flattened subfield with EVAL TO_UPPER
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| EVAL upper_host = TO_UPPER(resource.attributes.host.name)
| KEEP @timestamp, upper_host
| SORT @timestamp ASC
;
@timestamp:date | upper_host:keyword
2020-01-01T00:02:48.461Z | INFRA-FILEBEAT-6VJXR
2020-01-01T00:07:43.000Z | DEVOPS-CI-MASTER-BLUE.C.ELASTIC-CI-PROD.INTERNAL
2020-01-01T00:31:18.303Z | ELASTICSEARCH-CI-IMMUTABLE-SLES-15-1599243844262984968
2020-01-01T00:58:35.557Z | INFRA-FILEBEAT-MDVQM
2020-01-01T10:12:02.675Z | FILEBEAT-8PMFJ
2020-01-01T11:38:54.751Z | INFRA-FILEBEAT-6VJXR
2020-01-01T11:43:13.255Z | FILEBEAT-6T7V6
2020-01-01T14:37:29.195Z | ELASTICSEARCH-CI-IMMUTABLE-DEBIAN-9-PKG-1599049660880335683
2020-01-01T21:03:55.497Z | INFRA-FILEBEAT-Z5MJQ
2020-01-01T21:38:06.655Z | INFRA-FILEBEAT-CPCMV
;
// ----------------------------------------------------
flattened subfield with EVAL LENGTH
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| EVAL host_length = LENGTH(resource.attributes.host.name)
| KEEP @timestamp, host_length
| SORT @timestamp ASC
;
@timestamp:date | host_length:integer
2020-01-01T00:02:48.461Z | 20
2020-01-01T00:07:43.000Z | 48
2020-01-01T00:31:18.303Z | 54
2020-01-01T00:58:35.557Z | 20
2020-01-01T10:12:02.675Z | 14
2020-01-01T11:38:54.751Z | 20
2020-01-01T11:43:13.255Z | 14
2020-01-01T14:37:29.195Z | 59
2020-01-01T21:03:55.497Z | 20
2020-01-01T21:38:06.655Z | 20
;
// ----------------------------------------------------
SORT on flattened subfield
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| SORT resource.attributes.host.name ASC, @timestamp ASC
| KEEP @timestamp, resource.attributes.host.name
;
@timestamp:date | resource.attributes.host.name:keyword
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T11:43:13.255Z | filebeat-6t7v6
2020-01-01T10:12:02.675Z | filebeat-8pmfj
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
2020-01-01T21:38:06.655Z | infra-filebeat-cpcmv
2020-01-01T00:58:35.557Z | infra-filebeat-mdvqm
2020-01-01T21:03:55.497Z | infra-filebeat-z5mjq
;
// ----------------------------------------------------
RENAME flattened subfield
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| RENAME resource.attributes.host.name AS host_name
| KEEP @timestamp, host_name
| SORT host_name ASC, @timestamp ASC
;
@timestamp:date | host_name:keyword
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T11:43:13.255Z | filebeat-6t7v6
2020-01-01T10:12:02.675Z | filebeat-8pmfj
2020-01-01T00:02:48.461Z | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | infra-filebeat-6vjxr
2020-01-01T21:38:06.655Z | infra-filebeat-cpcmv
2020-01-01T00:58:35.557Z | infra-filebeat-mdvqm
2020-01-01T21:03:55.497Z | infra-filebeat-z5mjq
;
// ----------------------------------------------------
flattened subfield with STATS count
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| STATS count(*) BY resource.attributes.agent.type
;
count(*):long | resource.attributes.agent.type:keyword
10 | filebeat
;
// ----------------------------------------------------
flattened subfield with STATS count_distinct
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| STATS count_distinct(resource.attributes.host.name)
;
count_distinct(resource.attributes.host.name):long
9
;
// ----------------------------------------------------
flattened subfield with INLINE STATS
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| INLINE STATS count = COUNT(*) BY resource.attributes.host.name
| DROP attributes, resource.attributes
| SORT count DESC, @timestamp ASC
| LIMIT 5
;
@timestamp:date | count:long | resource.attributes.host.name:keyword
2020-01-01T00:02:48.461Z | 2 | infra-filebeat-6vjxr
2020-01-01T11:38:54.751Z | 2 | infra-filebeat-6vjxr
2020-01-01T00:07:43.000Z | 1 | devops-ci-master-blue.c.elastic-ci-prod.internal
2020-01-01T00:31:18.303Z | 1 | elasticsearch-ci-immutable-sles-15-1599243844262984968
2020-01-01T00:58:35.557Z | 1 | infra-filebeat-mdvqm
;
// ----------------------------------------------------
flattened subfield with MV_EXPAND
required_capability: load_flattened_field
required_capability: optional_fields_v3
SET unmapped_fields="load"\;
FROM flattened_otel_logs
| MV_EXPAND resource.attributes.host.ip
| WHERE resource.attributes.host.ip IS NOT NULL
| KEEP @timestamp, resource.attributes.host.name, resource.attributes.host.ip
| SORT @timestamp ASC, resource.attributes.host.ip ASC
| LIMIT 20
;
@timestamp:datetime | resource.attributes.host.name:keyword | resource.attributes.host.ip:keyword
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal | 10.224.0.170
2020-01-01T00:07:43.000Z | devops-ci-master-blue.c.elastic-ci-prod.internal | fe80::4001:aff:fee0:aa
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968 | 10.224.0.109
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968 | 172.17.0.1
2020-01-01T00:31:18.303Z | elasticsearch-ci-immutable-sles-15-1599243844262984968 | fe80::4001:aff:fee0:6d
2020-01-01T10:12:02.675Z | filebeat-8pmfj | 10.72.3.6
2020-01-01T11:43:13.255Z | filebeat-6t7v6 | 10.72.1.5
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683 | 10.224.2.157
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683 | 172.17.0.1
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683 | fe80::4001:aff:fee0:29d
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683 | fe80::42:48ff:fe1a:ed7d
2020-01-01T14:37:29.195Z | elasticsearch-ci-immutable-debian-9-pkg-1599049660880335683 | fe80::9c8e:44ff:fe9e:da94
;