{{/* This partial is for pretty much all structured data (VRL stuff, CLI, API, component configs/output/telemetry, etc.) */}} {{ $ctx := . }}
{{/* Source/transform/sink config */}} {{ with .component_config }}
{{ range $k, $v := . }} {{ if ne $k "type" }} {{ $name := $k }}
{{/* Config name */}} {{ partial "heading.html" (dict "text" $name "level" 3 "anchor" true "icon" false) }} {{/* Config labels */}} {{ 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" "gray") }} {{ 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 }} {{ if $v.enum }} {{ partial "badge.html" (dict "word" "enum" "color" "yellow") }} {{ end }} {{ end }}
{{ $v.description | markdownify }}
{{ range $k, $v := $v.type }} {{ if eq $k "object" }} {{/* Object (with sub-configs) */}}
{{ range $k, $v := $v.options }}
{{ $text := printf "%s.%s" $name $k }} {{ partial "heading.html" (dict "text" $text "level" 4 "anchor" true "icon" false "id" $text) }} {{ 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" $v.syntax "color" "gray") }} {{ end }} {{ end }}
{{ $v.description | markdownify }}
{{/* "Relevant when" conditions */}} {{ with .relevant_when }}
Relevant when: {{ . }}
{{ end }} {{/* Default value */}} {{ range $k, $v := $v.type }} {{ if or $v.default (eq $v.default false) }}
{{ template "default" . }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{/* Enum */}} {{ with $v.enum }}
Enum options {{ partial "badge.html" (dict "word" $k "color" "gray") }} {{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }}
{{ template "enum-options-table" . }}
{{ end }} {{/* Array */}} {{ if eq $k "array" }} {{ with $v.items }}
{{ range $k, $v := . }} {{ range $k, $v := . }} Array {{ partial "badge.html" (dict "word" $k "color" "gray") }} {{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }} {{ with $v.examples }} {{ $json := . | jsonify (dict "indent" " ") }}
Examples {{ template "config-toggler" (dict "size" 4) }}
{{ highlight $json "json" "" }}
{{ end }} {{ end }} {{ end }}
{{ end }} {{ end }} {{ end }} {{/* Default value */}} {{ range $k, $v := $v.type }} {{ if or $v.default (eq $v.default false) }}
{{ template "default" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{/* Source/transform/sink requirements */}} {{ with .component_requirements }}
{{/* Heroicon: outline/exclamation */}}
{{ range . }}
{{ . | markdownify }}
{{ end }}
{{ end }} {{/* Source/transform/sink output */}} {{ with .component_output }}
{{ with .metrics }} {{ partial "heading.html" (dict "text" "Metrics" "level" 3 "id" "output-metrics" "href" "#output-metrics") }} {{/* Heroicon: solid/question-mark-circle */}}
{{ template "telemetry" . }}
{{ end }} {{ with .logs }} {{ partial "heading.html" (dict "text" "Logs" "level" 3 "id" "output-logs" "href" "#output-logs") }} {{/* Heroicon: solid/question-mark-circle */}}
{{ template "telemetry" . }}
{{ end }}
{{ end }} {{/* Source/transform/sink examples */}} {{ with .component_examples }} {{ $multiple := gt (len . ) 1 }}
{{ if $multiple }} {{ $first := index . 0 }}
{{ range . }}
{{ template "example" . }}
{{ end }}
{{ else }} {{ $example := index . 0 }}
{{ template "example" $example }}
{{ end }}
{{ end }} {{/* Source/transform/sink output */}} {{ with .component_telemetry }}
{{ with .metrics }} {{ partial "heading.html" (dict "text" "Metrics" "level" 3 "id" "telemetry-metrics" "href" "#telemetry-metrics") }} link
{{ template "telemetry" . }}
{{ end }} {{ with .logs }} {{ partial "heading.html" (dict "text" "Logs" "id" "telemetry-logs" "href" "#telemetry-logs") }} link
{{ template "telemetry" . }}
{{ end }}
{{ end }} {{/* Source/transform/sink warnings */}} {{ with .component_warnings }}
{{ range . }}
{{ . | markdownify }}
{{ end }}
{{ end }} {{/* Source/transform/sink environment variables */}} {{ with .component_env_vars }}
{{ range $k, $v := . }}
{{ $href := printf "#%s" $k | urlize }} {{ partial "heading.html" (dict "text" $k "level" 3 "href" $href) }} {{ 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") }} {{ partial "badge.html" (dict "word" $v.syntax "color" "gray") }} {{ end }}
{{ $v.description | markdownify }}
{{ range $k, $v := $v.type }} {{ with $v.default }} Default: {{ . }} {{ end }} {{ end }} {{ range $k, $v := $v.type }} {{ with $v.examples }}
Examples {{ template "config-toggler" (dict "size" 4) }}
{{ range . }}
{{ . }}
{{ end }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{/* Data schemas (logs and metrics) */}} {{ with .data_schema }}
{{ .description | markdownify }}
{{/* Options */}}
{{ partial "heading.html" (dict "text" "Options" "level" 3) }}
{{ range $k, $v := .type.object.options }} {{ $name := $k }} {{ $id := cond (eq $name "*") "star" $name }}

{{ $name }}

{{ 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 }}
{{ with $v.description }}
{{ . | markdownify }}
{{ end }}
{{ range $k, $v := $v.type }} {{ if eq $k "object" }}
{{ range $k, $v := $v.options }} {{ $id := printf "%s-%s" $name $k }}

{{ $k }}

{{ 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 }}
{{ $v.description | markdownify }}
{{ range $k, $v := $v.type }} {{ with $v.examples }}
Examples {{ range . }} {{ . }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
{{ end }}
{{/* Examples */}} {{ with .type.object.examples }}
{{ partial "heading.html" (dict "text" "Examples" "level" 3) }}
{{ range . }} {{ template "code" . }} {{ end }}
{{ end }}
{{ end }} {{/* VRL function info (/vrl/functions) */}} {{ with .vrl_functions }}
{{ range . }} {{ $name := .name }} {{ $func := index site.Data.docs.remap.functions .name }} {{ $infallible := not $func.internal_failure_reasons }} {{ $args := $func.arguments }} {{ $lastArg := sub (len $args) 1 }} {{ $return := $func.return }}
{{/* Function title */}} {{ $href := printf "#%s" $name }} {{ partial "heading.html" (dict "text" $name "level" 3 "href" $href "icon" false) }} {{/* Badges */}} {{ if $infallible }} {{ partial "badge.html" (dict "word" "infallible" "color" "blue") }} {{ else }} {{ partial "badge.html" (dict "word" "fallible" "color" "red") }} {{ end }} {{/* Function description */}}
{{ $func.description | markdownify }}
{{/* Function spec, etc. */}}
Function spec
{{ $name }}( {{- range $idx, $arg := $args -}} {{ $isLast := eq $idx $lastArg -}} {{- .name -}} : <{{ delimit .type ` | ` }}>{{ if not $isLast }}, {{ end -}} {{ end -}} ) {{- with $return -}}
:: <{{ delimit .types " | " }}>
{{- end -}}
{{/* Function arguments */}} {{ with $args }}
{{ template "vrl-function-args" . }}
{{ end }}
{{ template "vrl-function-legend" }}
{{ with $func.examples }}
Examples {{ template "config-toggler" (dict "size" 4) }}
{{ range . }} {{ template "vrl-function-example" . }} {{ end }}
{{ end }} {{ with $func.notices }}
Notices This function has special behavior that you should be aware of.
{{ range . }}
{{/* Heroicon: outline/exclamation */}}
{{ . | markdownify }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* Real-world examples */}} {{ with .vrl_real_world_examples }}
{{ range . }} {{ $input := dict "message" .input.log.message | jsonify (dict "indent" " ") }} {{ $vrlSourceCode := highlight .source "toml" "" }} {{ $output := .output | jsonify (dict "indent" " ") }} {{ $outputCode := highlight $output "json" "" }}
{{ $href := printf "#%s" (.title | urlize) }} {{ partial "heading.html" (dict "text" .title "level" 3 "href" $href "icon" false) }}
{{ with .input.log }} {{ $json := . | jsonify (dict "indent" " ") }} {{ $code := highlight $json "json" "" }} Given this Vector log event... {{ $code }} {{ end }} {{ with .input.metric }} {{ $json := . | jsonify (dict "indent" " ") }} {{ $code := highlight $json "json" "" }} Given this Vector metric event... {{ $code }} {{ end }} ...and this VRL program... {{ $vrlSourceCode }} {{ if .raises }} {{ $errorCode := highlight .raises.compiletime "ruby" "" }} ...you should see this error: {{ $errorCode }} {{ else }} {{ with .input.log }} ...the following log event is output: {{ end }} {{ with .input.metric }} ...the following metric event is output: {{ end }} {{ $outputCode }} {{ end }}
{{ end }}
{{ end }} {{/* Compile-time errors */}} {{ with .vrl_compile_time_errors }}
{{ range $code, $error := . }} {{ $id := printf "%s %s" $code $error.title | urlize }}

{{ $code }} {{ $error.title }}

{{ with $error.description }}
{{ . | markdownify }}
{{ end }} {{ with $error.rationale }}
{{/* Heroicon: outline/zoom-in */}} Rationale
{{ . | markdownify }}
{{ end }} {{ with $error.resolution }}
{{/* Heroicon: outline/trending-up */}} Resolution
{{ . | markdownify }}
{{ end }} {{ with $error.examples }}
{{/* Heroicon: outline/code */}} Examples {{ template "vrl-toggler" }}
{{ range . }}
{{ .title }} {{/* Example event (log or metric) */}} {{ with .input }} {{ with .log }} {{/* Log event */}} {{ $json := . | jsonify (dict "indent" " ") }}
Log event {{ highlight $json "json" "" }}
{{ end }} {{ with .metric }} {{/* Metric event */}} {{ $json := . | jsonify (dict "indent" " ") }}
Metric event {{ highlight $json "json" "" }}
{{ end }} {{ end }} {{ with .source }}
VRL program {{ highlight . "ruby" "" }}
{{ end }} {{/* Example diff */}} {{ with .diff }}
How to fix it {{ highlight . "diff" "" }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL expressions */}} {{ with .vrl_expressions }}
{{ range $k, $v := . }} {{ $id := $v.title | urlize }}
{{ partial "heading.html" (dict "text" $v.title "level" 3 "anchor" true "icon" false) }}
{{ $v.description | markdownify }}
{{ with $v.grammar }} {{ $id := printf "%s-grammar" $k }}
{{ partial "heading.html" (dict "text" "Grammar" "level" 4 "anchor" true "icon" false) }}
{{ highlight .source "ruby" "" }}
{{ with .definitions }}
{{ range $k, $v := . }} {{ end }}
Argument Meaning
{{ $k }} {{ $v.description | markdownify }}
{{ end }}
{{ end }} {{ with $v.examples }} {{ $id := printf "%s-examples" $k }}
{{ partial "heading.html" (dict "text" "Examples" "level" 4 "anchor" true "icon" false) }}
{{ range . }} {{ template "vrl-data-example" . }} {{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL examples */}} {{ with .vrl_examples }}
{{ range . }} {{ $name := .name }} {{ $link := printf "docs/reference/vrl/functions/#%s" $name | relURL }}
{{ partial "heading.html" (dict "text" $name "level" 3) }}
{{ .description | markdownify }}
{{ range .examples }}
{{ partial "heading.html" (dict "text" .title "level" 4) }}
Source
{{ highlight .source "ruby" "" }}
{{ with .return }}
Return
{{ template "code" . }}
{{ end }}
{{/* Heroicon: outline/light-bulb */}} Learn more about the {{ $name }} function
{{ end }}
{{ end }}
{{ end }} {{/* VRL syntax */}} {{ with .vrl_syntax }}
{{ range . }}
{{ partial "heading.html" (dict "text" .title "level" 3) }} {{ with .description }}
{{ . | markdownify }}
{{ end }} {{ with .examples }}
{{ partial "heading.html" (dict "text" "Examples" "level" 4) }}
{{ range . }} {{ highlight . "text" "" }} {{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL literals */}} {{ with .vrl_literals }}
{{ range $k, $v := . }} {{ $href := printf "#%s" ($v.title | urlize) }}
{{ partial "heading.html" (dict "text" $v.title "level" 3 "href" $href "icon" false) }} {{ with $v.description }}
{{ . | markdownify }}
{{ end }} {{ with $v.examples }}
{{ partial "heading.html" (dict "text" "Examples" "level" 4 "icon" false) }}
{{ range . }} {{ highlight . "ruby" "" }} {{ end }}
{{ end }} {{ with $v.characteristics }}
{{ partial "heading.html" (dict "text" "Characteristics" "level" 4 "icon" false) }}
{{ range . }}
{{ partial "heading.html" (dict "text" .title "level" 5 "icon" false) }} {{ with .description }}
{{ . | markdownify }}
{{ end }} {{ with .enum }}
Enum options
{{ template "enum-options-table" . }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL concepts */}} {{ with .vrl_concepts }}
{{ range $k, $v := . }} {{ $id := .anchor }}
{{ partial "heading.html" (dict "text" $v.title "level" 3) }}
{{ $v.description | markdownify }}
{{ with $v.characteristics }} {{ $id := printf "%s-characteristics" $id }}
{{ partial "heading.html" (dict "text" "Characteristics" "level" 4 "id" $id) }}
{{ range . }}
{{ partial "heading.html" (dict "text" .title "level" 5) }}
{{ .description | markdownify }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL features */}} {{ with .vrl_features }}
{{ range . }} {{ $id := .anchor }}
{{ partial "heading.html" (dict "text" .title "level" 3) }}
{{ .description | markdownify }}
{{ with .characteristics }} {{ $id := printf "%s-characteristics" $id }}
{{ partial "heading.html" (dict "text" "Characteristics" "level" 4) }}
{{ range . }}
{{ partial "heading.html" (dict "text" .title "level" 5) }}
{{ .description | markdownify }}
{{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* VRL principles */}} {{ with .vrl_principles }}
{{ range . }}
{{ partial "heading.html" (dict "text" .title "level" 3) }}
{{ .description | markdownify }}
{{ end }}
{{ end }} {{/* Vector process */}} {{ with .process }}
{{/* Signals */}}
{{ partial "heading.html" (dict "text" "Signals" "level" 3 "anchor" true) }}
{{ .process_signals.description | markdownify }}
{{ range .process_signals.signals }} {{ end }}
Signal Description
{{ .name }} {{ .description | markdownify }}
{{/* Exit codes */}}
{{ partial "heading.html" (dict "text" "Exit codes" "level" 3 "anchor" true) }}
{{ .exit_codes.description | markdownify }}
{{ range .exit_codes.codes }} {{ end }}
Code Description
{{ .code }} {{ .description | markdownify }}
{{ end }} {{ with .component_permissions }}
{{ range . }} {{/* TODO: remove the need for this double loop in the CUE sources */}} {{ range . }}
Platform: {{ .platform_title }}
Relevant policies
{{ range .policies }} {{ end }}
Policy Required for Required when
{{ .action }} {{ range .required_for }}{{ . }}{{ end }} {{ .required_when | markdownify }}
{{ end }} {{ end }}
{{ end }}
{{ define "enum-options-table" }} {{ range $k, $v := . }} {{ end }}
Option Description
{{ $k }} {{ $v | markdownify }}
{{ end }} {{ define "example" }} Given this event...
{{ if or (reflect.IsMap .input) (reflect.IsSlice .input) }} {{ $event := .input | jsonify (dict "indent" " ") | safeJS }} {{ highlight $event "json" "" }} {{ else }} {{ .input | markdownify }} {{ end }}
...and this Vector configuration...
{{ if or (reflect.IsMap .configuration) (reflect.IsSlice .configuration) }} {{ $json := .configuration | jsonify (dict "indent" " ") }} {{ highlight $json "json" "" }} {{ else }} {{ highlight .configuration "toml" "" }} {{ end }}
{{ if reflect.IsSlice .output }} {{ $multiple := gt (len .output) 1 }} {{ if $multiple }} {{ $kind := "" }} {{ $event := slice }} {{ range .output }} {{ if .log }} {{ $kind = "log" }} {{ $event = $event | append .log }} {{ end }} {{ if .metric }} {{ $kind = "metric" }} {{ $event = $event | append .metric }} {{ end }} {{ end }} {{ if eq $kind "log" }} ...this Vector log event is produced: {{ end }} {{ if eq $kind "metric" }} ...this Vector metric event is produced: {{ end }} {{ $json := $event | jsonify (dict "indent" " ") }}
{{ highlight $json "json" "" }}
{{ else }} {{ $out := index .output 0 }} {{ with $out.metric }} {{ $json := . | jsonify (dict "indent" " ") }} ...this Vector metric event is produced:
{{ highlight $json "json" "" }}
{{ end }} {{ with $out.log }} {{ $json := . | jsonify (dict "indent" " ") }} ...this Vector log event is produced:
{{ highlight $json "json" "" }}
{{ end }} {{ end }} {{ end }} {{ if reflect.IsMap .output }} {{ with .output.log }} {{ $json := . | jsonify (dict "indent" " ") }} ...this Vector log event is produced:
{{ highlight $json "json" "" }}
{{ end }} {{ with .output.metric }} {{ $json := . | jsonify (dict "indent" " ") }} ...this Vector metric event is produced:
{{ highlight $json "json" "" }}
{{ end }} {{ end }} {{ end }} {{ define "config-toggler" }} {{ $size := .size | default 4 }} {{/* Heroicon: outline/chevron-down */}} {{/* Heroicon: outline/chevron-up */}} {{ end }} {{ define "default" }}
default: {{ .default }}{{ with .unit }} ({{ . }}){{ end }}
{{ end }} {{ define "vrl-function-example" }}
{{ .title }}
Source
{{ template "code" .source }}
{{ with .return }}
Return
{{ template "code" . }}
{{ end }}
{{ end }} {{ define "telemetry" }} {{ range $k, $v := . }}
{{ partial "heading.html" (dict "text" $k "level" 4) }} {{ partial "badge.html" (dict "word" $v.type "color" "gray") }} {{ with $v.description }}
{{ . | markdownify }}
{{ end }} {{ with $v.tags }}
{{ range $k, $v := . }}
{{ $k }} {{ if $v.required }} {{ partial "badge.html" (dict "word" "required" "color" "red") }} {{ else }} {{ partial "badge.html" (dict "word" "optional" "color" "blue") }} {{ end }}
{{ $v.description }}
{{ end }}
{{ end }}
{{ end }} {{ end }} {{ define "vrl-function-legend" }} {{/* Heroicon: outline/map */}}
required optional <types | ...>
{{ end }} {{ define "vrl-function-args" }} {{ range . }} {{ $color := cond .required "text-secondary dark:text-primary" "text-indigo-500 dark:text-indigo-300" }} {{ end }}
Argument Type Description
{{ .name }} {{ range .type }} {{ . }}
{{ end }}
{{ .description | markdownify }}
{{ end }} {{ define "vrl-toggler" }} {{ end }} {{ define "vrl-data-example" }}
{{ with .title }} {{ . }} {{ end }}
{{ with .input }}
Vector event
{{ template "code" . }}
{{ end }} {{ with .source }}
VRL program
{{ template "code" . }}
{{ end }} {{ with .return }}
Resulting event
{{ template "code" . }}
{{ end }}
{{ end }} {{ define "code" }} {{ if or (reflect.IsMap .) (reflect.IsSlice .) }} {{ $json := . | jsonify (dict "indent" " ") }} {{ highlight $json "json" "" }} {{ else }} {{ highlight . "ruby" "" }} {{ end }} {{ end }}