-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathdata.html
2229 lines (1976 loc) · 68 KB
/
data.html
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{{/* This partial is for pretty much all structured data (VRL stuff, CLI, API, component configs/output/telemetry, etc.)
*/}}
{{ $ctx := . }}
<div class="relative no-prose border dark:border-gray-700 rounded-md shadow">
{{/* Source/transform/sink config */}}
{{ with .component_config }}
<div class="flex flex-col divide-y dark:divide-gray-700">
{{ range $k, $v := . }}
{{ if ne $k "type" }}
{{ $name := $k }}
<div class="p-4">
<span class="flex justify-between items-center">
{{/* Config name */}}
<span class="font-mono">
{{ partial "heading.html" (dict "text" $name "level" 3 "anchor" true "icon" false) }}
</span>
{{/* Config labels */}}
<span class="flex justify-between space-x-1">
{{ if $v.common }}
{{ partial "badge.html" (dict "word" "common" "color" "blue") }}
{{ end }}
{{ if $v.required }}
{{ partial "badge.html" (dict "word" "required" "color" "red") }}
{{ else }}
{{ partial "badge.html" (dict "word" "optional" "color" "blue") }}
{{ end }}
{{ range $k, $v := $v.type }}
{{ $isArray := eq $k "array" }}
{{ if $isArray }}
{{ range $k, $v := $v.items.type }}
{{ $name := printf "[%s]" $k }}
{{ partial "badge.html" (dict "word" $name "color" "gray") }}
{{ end }}
{{ else }}
{{ partial "badge.html" (dict "word" $k "color" "gray") }}
{{ end }}
{{ with $v.syntax }}
{{ if eq . "remap_program" }}
{{ partial "badge.html" (dict "word" . "color" "gray" "href" "/docs/reference/vrl#program") }}
{{ else if eq . "template" }}
{{ partial "badge.html" (dict "word" . "color" "gray" "href" "/docs/reference/configuration/template-syntax/") }}
{{ else }}
{{ partial "badge.html" (dict "word" . "color" "gray") }}
{{ end }}
{{ end }}
{{ if $v.enum }}
{{ partial "badge.html" (dict "word" "enum" "color" "yellow") }}
{{ end }}
{{ end }}
</span>
</span>
{{ if $v.deprecated }}
<div class="mt-3 border-2 rounded-md border-yellow-400 flex flex-col space-y-1.5 py-2 px-3">
<span>
{{ partial "heading.html" (dict "text" "Deprecated" "level" 4 "toc_hide" true) }}
</span>
<div class="flex space-x-5 items-center">
<div class="flex-shrink-0">
{{/* Heroicon: outline/exclamation-circle */}}
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-500 h-5 w-5" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="prose dark:prose-dark max-w-none leading-snug">
{{ if $v.deprecated_message }}
{{ $v.deprecated_message | markdownify }}
{{ else }}
This field is deprecated.
{{ end }}
</div>
</div>
</div>
{{ end }}
<div class="mt-6 prose dark:prose-dark max-w-none leading-snug text-gray-600 dark:text-gray-300">
{{ $v.description | markdownify }}
</div>
{{ with $v.warnings }}
<div class="mt-3 border-2 rounded-md border-yellow-400 flex flex-col space-y-1.5 py-2 px-3">
<span>
{{ partial "heading.html" (dict "text" "Warning" "level" 4 "toc_hide" true) }}
</span>
{{ range . }}
<div class="flex space-x-5 items-center">
<div class="flex-shrink-0">
{{/* Heroicon: outline/exclamation-circle */}}
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-500 h-5 w-5" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="prose dark:prose-dark max-w-none leading-snug">
{{ . | markdownify }}
</div>
</div>
{{ end }}
</div>
{{ end }}
{{ range $k, $v := $v.type }}
{{ if eq $k "condition" }}
{{ template "config-condition" (dict "name" $name "condition" $v) }}
{{ end }}
{{ if eq $k "object" }} {{/* Object (with sub-configs) */}}
<div class="mt-4">
{{ template "config-object" (dict "name" $name "config" $v "level" 4) }}
</div>
{{ else if eq $k "array" }} {{/* Array */}}
{{ with $v.items }}
<div class="mt-3 border rounded py-2 px-3 dark:border-gray-700">
{{ range $k, $v := . }}
{{ range $k, $v := . }}
<span class="flex justify-between items-center">
<span class="font-semibold">
Array
</span>
<span class="flex items-center space-x-1">
{{ partial "badge.html" (dict "word" $k "color" "gray") }}
{{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }}
</span>
</span>
{{ with $v.examples }}
{{ template "config-array-examples" (dict "examples" .) }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
{{ else }} {{/* Non-arrays/objects */}}
{{ if eq $v.syntax "template" }}
<div class="mt-4 text-sm">
<strong>Note</strong>: This parameter supports Vector's
<a href="/docs/reference/configuration/template-syntax">template syntax</a>, which enables you to use
dynamic per-event values.
</div>
{{ end }}
{{ with $v.examples }}
{{ template "config-examples" (dict "examples" .) }}
{{ end }}
{{ end }}
{{/* Enum */}}
{{ with $v.enum }}
<div class="mt-3 border rounded py-2 px-3 dark:border-gray-700">
<span class="flex justify-between items-center">
<span class="font-semibold">
Enum options
</span>
<span class="flex items-center space-x-1">
{{ partial "badge.html" (dict "word" $k "color" "gray") }}
{{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }}
</span>
</span>
<div class="mt-4 prose dark:prose-dark max-w-none">
{{ template "enum-options-table" . }}
</div>
</div>
{{ end }}
{{ end }}
{{/* Default value */}}
{{ range $k, $v := $v.type }}
{{ if or $v.default (eq $v.default false) }}
<div class="mt-4">
{{ template "default" . }}
</div>
{{ end }}
{{ end }}
{{/* "Relevant when" conditions */}}
{{ with .relevant_when }}
<div class="mt-2 text-sm flex justify-end">
<span>
Relevant when: <code>{{ . }}</code>
</span>
</div>
{{ end }}
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
{{/* Source/transform/sink requirements */}}
{{ with .component_requirements }}
<div class="py-4 px-6 flex items-center">
<div class="mr-8 flex-shrink-0">
{{/* Heroicon: outline/exclamation */}}
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-500 h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="flex flex-col space-y-4 overflow-x-auto">
{{ range . }}
<div class="prose dark:prose-dark max-w-none leading-normal">
{{ . | markdownify }}
</div>
{{ end }}
</div>
</div>
{{ end }}
{{/* Source/transform/sink output */}}
{{ with .component_output }}
<div class="py-3 px-5">
{{ with .metrics }}
<span class="flex items-center justify-between">
{{ partial "heading.html" (dict "text" "Metrics" "level" 3 "id" "output-metrics" "href" "#output-metrics") }}
<a href="/docs/about/under-the-hood/architecture/data-model/metric">
{{/* Heroicon: solid/question-mark-circle */}}
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd"
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z"
clip-rule="evenodd" />
</svg>
</a>
</span>
<div class="mt-3 border rounded divide-y dark:border-gray-700 dark:divide-gray-700">
{{ template "telemetry" . }}
</div>
{{ end }}
{{ with .logs }}
<span class="flex items-center justify-between">
{{ partial "heading.html" (dict "text" "Logs" "level" 3 "id" "output-logs" "href" "#output-logs") }}
<a href="/docs/about/under-the-hood/architecture/data-model/log">
{{/* Heroicon: solid/question-mark-circle */}}
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd"
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z"
clip-rule="evenodd" />
</svg>
</a>
</span>
<div
class="mt-3 border-2 rounded-md border-yellow-400 flex flex-col space-y-1.5 py-2 px-3">
<span>
<h4
x-data="{ show: false }" x-on:mouseover="show = true" x-on:mouseleave="show = false"
id="warning" class="flex items-center text-dark dark:text-gray-200 js-toc-ignore">
<span>Warning</span>
<a class="ml-2" x-show="show" href="#warning" style="display: none;"><svg
xmlns="http://www.w3.org/2000/svg" class="text-secondary dark:text-primary h-4 w-4"
fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"></path>
</svg>
</a>
</h4>
</span>
<div class="flex space-x-5 items-center">
<div class="flex-shrink-0">
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-500 h-5 w-5" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<div class="prose dark:prose-dark max-w-none leading-snug">The fields shown below will be
different if log namespacing is enabled.
See <a href="/blog/log-namespacing/">Log Namespacing</a> for
more details
</div>
</div>
</div>
<div class="mt-3 border rounded divide-y dark:border-gray-700 dark:divide-gray-700">
{{ template "logs_output" . }}
</div>
{{ end }}
</div>
{{ end }}
{{/* Source/transform outputs */}}
{{ with .component_outputs }}
<div class="flex flex-col divide-y dark:divide-gray-700">
{{ range . }}
<div class="py-3 px-5">
<span class="flex justify-between items-center">
<span class="font-mono">
{{ partial "heading.html" (dict "text" .name "level" 3 "anchor" true "icon" false) }}
</span>
</span>
<div class="my-3 prose dark:prose-dark max-w-none">
{{ .description | markdownify }}
</div>
</div>
{{ end }}
</div>
{{ end }}
{{/* Source/transform/sink examples */}}
{{ with .component_examples }}
{{ $formats := slice "toml" "yaml" "json" }}
{{ $defaultFormat := index $formats 0 }}
<div class="no-prose flex flex-col divide-y dark:divide-gray-700">
{{ range . }}
{{ $configs := .configuration }}
{{ $id := printf "examples-%s" .title | urlize }}
<div class="py-3 px-5 flex flex-col space-y-2">
<span>
{{ partial "heading.html" (dict "text" .title "level" 3 "id" $id) }}
</span>
<span>
Given this event...
</span>
<div>
{{ template "code" .input }}
</div>
<span>
...and this configuration...
</span>
<div class="py-2.5 px-3.5 border rounded dark:border-gray-700">
<div class="flex space-x-2">
{{ range $formats }}
<button @click="$store.global.setFormat('{{ . }}')"
:class="{ 'text-secondary dark:text-primary': $store.global.isFormat('{{ . }}') }" class="font-semibold">
{{ . | upper }}
</button>
{{ end }}
</div>
{{ range $formats }}
{{ $config := index $configs . }}
<div x-show="$store.global.isFormat('{{ . }}')" class="mt-2">
{{ highlight $config . "" }}
</div>
{{ end }}
</div>
<span>
...this Vector event is produced:
</span>
<div>
{{ template "code" .output }}
</div>
</div>
{{ end}}
</div>
{{ end }}
{{/* Source/transform/sink output */}}
{{ with .component_telemetry }}
<div class="py-4 px-6">
{{ with .metrics }}
<span class="flex items-center justify-between">
{{ partial "heading.html" (dict "text" "Metrics" "level" 3 "id" "telemetry-metrics" "href" "#telemetry-metrics")
}}
<a href="/docs/about/under-the-hood/architecture/data-model/metric">
link
</a>
</span>
<div class="mt-3 border rounded divide-y dark:border-gray-700 dark:divide-gray-700">
{{ template "telemetry" . }}
</div>
{{ end }}
{{ with .logs }}
<span class="flex items-center justify-between">
{{ partial "heading.html" (dict "text" "Logs" "id" "telemetry-logs" "href" "#telemetry-logs") }}
<a href="/docs/about/under-the-hood/architecture/data-model/log">
link
</a>
</span>
<div class="mt-3 border rounded divide-y dark:border-gray-700 dark:divide-gray-700">
{{ template "telemetry" . }}
</div>
{{ end }}
</div>
{{ end }}
{{/* Source/transform/sink warnings */}}
{{ with .component_warnings }}
<div class="no-prose py-4 px-6 flex items-center">
<div class="mr-8 flex-shrink-0">
<svg xmlns="http://www.w3.org/2000/svg" class="text-red-400 h-7 w-7" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="flex flex-col space-y-4 overflow-x-auto">
{{ range . }}
<div class="prose dark:prose-dark max-w-none leading-normal">
{{ . | markdownify }}
</div>
{{ end }}
</div>
</div>
{{ end }}
{{/* Source/transform/sink environment variables */}}
{{ with .component_env_vars }}
<div class="no-prose flex flex-col divide-y dark:divide-gray-700">
{{ range $k, $v := . }}
<div class="py-4 px-6">
<span class="flex justify-between items-center">
<span class="font-mono">
{{ $href := printf "#%s" $k | urlize }}
{{ partial "heading.html" (dict "text" $k "level" 3 "href" $href) }}
</span>
<span class="flex space-x-1">
{{ if $v.common }}
{{ partial "badge.html" (dict "word" "common" "color" "blue") }}
{{ end }}
{{ if $v.required }}
{{ partial "badge.html" (dict "word" "required" "color" "red") }}
{{ else }}
{{ partial "badge.html" (dict "word" "optional" "color" "blue") }}
{{ end }}
{{ range $k, $v := $v.type }}
{{ partial "badge.html" (dict "word" $k "color" "gray") }}
{{ with $v.syntax }}
{{ partial "badge.html" (dict "word" . "color" "gray") }}
{{ end }}
{{ if $v.enum }}
{{ partial "badge.html" (dict "word" "enum" "color" "yellow") }}
{{ end }}
{{ end }}
</span>
</span>
<div class="mt-4 prose prose-sm dark:prose-dark max-w-none">
{{ $v.description | markdownify }}
</div>
{{ range $k, $v := $v.type }}
{{ with $v.default }}
<span class="mt-2 text-sm">
Default: <code>{{ . }}</code>
</span>
{{ end }}
{{ end }}
{{ range $k, $v := $v.type }}
{{/* Enum */}}
{{ with $v.enum }}
<div class="mt-3 border rounded py-2 px-3 dark:border-gray-700">
<span class="flex justify-between items-center">
<span class="font-semibold">
Enum options
</span>
<span class="flex items-center space-x-1">
{{ partial "badge.html" (dict "word" $k "color" "gray") }}
{{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }}
</span>
</span>
<div class="mt-4 prose dark:prose-dark max-w-none">
{{ template "enum-options-table" . }}
</div>
</div>
{{ end }}
{{ with $v.examples }}
<div x-data="{ open: false }" class="mt-3 border rounded py-2 px-3 dark:border-gray-700">
<span class="flex justify-between items-center">
<span class="font-semibold">
Examples
</span>
{{ template "config-toggler" (dict "size" 4) }}
</span>
<div x-show="open">
{{ range . }}
<div class="overflow-x-scroll">
<span class="font-mono text-sm">
{{ . }}
</span>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
{{/* Data schemas (logs and metrics) */}}
{{ with .data_schema }}
<div class="flex flex-col divide-y dark:divide-gray-700">
<div class="prose dark:prose-dark max-w-none py-4 px-6">
{{ .description | markdownify }}
</div>
{{/* Options */}}
<div class="py-4 px-6">
<span>
{{ partial "heading.html" (dict "text" "Options" "level" 3) }}
</span>
<div class="mt-4 border rounded flex flex-col divide-y dark:divide-gray-700 dark:border-gray-700">
{{ range $k, $v := .type.object.options }}
{{ $name := $k }}
{{ $id := cond (eq $name "*") "star" $name }}
<div class="py-4 px-6">
<span class="flex items-center justify-between">
<span>
<h3 id="{{ $id }}" class="font-semibold font-mono text-sm dark:text-primary">
<a href="#{{ $id }}">
{{ $name }}
</a>
</h3>
</span>
<span class="flex space-x-1">
{{ if $v.common }}
{{ partial "badge.html" (dict "word" "common" "color" "indigo") }}
{{ end }}
{{ if $v.required }}
{{ partial "badge.html" (dict "word" "required" "color" "red") }}
{{ else }}
{{ partial "badge.html" (dict "word" "optional" "color" "gray") }}
{{ end }}
{{ range $k, $v := $v.type }}
{{ $type := cond (eq $k "object") "table" $k }}
{{ partial "badge.html" (dict "word" $type "color" "green") }}
{{ end }}
</span>
</span>
{{ with $v.description }}
<div class="mt-3">
{{ . | markdownify }}
</div>
{{ end }}
<div>
{{ range $k, $v := $v.type }}
{{ if eq $k "object" }}
<div class="mt-3">
<div class="border rounded flex flex-col divide-y dark:border-gray-700 dark:divide-gray-700">
{{ range $k, $v := $v.options }}
{{ $id := printf "%s-%s" $name $k }}
<div class="py-3 px-5">
<span class="flex justify-between items-center">
<span class="font-mono font-semibold">
<h4 id="{{ $id }}">
<a href="#{{ $id }}">
{{ $k }}
</a>
</h4>
</span>
<span class="flex space-x-1">
{{ if $v.required }}
{{ partial "badge.html" (dict "word" "required" "color" "red") }}
{{ else }}
{{ partial "badge.html" (dict "word" "optional" "color" "gray") }}
{{ end }}
{{ range $k, $v := $v.type }}
{{ partial "badge.html" (dict "word" $k "color" "green") }}
{{ with $v.syntax }}
{{ partial "badge.html" (dict "word" . "color" "gray") }}
{{ end }}
{{ if $v.enum }}
{{ partial "badge.html" (dict "word" "enum" "color" "yellow") }}
{{ end }}
{{ end }}
</span>
</span>
<div class="prose dark:prose-dark max-w-none">
{{ $v.description | markdownify }}
</div>
{{ range $k, $v := $v.type }}
{{ with $v.examples }}
<div class="mt-2">
<span class="font-semibold">
Examples
</span>
<span class="flex space-x-2">
{{ range . }}
<span class="font-mono text-sm text-secondary dark:text-primary">
{{ . }}
</span>
{{ end }}
</span>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{/* Examples */}}
{{ with .type.object.examples }}
<div class="py-4 px-6">
<span>
{{ partial "heading.html" (dict "text" "Examples" "level" 3) }}
</span>
<div class="mt-4 flex flex-col divide-y dark:divide-gray-700 dark:border-gray-700">
{{ range . }}
{{ template "code" . }}
{{ end }}
</div>
</div>
{{ end }}
</div>
{{ end }}
{{/* VRL function info (/vrl/functions) */}}
{{ with .vrl_functions }}
<div class="flex flex-col divide-y dark:divide-gray-700">
{{ range . }}
{{ $name := .name }}
{{ $func := index site.Data.docs.remap.functions .name }}
{{ $infallible := not $func.internal_failure_reasons }}
{{ $args := $func.arguments }}
{{ $requiredArgs := where $args "required" true }}
{{ $optionalArgs := where $args "required" false }}
{{ $lastArg := sub (len $args) 1 }}
{{ $return := $func.return }}
<div class="py-4 px-6">
{{/* Function title */}}
<span class="flex justify-between items-center">
<span class="font-mono">
{{ $href := printf "#%s" $name }}
{{ partial "heading.html" (dict "text" $name "level" 3 "href" $href "icon" false) }}
</span>
{{/* Badges */}}
<span class="flex space-x-1">
{{ $href := "/docs/reference/vrl/expressions/#function-call-characteristics" | relURL }}
{{ if $infallible }}
{{ partial "badge.html" (dict "word" "infallible" "color" "blue" "inline" true "href" $href) }}
{{ else }}
{{ partial "badge.html" (dict "word" "fallible" "color" "yellow" "inline" true "href" $href) }}
{{ end }}
</span>
</span>
{{/* Function description */}}
<div class="mt-6 prose prose-md dark:prose-dark max-w-none">
{{ $func.description | markdownify }}
</div>
{{/* Function spec, etc. */}}
{{ $id := printf "%s-function-spec" $name }}
<div class="mt-6">
<span>
{{ partial "heading.html" (dict "text" "Function spec" "level" 4 "id" $id "toc_hide" true) }}
</span>
<div class="my-2 font-mono text-sm bg-dark dark:bg-black px-3.5 py-2.5 rounded text-gray-100">
<span class="text-primary-dark dark:text-primary font-semibold">{{ $name }}</span>(
{{- $lastArg := sub (len $requiredArgs) 1 -}}
{{- range $idx, $arg := $requiredArgs -}}
{{ $isLast := eq $idx $lastArg -}}
<span class="font-bold text-secondary dark:text-primary">
{{- .name -}}
</span>:
<span class="text-gray-200">
<{{ delimit .type `<span class="text-grey-500"> |
</span>` }}></span>{{ if not $isLast }}, {{ end -}}
{{ end -}}
{{- if gt (len $optionalArgs) 0 -}},
[{{- $lastArg := sub (len $optionalArgs) 1 -}}
{{- range $idx, $arg := $optionalArgs -}}
{{ $isLast := eq $idx $lastArg -}}
<span class="text-indigo-500 dark:text-indigo-300">
{{- .name -}}
</span>:
<span class="text-gray-200">
<{{ delimit .type `<span class="text-grey-500"> |
</span>` }}></span>{{ if not $isLast }}, {{ end -}}
{{ end -}}]{{ end }})
{{- with $return -}}
<div class="ml-3">
<span class="font-extrabold">::</span> <span class="text-gray-200">
<{{ delimit .types " | " }}>
</span>{{ if not $infallible }}, <error>{{ end }}
</div>
{{- end -}}
</div>
<div class="mt-3 flex flex-row-reverse">
{{ template "vrl-function-legend" }}
</div>
{{/* Function arguments */}}
{{ with $args }}
<div class="mt-6 prose dark:prose-dark max-w-none">
{{ template "vrl-function-args" . }}
</div>
{{ end }}
{{/* Function notices */}}
{{ with $func.notices }}
{{ $id := printf "%s-notices" $name }}
<div class="mt-6">
<span>
{{ partial "heading.html" (dict "text" "Notices" "level" 4 "id" $id "toc_hide" true) }}
</span>
<span class="mt-2 text-sm prose prose-md dark:prose-dark max-w-none">
This function has special behavior that you should be aware of.
</span>
<div class="mt-1.5 flex flex-col space-y-2">
{{ range . }}
<div class="flex space-x-5 items-center">
<div class="flex-shrink-0 py-1">
{{/* Heroicon: outline/exclamation-circle */}}
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-500 h-5 w-5" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="prose prose-sm dark:prose-dark max-w-none leading-snug">
{{ . | markdownify }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{/* Function errors */}}
{{ with $func.internal_failure_reasons }}
{{ $id := printf "%s-errors" $name }}
<div class="mt-6">
<span>
{{ partial "heading.html" (dict "text" "Errors" "level" 4 "id" $id "toc_hide" true) }}
</span>
<span class="mt-2 text-sm prose prose-md dark:prose-dark max-w-none">
The <code>{{ $name }}</code> function is <strong>fallible</strong>, which means that
<a href="/docs/reference/vrl/errors">error handling</a> is required for these errors:
</span>
<div class="mt-1.5">
{{ range . }}
<div class="flex space-x-5 items-center">
<div class="flex-shrink-0 py-1">
{{/* Heroicon: outline/exclamation */}}
<svg xmlns="http://www.w3.org/2000/svg" class="text-red-400 h-5 w-5" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="prose prose-sm dark:prose-dark max-w-none leading-snug">
{{ . | markdownify }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{/* Function examples */}}
{{ with $func.examples }}
{{ $id := printf "%s-examples" $name }}
<div class="mt-6">
<span>
{{ partial "heading.html" (dict "text" "Examples" "level" 4 "id" $id "toc_hide" true) }}
</span>
<div class="mt-2 flex flex-col space-y-4">
{{ range . }}
{{ template "vrl-function-example" (dict "name" $name "ctx" .) }}
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
{{ end }}
{{/* Real-world examples */}}
{{ with .vrl_real_world_examples }}
<div class="flex flex-col divide-y dark:divide-gray-700">
{{ range . }}
{{ $input := dict "message" .input.log.message | jsonify (dict "indent" " ") }}
{{ $vrlSourceCode := highlight .source "toml" "" }}
{{ $output := .output | jsonify (dict "indent" " ") }}
{{ $outputCode := highlight $output "json" "" }}
<div class="py-3 px-5">
<span class="font-semibold tracking-tight">
{{ $href := printf "#%s" (.title | urlize) }}
{{ partial "heading.html" (dict "text" .title "level" 3 "href" $href "icon" false) }}
</span>
<div class="mt-3 flex flex-col space-y-2">
{{ with .input.log }}
{{ $json := . | jsonify (dict "indent" " ") }}
{{ $code := highlight $json "json" "" }}
<span>
Given this <a href="/docs/about/under-the-hood/architecture/data-model/log">Vector log event</a>...
</span>
{{ $code }}
{{ end }}
{{ with .input.metric }}
{{ $json := . | jsonify (dict "indent" " ") }}
{{ $code := highlight $json "json" "" }}
<span>
Given this <a href="/docs/about/under-the-hood/architecture/data-model/metric">Vector metric event</a>...
</span>
{{ $code }}
{{ end }}
<span>
...and this VRL program...
</span>
{{ $vrlSourceCode }}
{{ if .raises }}
{{ $errorCode := highlight .raises.compiletime "rust" "" }}
<span>
...you should see this error:
</span>
{{ $errorCode }}
{{ else }}
{{ with .input.log }}
<span>...the following log event is output:</span>
{{ end }}
{{ with .input.metric }}
<span>...the following metric event is output:</span>
{{ end }}
{{ $outputCode }}
{{ end }}
</div>
</div>
{{ end }}
</div>
{{ end }}
{{/* Compile-time errors */}}
{{ with .vrl_compile_time_errors }}
<div class="divide-y dark:divide-gray-700">
{{ range $code, $error := . }}
{{ $id := printf "%s %s" $code $error.title | urlize }}
<div class="p-6">
<span>
<h3 id="{{ $code }}">
<span class="font-mono text-secondary">
{{ $code }}
</span>
<a href="#{{ $code }}" class="text-gray-700 dark:text-white tracking-tight">
{{ $error.title }}
</a>
</h3>
</span>
<div x-show="open" class="mt-4">
{{ with $error.description }}
<div class="leading-tight">
{{ . | markdownify }}
</div>
{{ end }}
{{ with $error.rationale }}
{{ $id := printf "error-%s-rationale" $code }}
<div class="mt-3">
<span class="flex items-center space-x-1.5">
{{/* Heroicon: outline/zoom-in */}}
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-indigo-500 dark:text-indigo-400" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7" />
</svg>
{{ partial "heading.html" (dict "text" "Rationale" "level" 4 "id" $id "toc_hide" true) }}
</span>
<div class="mt-2 leading-tight">
{{ . | markdownify }}
</div>
</div>
{{ end }}
{{ with $error.resolution }}
{{ $id := printf "error-%s-resolution" $code }}
<div class="mt-3">
<span class="flex items-center space-x-1.5">
{{/* Heroicon: outline/trending-up */}}
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-blue-500 dark:text-blue-400" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
</svg>
{{ partial "heading.html" (dict "text" "Resolution" "level" 4 "id" $id "toc_hide" true) }}
</span>
<div class="mt-2 leading-tight">
{{ . | markdownify }}
</div>
</div>
{{ end }}
{{ with $error.examples }}
{{ $id := printf "error-%s-examples" $code }}
<div x-data="{ open: location.hash.startsWith('#error-{{ $code }}') }"
class="mt-5 rounded-md px-3 py-2 dark:border-gray-700 border">
<span class="flex justify-between items-center">
<span class="flex items-center space-x-2">
{{/* Heroicon: outline/code */}}
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-secondary dark:text-primary" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
</svg>
{{ partial "heading.html" (dict "text" "Examples" "level" 4 "toc_hide" true "id" $id) }}
</span>
{{ template "vrl-toggler" }}
</span>
<div x-show="open"
class="mt-2 flex flex-col divide-y dark:divide-gray-700 border rounded dark:border-gray-700">
{{ range . }}
{{ $id := printf "error-%s-example-%s" $code (.title | urlize) }}
<div class="flex flex-col space-y-1 py-2.5 px-4 rounded-sm dark:border-gray-700">
<span>
{{ partial "heading.html" (dict "text" .title "level" 5 "id" $id "toc_hide" true) }}
</span>
{{/* Example event (log or metric) */}}
{{ with .input }}
{{ with .log }} {{/* Log event */}}
{{ $json := . | jsonify (dict "indent" " ") }}
<div>
<span class="tracking-tighter font-semibold text-sm">
Log event
</span>