From 7c4be90f2b18d63ed50ce422efc1f5d7843cc88f Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Feb 2026 17:03:33 -0500 Subject: [PATCH 01/44] Add generation of cue files from vrl Function --- Cargo.lock | 2 + Makefile | 4 + vdev/Cargo.toml | 2 + vdev/src/commands/build/mod.rs | 2 + vdev/src/commands/build/vrl_docs.rs | 313 ++++++++++++++++++++++++++++ 5 files changed, 323 insertions(+) create mode 100644 vdev/src/commands/build/vrl_docs.rs diff --git a/Cargo.lock b/Cargo.lock index 2663ca6825f08..74aa64a93dc4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12475,6 +12475,8 @@ dependencies = [ "tempfile", "toml 0.9.8", "toml_edit 0.22.27", + "vector-vrl-functions", + "vrl", ] [[package]] diff --git a/Makefile b/Makefile index f259f6c200cca..7752482171ff1 100644 --- a/Makefile +++ b/Makefile @@ -689,6 +689,10 @@ generate-component-docs: ## Generate per-component Cue docs from the configurati ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) build component-docs /tmp/vector-config-schema.json \ $(if $(findstring true,$(CI)),>/dev/null,) +.PHONY: generate-vrl-docs +generate-vrl-docs: ## Generate VRL function documentation from Rust source. + $(VDEV) build vrl-docs + .PHONY: signoff signoff: ## Signsoff all previous commits since branch creation scripts/signoff.sh diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index ab7a68d0d713f..f85656002c787 100644 --- a/vdev/Cargo.toml +++ b/vdev/Cargo.toml @@ -45,6 +45,8 @@ semver.workspace = true indoc.workspace = true git2 = { version = "0.20.4" } cfg-if.workspace = true +vector-vrl-functions = { path = "../lib/vector-vrl/functions" } +vrl.workspace = true [package.metadata.binstall] pkg-url = "{ repo }/releases/download/vdev-v{ version }/{ name }-{ target }-v{ version }.tgz" diff --git a/vdev/src/commands/build/mod.rs b/vdev/src/commands/build/mod.rs index 48890c8682b83..f46d8a8ae210c 100644 --- a/vdev/src/commands/build/mod.rs +++ b/vdev/src/commands/build/mod.rs @@ -1,6 +1,7 @@ mod licenses; mod publish_metadata; mod vector; +mod vrl_docs; mod vrl_wasm; crate::cli_subcommands! { @@ -11,6 +12,7 @@ crate::cli_subcommands! { publish_metadata, release_cue, vector, + vrl_docs, vrl_wasm, } diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs new file mode 100644 index 0000000000000..b7b4f33d0b130 --- /dev/null +++ b/vdev/src/commands/build/vrl_docs.rs @@ -0,0 +1,313 @@ +use anyhow::Result; +use serde::Serialize; +use std::fs; +use std::path::PathBuf; +use vrl::compiler::Function; +use vrl::compiler::value::kind; + +/// Generate VRL function documentation as JSON files. +/// +/// This command iterates over all VRL functions available in Vector and generates +/// JSON documentation files that are compatible with the CUE-based documentation +/// pipeline (valid JSON is valid CUE). +#[derive(clap::Args, Debug)] +#[command()] +pub struct Cli { + /// Output directory for generated documentation files + #[arg(long, default_value = "website/cue/reference/remap/functions")] + output_dir: PathBuf, +} + +#[derive(Serialize)] +struct FunctionDocWrapper { + remap: RemapWrapper, +} + +#[derive(Serialize)] +struct RemapWrapper { + functions: std::collections::HashMap, +} + +#[derive(Serialize)] +struct FunctionDoc { + anchor: String, + name: String, + category: String, + description: String, + arguments: Vec, + r#return: ReturnDoc, + internal_failure_reasons: Vec, + #[serde(skip_serializing_if = "Vec::is_empty")] + examples: Vec, + deprecated: bool, + pure: bool, +} + +#[derive(Serialize)] +struct ArgumentDoc { + name: String, + description: String, + required: bool, + r#type: Vec, +} + +#[derive(Serialize)] +struct ReturnDoc { + types: Vec, + #[serde(skip_serializing_if = "Vec::is_empty")] + rules: Vec, +} + +#[derive(Serialize)] +struct ExampleDoc { + title: String, + source: String, + #[serde(skip_serializing_if = "Option::is_none")] + r#return: Option, + #[serde(skip_serializing_if = "Option::is_none")] + raises: Option, +} + +impl Cli { + pub fn exec(self) -> Result<()> { + let functions = vector_vrl_functions::all(); + + // Ensure output directory exists + fs::create_dir_all(&self.output_dir)?; + + for func in functions { + let doc = build_function_doc(func.as_ref()); + let filename = format!("{}.cue", doc.name); + let filepath = self.output_dir.join(&filename); + + // Wrap in the expected CUE structure + let mut functions_map = std::collections::HashMap::new(); + functions_map.insert(doc.name.clone(), doc); + let wrapper = FunctionDocWrapper { + remap: RemapWrapper { + functions: functions_map, + }, + }; + + let json = serde_json::to_string_pretty(&wrapper)?; + fs::write(&filepath, json)?; + + println!("Generated: {}", filepath.display()); + } + + println!("\nVRL documentation generation complete."); + Ok(()) + } +} + +fn build_function_doc(func: &dyn Function) -> FunctionDoc { + let name = func.identifier().to_string(); + let category = infer_category(&name); + + let arguments: Vec = func + .parameters() + .iter() + .map(|param| ArgumentDoc { + name: param.keyword.to_string(), + description: param.description.to_string(), + required: param.required, + r#type: kind_to_types(param.kind), + }) + .collect(); + + let examples: Vec = func + .examples() + .iter() + .map(|example| { + let (return_value, raises) = match &example.result { + Ok(result) => { + // Try to parse as JSON, otherwise treat as string + let value = serde_json::from_str(result) + .unwrap_or_else(|_| serde_json::Value::String(result.to_string())); + (Some(value), None) + } + Err(error) => (None, Some(error.to_string())), + }; + ExampleDoc { + title: example.title.to_string(), + source: example.source.to_string(), + r#return: return_value, + raises, + } + }) + .collect(); + + FunctionDoc { + anchor: name.clone(), + name, + category: category.to_string(), + description: func.usage().to_string(), + arguments, + r#return: ReturnDoc { + types: vec!["any".to_string()], // Stub - could derive from TypeDef later + rules: vec![], + }, + internal_failure_reasons: vec![], // Stub + examples, + deprecated: false, // Stub + pure: true, // Stub - default true + } +} + +fn kind_to_types(kind_bits: u16) -> Vec { + let mut types = Vec::new(); + + if (kind_bits & kind::BYTES) == kind::BYTES { + types.push("string".to_string()); + } + if (kind_bits & kind::INTEGER) == kind::INTEGER { + types.push("integer".to_string()); + } + if (kind_bits & kind::FLOAT) == kind::FLOAT { + types.push("float".to_string()); + } + if (kind_bits & kind::BOOLEAN) == kind::BOOLEAN { + types.push("boolean".to_string()); + } + if (kind_bits & kind::OBJECT) == kind::OBJECT { + types.push("object".to_string()); + } + if (kind_bits & kind::ARRAY) == kind::ARRAY { + types.push("array".to_string()); + } + if (kind_bits & kind::TIMESTAMP) == kind::TIMESTAMP { + types.push("timestamp".to_string()); + } + if (kind_bits & kind::REGEX) == kind::REGEX { + types.push("regex".to_string()); + } + if (kind_bits & kind::NULL) == kind::NULL { + types.push("null".to_string()); + } + + if types.is_empty() { + types.push("any".to_string()); + } + + types +} + +fn infer_category(name: &str) -> &'static str { + match name { + // Exact matches first (before patterns that might match them) + + // Debug functions (log is a debug function, not number) + "log" | "assert" | "assert_eq" | "abort" => "Debug", + + // Timestamp - exact matches before patterns + "now" | "from_unix_timestamp" | "format_timestamp" => "Timestamp", + + // Cryptography - exact matches + "encrypt" | "decrypt" | "md5" => "Cryptography", + + // String functions - exact matches (including case conversion variants) + "upcase" | "downcase" | "camelcase" | "snakecase" | "kebabcase" => "String", + "screaming_snakecase" | "screamingsnakecase" | "pascalcase" => "String", + "capitalize" | "strip_whitespace" | "truncate" | "trim" => "String", + "strip_ansi_escape_codes" | "starts_with" | "ends_with" | "contains" | "contains_all" => { + "String" + } + "slice" | "split" | "join" | "replace" | "replace_with" => "String", + "redact" | "find" | "substring" | "strlen" | "sieve" => "String", + "match_datadog_query" => "String", + + // Array functions - exact matches (reverse is Array, not String) + "append" | "push" | "pop" | "shift" | "unshift" => "Array", + "flatten" | "chunks" | "unique" | "includes" | "reverse" => "Array", + "tally" | "tally_value" | "unnest" => "Array", + + // Object functions + "keys" | "values" | "object" | "merge" | "compact" => "Object", + "remove" | "set" | "get" => "Object", + "object_from_array" | "unflatten" => "Object", + + // Number functions + "abs" | "ceil" | "floor" | "round" | "mod" => "Number", + "int" | "float" | "haversine" => "Number", + "format_int" | "format_number" => "Number", + + // System functions + "get_env_var" | "get_hostname" | "get_timezone_name" => "System", + "http_request" => "System", + + // Secret/Event functions + "get_secret" | "set_secret" | "remove_secret" => "Event", + + // Enumerate functions + "for_each" | "filter" | "map_keys" | "map_values" => "Enumerate", + + // Checksum functions + "crc" | "seahash" | "xxhash" => "Checksum", + + // Coerce by name + "bool" | "string" | "array" => "Coerce", + + // Path functions + "exists" | "path_matches" | "length" => "Path", + "basename" | "dirname" | "split_path" => "Path", + + // Convert functions + "type_def" | "typeof" | "set_semantic_meaning" => "Convert", + "tag_types_externally" => "Convert", + + // IP functions + "community_id" | "dns_lookup" | "reverse_dns" => "IP", + + // Random/UUID functions + "uuid_from_friendly_id" => "Random", + + // Type/validation functions + "validate_json_schema" => "Type", + + // Now the pattern matches + + // Parse functions + n if n.starts_with("parse_") => "Parse", + + // Codec functions + n if n.starts_with("encode_") => "Codec", + n if n.starts_with("decode_") => "Codec", + + // Type checking functions + n if n.starts_with("is_") => "Type", + + // Coerce functions + n if n.starts_with("to_") => "Coerce", + + // IP functions + n if n.contains("ip") || n.contains("cidr") => "IP", + + // Timestamp functions + n if n.contains("timestamp") => "Timestamp", + + // Cryptography functions + n if n.starts_with("sha") || n.contains("hmac") => "Cryptography", + + // String matching functions + n if n.starts_with("match") => "String", + + // Object functions with del prefix + n if n.starts_with("del") => "Object", + + // Enrichment functions + n if n.starts_with("get_enrichment_table_record") + || n.starts_with("find_enrichment_table") => + { + "Enrichment" + } + + // Random functions + n if n.starts_with("random") || n.starts_with("uuid") => "Random", + + // Metrics + n if n.contains("metric") => "Metrics", + + // Default to String as a reasonable fallback (most new functions are string manipulation) + _ => "String", + } +} From d028ae8e4b2916990abc2eb41eb1bef4a9c9b616 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Feb 2026 17:04:22 -0500 Subject: [PATCH 02/44] Use __mock_return_values_for_tests to show mocked examples --- vdev/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index f85656002c787..09394566b6039 100644 --- a/vdev/Cargo.toml +++ b/vdev/Cargo.toml @@ -46,7 +46,8 @@ indoc.workspace = true git2 = { version = "0.20.4" } cfg-if.workspace = true vector-vrl-functions = { path = "../lib/vector-vrl/functions" } -vrl.workspace = true +# Only here for docs generation. Using vrl with this feature enabled will be severely broken +vrl = { workspace = true, features = ["__mock_return_values_for_tests"] } [package.metadata.binstall] pkg-url = "{ repo }/releases/download/vdev-v{ version }/{ name }-{ target }-v{ version }.tgz" From 73d958573ef5d41d0b069bbfb635fbbcf61a04c7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Feb 2026 19:40:53 -0500 Subject: [PATCH 03/44] Handle kind::any --- vdev/src/commands/build/vrl_docs.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index b7b4f33d0b130..78422ebd799d3 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -155,6 +155,11 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { } fn kind_to_types(kind_bits: u16) -> Vec { + // All type bits combined + if (kind_bits & kind::ANY) == kind::ANY { + return vec!["any".to_string()]; + } + let mut types = Vec::new(); if (kind_bits & kind::BYTES) == kind::BYTES { @@ -185,9 +190,7 @@ fn kind_to_types(kind_bits: u16) -> Vec { types.push("null".to_string()); } - if types.is_empty() { - types.push("any".to_string()); - } + assert!(!types.is_empty(), "kind_bits {kind_bits} produced no types"); types } From ea36b23e9eb8b0056cfb106ed29ac07d07cae23e Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 5 Feb 2026 19:57:57 -0500 Subject: [PATCH 04/44] Replace generate-component-docs with generate-docs --- .github/workflows/changes.yml | 3 ++- .github/workflows/test.yml | 8 ++++---- CONTRIBUTING.md | 4 ++-- Makefile | 14 +++++++++----- docs/DEVELOPING.md | 6 +++--- docs/DOCUMENTING.md | 2 +- .../check/{component_docs.rs => generated_docs.rs} | 7 +++++-- vdev/src/commands/check/mod.rs | 4 ++-- 8 files changed, 28 insertions(+), 20 deletions(-) rename vdev/src/commands/check/{component_docs.rs => generated_docs.rs} (76%) diff --git a/.github/workflows/changes.yml b/.github/workflows/changes.yml index 49e9fd19ebe6d..1d75e370def02 100644 --- a/.github/workflows/changes.yml +++ b/.github/workflows/changes.yml @@ -225,7 +225,8 @@ jobs: component_docs: - 'scripts/generate-component-docs.rb' - "vdev/**" - - 'website/cue/**/base/**.cue' + - 'website/cue/**/generated/**.cue' + - 'website/cue/**/functions/*.cue' - ".github/workflows/changes.yml" markdown: - '**/**.md' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 114321ae28242..a0437acecace8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -146,8 +146,8 @@ jobs: markdownlint: true - run: make check-markdown - check-component-docs: - name: Check Component Docs + check-generated-docs: + name: Check Generated Docs runs-on: ubuntu-24.04-8core if: ${{ needs.changes.outputs.source == 'true' || needs.changes.outputs.component_docs == 'true' || needs.changes.outputs.test-yml == 'true' }} needs: changes @@ -159,7 +159,7 @@ jobs: protoc: true cue: true libsasl2: true - - run: make check-component-docs + - run: make check-generated-docs check-rust-docs: name: Check Rust Docs @@ -217,7 +217,7 @@ jobs: - check-licenses - check-docs - check-markdown - - check-component-docs + - check-generated-docs - check-rust-docs - test-vrl - build-vrl-playground diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93868085dc574..a9bb9d1f6758a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -141,7 +141,7 @@ echo "Running pre-push checks..." make check-licenses make check-fmt make check-clippy -make check-component-docs +make check-generated-docs # Some other checks that in our experience rarely fail on PRs. make check-deny @@ -292,7 +292,7 @@ cargo vdev check events cargo vdev check licenses # Vector's documentation for each component is generated from the comments attached to the Component structs and members. # Running this ensures that the generated docs are up to date. -make check-component-docs +make check-generated-docs # Generate the code documentation for the Vector project. # Run this to ensure the docs can be generated without errors (warnings are acceptable at the minute). cd rust-doc && make docs diff --git a/Makefile b/Makefile index 7752482171ff1..d663a9ff1742f 100644 --- a/Makefile +++ b/Makefile @@ -468,7 +468,7 @@ check: ## Run prerequisite code checks check-all: ## Check everything check-all: check-fmt check-clippy check-docs check-all: check-examples check-component-features -check-all: check-scripts check-deny check-component-docs check-licenses +check-all: check-scripts check-deny check-generated-docs check-licenses .PHONY: check-component-features check-component-features: ## Check that all component features are setup properly @@ -510,9 +510,9 @@ check-deny: ## Check advisories licenses and sources for crate dependencies check-events: ## Check that events satisfy patterns set in https://github.com/vectordotdev/vector/blob/master/rfcs/2020-03-17-2064-event-driven-observability.md ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check events -.PHONY: check-component-docs -check-component-docs: generate-component-docs ## Checks that the machine-generated component Cue docs are up-to-date. - ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check component-docs +.PHONY: check-generated-docs +check-generated-docs: generate-docs ## Checks that the machine-generated component Cue docs are up-to-date. + ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check generated-docs ##@ Rustdoc build-rustdoc: ## Build Vector's Rustdocs @@ -691,7 +691,11 @@ generate-component-docs: ## Generate per-component Cue docs from the configurati .PHONY: generate-vrl-docs generate-vrl-docs: ## Generate VRL function documentation from Rust source. - $(VDEV) build vrl-docs + ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) build vrl-docs \ + $(if $(findstring true,$(CI)),>/dev/null,) + +.PHONY: generate-docs +generate-docs: generate-component-docs generate-vrl-docs .PHONY: signoff signoff: ## Signsoff all previous commits since branch creation diff --git a/docs/DEVELOPING.md b/docs/DEVELOPING.md index f32965244c28f..628803963dabb 100644 --- a/docs/DEVELOPING.md +++ b/docs/DEVELOPING.md @@ -127,7 +127,7 @@ Loosely, you'll need the following: - **To run integration tests:** Have `docker` available, or a real live version of that service. (Use `AUTOSPAWN=false`) - **To run `make check-component-features`:** Have `remarshal` installed. - **To run `make check-licenses` or `make build-licenses`:** Have `dd-rust-license-tool` [installed](https://github.com/DataDog/rust-license-tool). -- **To run `make generate-component-docs`:** Have `cue` [installed](https://cuelang.org/docs/install/). +- **To run `make generate-docs`:** Have `cue` [installed](https://cuelang.org/docs/install/). If you find yourself needing to run something inside the Docker environment described above, that's totally fine, they won't collide or hurt each other. In this case, you'd just run `make environment-generate`. @@ -161,8 +161,8 @@ cargo bench transforms::example # Format your code before pushing! make fmt cargo fmt -# Build component documentation for the website -make generate-component-docs +# Build component and VRL documentation for the website +make generate-docs ``` If you run `make` you'll see a full list of all our tasks. Some of these will start Docker containers, sign commits, or even make releases. These are not common development commands and your mileage may vary. diff --git a/docs/DOCUMENTING.md b/docs/DOCUMENTING.md index a0529de37a8a9..ccbcfbc0f0a45 100644 --- a/docs/DOCUMENTING.md +++ b/docs/DOCUMENTING.md @@ -61,7 +61,7 @@ Much of Vector's reference documentation is automatically compiled from source c To regenerate this content, run: ```bash -make generate-component-docs +make generate-docs ``` ### Formatting diff --git a/vdev/src/commands/check/component_docs.rs b/vdev/src/commands/check/generated_docs.rs similarity index 76% rename from vdev/src/commands/check/component_docs.rs rename to vdev/src/commands/check/generated_docs.rs index 85a8ab280b1d8..62406951e3cde 100644 --- a/vdev/src/commands/check/component_docs.rs +++ b/vdev/src/commands/check/generated_docs.rs @@ -12,7 +12,10 @@ impl Cli { let dirty_component_files: Vec = files .into_iter() .filter(|file| file.starts_with("website/cue/reference")) - .filter(|file| file.contains("generated/")) + .filter(|file| { + file.contains("generated/") + || file.starts_with("website/cue/reference/remap/functions/") + }) .collect(); // If it is not empty, there are out-of-sync component Cue files in the current branch. @@ -22,7 +25,7 @@ impl Cli { println!(" - {file}"); } println!( - "Run `make generate-component-docs` locally to update your branch and commit/push the changes." + "Run `make generate-docs` locally to update your branch and commit/push the changes." ); std::process::exit(1); } diff --git a/vdev/src/commands/check/mod.rs b/vdev/src/commands/check/mod.rs index 4d61a76dbf3c2..44a2242cc35b3 100644 --- a/vdev/src/commands/check/mod.rs +++ b/vdev/src/commands/check/mod.rs @@ -1,8 +1,8 @@ -mod component_docs; mod component_features; mod deny; mod examples; mod fmt; +mod generated_docs; mod licenses; mod markdown; mod rust; @@ -10,7 +10,7 @@ mod scripts; crate::cli_subcommands! { "Check parts of the Vector code base..." - component_docs, + generated_docs, component_features, deny, docs, From 58fa9ab8d87fa816dd707bb3256478dbd5f4fe3c Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 7 Feb 2026 10:02:55 -0500 Subject: [PATCH 05/44] Bump VRL --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5e7342ae748c..71a8ce3ed1d57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13096,7 +13096,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#6d4e44ee26eb92578bae81d07868e5211ee4184f" +source = "git+https://github.com/vectordotdev/vrl.git?branch=function-return#d75e3718e1bb108ec834168a2e621e709e036d74" dependencies = [ "aes", "aes-siv", diff --git a/Cargo.toml b/Cargo.toml index afbc2e3a0f90e..989cf40f4ac06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,7 +208,7 @@ vector-config-macros = { path = "lib/vector-config-macros" } vector-common-macros = { path = "lib/vector-common-macros" } vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] } vector-vrl-functions = { path = "lib/vector-vrl/functions" } -vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "main", features = ["arbitrary", "cli", "test", "test_framework"] } +vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "function-return", features = ["arbitrary", "cli", "test", "test_framework"] } mock_instant = { version = "0.6" } serial_test = { version = "3.2" } From 4f02f21001825897ffdd311a538a041de87406f7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 7 Feb 2026 10:03:44 -0500 Subject: [PATCH 06/44] chore(vrl): Bump vrl and add return_kind to functions --- lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs | 4 ++++ lib/enrichment/src/find_enrichment_table_records.rs | 4 ++++ lib/enrichment/src/get_enrichment_table_record.rs | 4 ++++ lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs | 4 ++++ lib/vector-vrl-metrics/src/find_vector_metrics.rs | 4 ++++ lib/vector-vrl-metrics/src/get_vector_metric.rs | 4 ++++ lib/vector-vrl/functions/src/get_secret.rs | 4 ++++ lib/vector-vrl/functions/src/remove_secret.rs | 4 ++++ lib/vector-vrl/functions/src/set_secret.rs | 4 ++++ lib/vector-vrl/functions/src/set_semantic_meaning.rs | 4 ++++ 10 files changed, 40 insertions(+) diff --git a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs index 209e8c62b2ffb..435d9b3f97e18 100644 --- a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs +++ b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs @@ -47,6 +47,10 @@ impl Function for ParseDnstap { ] } + fn return_kind(&self) -> u16 { + kind::OBJECT + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/enrichment/src/find_enrichment_table_records.rs b/lib/enrichment/src/find_enrichment_table_records.rs index d58f7e9e26131..e90afe65841d6 100644 --- a/lib/enrichment/src/find_enrichment_table_records.rs +++ b/lib/enrichment/src/find_enrichment_table_records.rs @@ -98,6 +98,10 @@ impl Function for FindEnrichmentTableRecords { ) } + fn return_kind(&self) -> u16 { + kind::ARRAY + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/enrichment/src/get_enrichment_table_record.rs b/lib/enrichment/src/get_enrichment_table_record.rs index e71855acb9308..0b683e24d0d37 100644 --- a/lib/enrichment/src/get_enrichment_table_record.rs +++ b/lib/enrichment/src/get_enrichment_table_record.rs @@ -103,6 +103,10 @@ impl Function for GetEnrichmentTableRecord { ] } + fn return_kind(&self) -> u16 { + kind::OBJECT + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs index 99ad1b1b71c84..ea2f9ca0fe485 100644 --- a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs @@ -82,6 +82,10 @@ impl Function for AggregateVectorMetrics { ) } + fn return_kind(&self) -> u16 { + kind::FLOAT | kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/vector-vrl-metrics/src/find_vector_metrics.rs b/lib/vector-vrl-metrics/src/find_vector_metrics.rs index 5096536c2cbf4..0473d3157e2ca 100644 --- a/lib/vector-vrl-metrics/src/find_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/find_vector_metrics.rs @@ -58,6 +58,10 @@ impl Function for FindVectorMetrics { ) } + fn return_kind(&self) -> u16 { + kind::ARRAY + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/vector-vrl-metrics/src/get_vector_metric.rs b/lib/vector-vrl-metrics/src/get_vector_metric.rs index 614cd226516ab..bbb5b3a1de896 100644 --- a/lib/vector-vrl-metrics/src/get_vector_metric.rs +++ b/lib/vector-vrl-metrics/src/get_vector_metric.rs @@ -55,6 +55,10 @@ impl Function for GetVectorMetric { ) } + fn return_kind(&self) -> u16 { + kind::OBJECT | kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &PARAMETERS } diff --git a/lib/vector-vrl/functions/src/get_secret.rs b/lib/vector-vrl/functions/src/get_secret.rs index 38c1745788ec7..3e65a4b325ede 100644 --- a/lib/vector-vrl/functions/src/get_secret.rs +++ b/lib/vector-vrl/functions/src/get_secret.rs @@ -21,6 +21,10 @@ impl Function for GetSecret { "Returns the value of the given secret from an event." } + fn return_kind(&self) -> u16 { + kind::BYTES | kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &[Parameter { keyword: "key", diff --git a/lib/vector-vrl/functions/src/remove_secret.rs b/lib/vector-vrl/functions/src/remove_secret.rs index 6daab4e1b193a..95b16ecd64fd9 100644 --- a/lib/vector-vrl/functions/src/remove_secret.rs +++ b/lib/vector-vrl/functions/src/remove_secret.rs @@ -18,6 +18,10 @@ impl Function for RemoveSecret { "Removes a secret from an event." } + fn return_kind(&self) -> u16 { + kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &[Parameter { keyword: "key", diff --git a/lib/vector-vrl/functions/src/set_secret.rs b/lib/vector-vrl/functions/src/set_secret.rs index 652a0e5d4dc55..39739012ace15 100644 --- a/lib/vector-vrl/functions/src/set_secret.rs +++ b/lib/vector-vrl/functions/src/set_secret.rs @@ -25,6 +25,10 @@ impl Function for SetSecret { "Sets the given secret in the event." } + fn return_kind(&self) -> u16 { + kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &[ Parameter { diff --git a/lib/vector-vrl/functions/src/set_semantic_meaning.rs b/lib/vector-vrl/functions/src/set_semantic_meaning.rs index 8b9057987a585..08d33c2d93342 100644 --- a/lib/vector-vrl/functions/src/set_semantic_meaning.rs +++ b/lib/vector-vrl/functions/src/set_semantic_meaning.rs @@ -46,6 +46,10 @@ impl Function for SetSemanticMeaning { "} } + fn return_kind(&self) -> u16 { + kind::NULL + } + fn parameters(&self) -> &'static [Parameter] { &[ Parameter { From 4cc7bb4fea6a585911feb2060d2a478c6cd87a11 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 8 Feb 2026 11:20:34 -0500 Subject: [PATCH 07/44] Enable all features for vector-vrl-functions --- vdev/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index 09394566b6039..38ed6c30ecd35 100644 --- a/vdev/Cargo.toml +++ b/vdev/Cargo.toml @@ -45,7 +45,7 @@ semver.workspace = true indoc.workspace = true git2 = { version = "0.20.4" } cfg-if.workspace = true -vector-vrl-functions = { path = "../lib/vector-vrl/functions" } +vector-vrl-functions = { path = "../lib/vector-vrl/functions", features = ["dnstap", "vrl-metrics"] } # Only here for docs generation. Using vrl with this feature enabled will be severely broken vrl = { workspace = true, features = ["__mock_return_values_for_tests"] } From a571dacd158c57bfbabe7534002e435220e1c1d4 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 8 Feb 2026 11:21:19 -0500 Subject: [PATCH 08/44] Add stubs and implement new params --- vdev/src/commands/build/vrl_docs.rs | 49 ++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 78422ebd799d3..176d305331762 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -4,6 +4,7 @@ use std::fs; use std::path::PathBuf; use vrl::compiler::Function; use vrl::compiler::value::kind; +use vrl::core::Value; /// Generate VRL function documentation as JSON files. /// @@ -36,10 +37,12 @@ struct FunctionDoc { description: String, arguments: Vec, r#return: ReturnDoc, - internal_failure_reasons: Vec, + #[serde(skip_serializing_if = "<[_]>::is_empty")] + internal_failure_reasons: &'static [&'static str], #[serde(skip_serializing_if = "Vec::is_empty")] examples: Vec, - deprecated: bool, + #[serde(skip_serializing_if = "Vec::is_empty")] + notices: Vec, pure: bool, } @@ -49,13 +52,15 @@ struct ArgumentDoc { description: String, required: bool, r#type: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + default: Option, } #[derive(Serialize)] struct ReturnDoc { types: Vec, - #[serde(skip_serializing_if = "Vec::is_empty")] - rules: Vec, + #[serde(skip_serializing_if = "<[_]>::is_empty")] + rules: &'static [&'static str], } #[derive(Serialize)] @@ -108,10 +113,11 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { .parameters() .iter() .map(|param| ArgumentDoc { - name: param.keyword.to_string(), - description: param.description.to_string(), + name: param.keyword.trim().to_string(), + description: param.description.trim().to_string(), required: param.required, r#type: kind_to_types(param.kind), + default: param.default.map(pretty_value), }) .collect(); @@ -119,7 +125,7 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { .examples() .iter() .map(|example| { - let (return_value, raises) = match &example.result { + let (r#return, raises) = match &example.result { Ok(result) => { // Try to parse as JSON, otherwise treat as string let value = serde_json::from_str(result) @@ -128,10 +134,13 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { } Err(error) => (None, Some(error.to_string())), }; + + let source = example.source.to_string(); + let title = example.title.to_string(); ExampleDoc { - title: example.title.to_string(), - source: example.source.to_string(), - r#return: return_value, + title, + source, + r#return, raises, } }) @@ -144,13 +153,13 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { description: func.usage().to_string(), arguments, r#return: ReturnDoc { - types: vec!["any".to_string()], // Stub - could derive from TypeDef later - rules: vec![], + types: kind_to_types(func.return_kind()), + rules: func.return_rules(), }, - internal_failure_reasons: vec![], // Stub + internal_failure_reasons: func.internal_failure_reasons(), examples, - deprecated: false, // Stub - pure: true, // Stub - default true + notices: vec![], // Stub + pure: true, // Stub - default true } } @@ -195,6 +204,16 @@ fn kind_to_types(kind_bits: u16) -> Vec { types } +fn pretty_value(v: &Value) -> String { + if let Value::Bytes(b) = v { + str::from_utf8(&b) + .map(String::from) + .unwrap_or_else(|_| v.to_string()) + } else { + v.to_string() + } +} + fn infer_category(name: &str) -> &'static str { match name { // Exact matches first (before patterns that might match them) From ad740b0a5bd339b11bec6c300866e9059dd1bc65 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 9 Feb 2026 13:08:49 -0500 Subject: [PATCH 09/44] Bump vrl and unstub pure --- Cargo.lock | 2 +- Cargo.toml | 2 +- vdev/src/commands/build/vrl_docs.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e09f015ad8e03..f25a22d80d3b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13098,7 +13098,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=function-return#d75e3718e1bb108ec834168a2e621e709e036d74" +source = "git+https://github.com/vectordotdev/vrl.git?branch=function-pure#b42c0d25b20614ee53b21a4a2327561ed879d836" dependencies = [ "aes", "aes-siv", diff --git a/Cargo.toml b/Cargo.toml index 989cf40f4ac06..465a8ee5487e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,7 +208,7 @@ vector-config-macros = { path = "lib/vector-config-macros" } vector-common-macros = { path = "lib/vector-common-macros" } vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] } vector-vrl-functions = { path = "lib/vector-vrl/functions" } -vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "function-return", features = ["arbitrary", "cli", "test", "test_framework"] } +vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "function-pure", features = ["arbitrary", "cli", "test", "test_framework"] } mock_instant = { version = "0.6" } serial_test = { version = "3.2" } diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 176d305331762..c328952196b07 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -159,7 +159,7 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { internal_failure_reasons: func.internal_failure_reasons(), examples, notices: vec![], // Stub - pure: true, // Stub - default true + pure: func.pure(), } } From f6431aed4ce25bd3cfc47a0a906838ea64d648d0 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 9 Feb 2026 13:40:33 -0500 Subject: [PATCH 10/44] Bump vrl and unstub notices --- Cargo.lock | 2 +- Cargo.toml | 2 +- vdev/src/commands/build/vrl_docs.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f25a22d80d3b7..ed05fce5dce9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13098,7 +13098,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=function-pure#b42c0d25b20614ee53b21a4a2327561ed879d836" +source = "git+https://github.com/vectordotdev/vrl.git?branch=function-notices#e8e0881624566354b9905b109f201cab0f78743f" dependencies = [ "aes", "aes-siv", diff --git a/Cargo.toml b/Cargo.toml index 465a8ee5487e7..1cc065edd1667 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,7 +208,7 @@ vector-config-macros = { path = "lib/vector-config-macros" } vector-common-macros = { path = "lib/vector-common-macros" } vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] } vector-vrl-functions = { path = "lib/vector-vrl/functions" } -vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "function-pure", features = ["arbitrary", "cli", "test", "test_framework"] } +vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "function-notices", features = ["arbitrary", "cli", "test", "test_framework"] } mock_instant = { version = "0.6" } serial_test = { version = "3.2" } diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index c328952196b07..b4678ca156b29 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -41,8 +41,8 @@ struct FunctionDoc { internal_failure_reasons: &'static [&'static str], #[serde(skip_serializing_if = "Vec::is_empty")] examples: Vec, - #[serde(skip_serializing_if = "Vec::is_empty")] - notices: Vec, + #[serde(skip_serializing_if = "<[_]>::is_empty")] + notices: &'static [&'static str], pure: bool, } @@ -158,7 +158,7 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { }, internal_failure_reasons: func.internal_failure_reasons(), examples, - notices: vec![], // Stub + notices: func.notices(), pure: func.pure(), } } From 8c42a0a4b9a7bfb317e1a9e52b69c5d21b22183f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 9 Feb 2026 13:40:56 -0500 Subject: [PATCH 11/44] Trim strings --- vdev/src/commands/build/vrl_docs.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index b4678ca156b29..00203d5ab3f2d 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -37,12 +37,12 @@ struct FunctionDoc { description: String, arguments: Vec, r#return: ReturnDoc, - #[serde(skip_serializing_if = "<[_]>::is_empty")] - internal_failure_reasons: &'static [&'static str], + #[serde(skip_serializing_if = "Vec::is_empty")] + internal_failure_reasons: Vec, #[serde(skip_serializing_if = "Vec::is_empty")] examples: Vec, - #[serde(skip_serializing_if = "<[_]>::is_empty")] - notices: &'static [&'static str], + #[serde(skip_serializing_if = "Vec::is_empty")] + notices: Vec, pure: bool, } @@ -59,8 +59,8 @@ struct ArgumentDoc { #[derive(Serialize)] struct ReturnDoc { types: Vec, - #[serde(skip_serializing_if = "<[_]>::is_empty")] - rules: &'static [&'static str], + #[serde(skip_serializing_if = "Vec::is_empty")] + rules: Vec, } #[derive(Serialize)] @@ -150,15 +150,15 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { anchor: name.clone(), name, category: category.to_string(), - description: func.usage().to_string(), + description: trim_str(func.usage()), arguments, r#return: ReturnDoc { types: kind_to_types(func.return_kind()), - rules: func.return_rules(), + rules: trim_slice(func.return_rules()), }, - internal_failure_reasons: func.internal_failure_reasons(), + internal_failure_reasons: trim_slice(func.internal_failure_reasons()), examples, - notices: func.notices(), + notices: trim_slice(func.notices()), pure: func.pure(), } } @@ -214,6 +214,14 @@ fn pretty_value(v: &Value) -> String { } } +fn trim_str(s: &'static str) -> String { + s.trim().to_string() +} + +fn trim_slice(slice: &'static [&'static str]) -> Vec { + slice.iter().map(|s| s.trim().to_string()).collect() +} + fn infer_category(name: &str) -> &'static str { match name { // Exact matches first (before patterns that might match them) From b5553de07b279ea4e13202d01c38afc439e2114d Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 12 Feb 2026 16:40:03 -0500 Subject: [PATCH 12/44] chore(vrl): Bump VRL and implement category for functions --- Cargo.lock | 14 +++++++++++++- Cargo.toml | 2 ++ .../src/vrl_functions/parse_dnstap.rs | 4 ++++ lib/enrichment/Cargo.toml | 1 + .../src/find_enrichment_table_records.rs | 5 +++++ .../src/get_enrichment_table_record.rs | 5 +++++ lib/vector-vrl-metrics/Cargo.toml | 1 + .../src/aggregate_vector_metrics.rs | 5 +++++ .../src/find_vector_metrics.rs | 5 +++++ lib/vector-vrl-metrics/src/get_vector_metric.rs | 5 +++++ lib/vector-vrl/category/Cargo.toml | 10 ++++++++++ lib/vector-vrl/category/src/lib.rs | 16 ++++++++++++++++ lib/vector-vrl/functions/Cargo.toml | 1 + lib/vector-vrl/functions/src/get_secret.rs | 5 +++++ lib/vector-vrl/functions/src/remove_secret.rs | 5 +++++ lib/vector-vrl/functions/src/set_secret.rs | 5 +++++ .../functions/src/set_semantic_meaning.rs | 5 +++++ 17 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 lib/vector-vrl/category/Cargo.toml create mode 100644 lib/vector-vrl/category/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 199e25318b361..493020d750e74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3738,6 +3738,7 @@ dependencies = [ "const-str", "dyn-clone", "indoc", + "vector-vrl-category", "vrl", ] @@ -13016,6 +13017,13 @@ dependencies = [ "vector-common", ] +[[package]] +name = "vector-vrl-category" +version = "0.1.0" +dependencies = [ + "strum 0.27.2", +] + [[package]] name = "vector-vrl-cli" version = "0.1.0" @@ -13032,6 +13040,7 @@ dependencies = [ "dnstap-parser", "enrichment", "indoc", + "vector-vrl-category", "vector-vrl-metrics", "vrl", ] @@ -13046,6 +13055,7 @@ dependencies = [ "tokio-stream", "vector-common", "vector-core", + "vector-vrl-category", "vrl", ] @@ -13097,7 +13107,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#8308bf70e0a524503a4f7388e090d0538b243440" +source = "git+https://github.com/vectordotdev/vrl.git?branch=main#7830c051501a08a328c53033364af55fd898aa86" dependencies = [ "aes", "aes-siv", @@ -13189,6 +13199,8 @@ dependencies = [ "snafu 0.8.9", "snap", "strip-ansi-escapes", + "strum 0.26.3", + "strum_macros 0.26.4", "syslog_loose 0.22.0", "termcolor", "thiserror 2.0.17", diff --git a/Cargo.toml b/Cargo.toml index 1fae713b0035a..ee8a3d55b1b96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,6 +128,7 @@ members = [ "lib/vector-stream", "lib/vector-tap", "lib/vector-top", + "lib/vector-vrl/category", "lib/vector-vrl/cli", "lib/vector-vrl/functions", "lib/vector-vrl/tests", @@ -207,6 +208,7 @@ vector-config-common = { path = "lib/vector-config-common" } vector-config-macros = { path = "lib/vector-config-macros" } vector-common-macros = { path = "lib/vector-common-macros" } vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] } +vector-vrl-category = { path = "lib/vector-vrl/category" } vector-vrl-functions = { path = "lib/vector-vrl/functions" } vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "main", features = ["arbitrary", "cli", "test", "test_framework"] } mock_instant = { version = "0.6" } diff --git a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs index 435d9b3f97e18..0d92e5835bc9b 100644 --- a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs +++ b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs @@ -47,6 +47,10 @@ impl Function for ParseDnstap { ] } + fn category(&self) -> &'static str { + Category::Parse.as_ref() + } + fn return_kind(&self) -> u16 { kind::OBJECT } diff --git a/lib/enrichment/Cargo.toml b/lib/enrichment/Cargo.toml index 1d2a67a2c26b6..151d329d15863 100644 --- a/lib/enrichment/Cargo.toml +++ b/lib/enrichment/Cargo.toml @@ -12,3 +12,4 @@ const-str.workspace = true dyn-clone = { version = "1.0.20", default-features = false } indoc.workspace = true vrl.workspace = true +vector-vrl-category.workspace = true diff --git a/lib/enrichment/src/find_enrichment_table_records.rs b/lib/enrichment/src/find_enrichment_table_records.rs index e90afe65841d6..32a3cf949384e 100644 --- a/lib/enrichment/src/find_enrichment_table_records.rs +++ b/lib/enrichment/src/find_enrichment_table_records.rs @@ -1,5 +1,6 @@ use std::{collections::BTreeMap, sync::LazyLock}; +use vector_vrl_category::Category; use vrl::prelude::*; use crate::{ @@ -98,6 +99,10 @@ impl Function for FindEnrichmentTableRecords { ) } + fn category(&self) -> &'static str { + Category::Enrichment.as_ref() + } + fn return_kind(&self) -> u16 { kind::ARRAY } diff --git a/lib/enrichment/src/get_enrichment_table_record.rs b/lib/enrichment/src/get_enrichment_table_record.rs index 0b683e24d0d37..c8e92c3e7823e 100644 --- a/lib/enrichment/src/get_enrichment_table_record.rs +++ b/lib/enrichment/src/get_enrichment_table_record.rs @@ -1,5 +1,6 @@ use std::{collections::BTreeMap, sync::LazyLock}; +use vector_vrl_category::Category; use vrl::prelude::*; use crate::{ @@ -103,6 +104,10 @@ impl Function for GetEnrichmentTableRecord { ] } + fn category(&self) -> &'static str { + Category::Enrichment.as_ref() + } + fn return_kind(&self) -> u16 { kind::OBJECT } diff --git a/lib/vector-vrl-metrics/Cargo.toml b/lib/vector-vrl-metrics/Cargo.toml index 6998448b68f40..6f6a30b66c364 100644 --- a/lib/vector-vrl-metrics/Cargo.toml +++ b/lib/vector-vrl-metrics/Cargo.toml @@ -14,3 +14,4 @@ vector-core = { path = "../vector-core", default-features = false, features = [" vector-common = { path = "../vector-common", default-features = false } tokio.workspace = true tokio-stream.workspace = true +vector-vrl-category.workspace = true diff --git a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs index ea2f9ca0fe485..949b2c8316b91 100644 --- a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs @@ -1,5 +1,6 @@ use std::collections::BTreeMap; use std::sync::LazyLock; +use vector_vrl_category::Category; use vrl::prelude::expression::Expr; use vrl::value; @@ -82,6 +83,10 @@ impl Function for AggregateVectorMetrics { ) } + fn category(&self) -> &'static str { + Category::Metrics.as_ref() + } + fn return_kind(&self) -> u16 { kind::FLOAT | kind::NULL } diff --git a/lib/vector-vrl-metrics/src/find_vector_metrics.rs b/lib/vector-vrl-metrics/src/find_vector_metrics.rs index 0473d3157e2ca..4db90e4df8bec 100644 --- a/lib/vector-vrl-metrics/src/find_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/find_vector_metrics.rs @@ -1,4 +1,5 @@ use std::{collections::BTreeMap, sync::LazyLock}; +use vector_vrl_category::Category; use vrl::prelude::expression::Expr; use vrl::prelude::*; @@ -58,6 +59,10 @@ impl Function for FindVectorMetrics { ) } + fn category(&self) -> &'static str { + Category::Metrics.as_ref() + } + fn return_kind(&self) -> u16 { kind::ARRAY } diff --git a/lib/vector-vrl-metrics/src/get_vector_metric.rs b/lib/vector-vrl-metrics/src/get_vector_metric.rs index bbb5b3a1de896..21193b3e80ded 100644 --- a/lib/vector-vrl-metrics/src/get_vector_metric.rs +++ b/lib/vector-vrl-metrics/src/get_vector_metric.rs @@ -1,5 +1,6 @@ use std::{collections::BTreeMap, sync::LazyLock}; +use vector_vrl_category::Category; use vrl::prelude::{expression::Expr, *}; use crate::common::{ @@ -55,6 +56,10 @@ impl Function for GetVectorMetric { ) } + fn category(&self) -> &'static str { + Category::Metrics.as_ref() + } + fn return_kind(&self) -> u16 { kind::OBJECT | kind::NULL } diff --git a/lib/vector-vrl/category/Cargo.toml b/lib/vector-vrl/category/Cargo.toml new file mode 100644 index 0000000000000..dafb938de89fa --- /dev/null +++ b/lib/vector-vrl/category/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "vector-vrl-category" +version = "0.1.0" +authors = ["Vector Contributors "] +edition = "2024" +publish = false +license = "MPL-2.0" + +[dependencies] +strum = { version = "0.27", features = ["derive"] } diff --git a/lib/vector-vrl/category/src/lib.rs b/lib/vector-vrl/category/src/lib.rs new file mode 100644 index 0000000000000..bd1df20971c1e --- /dev/null +++ b/lib/vector-vrl/category/src/lib.rs @@ -0,0 +1,16 @@ +use strum::AsRefStr; + +/// Category classification for Vector-specific VRL functions. +/// +/// This enum complements the categories defined in the VRL stdlib, +/// providing Vector-specific categories for enrichment, metrics, and event functions. +#[derive(Debug, Clone, Copy, AsRefStr)] +#[strum(serialize_all = "PascalCase")] +pub enum Category { + /// Enrichment table operations + Enrichment, + /// Event metadata and secret management + Event, + /// Internal Vector metrics operations + Metrics, +} diff --git a/lib/vector-vrl/functions/Cargo.toml b/lib/vector-vrl/functions/Cargo.toml index 4e630b9515e92..973c32e565aab 100644 --- a/lib/vector-vrl/functions/Cargo.toml +++ b/lib/vector-vrl/functions/Cargo.toml @@ -12,6 +12,7 @@ vrl.workspace = true enrichment = { path = "../../enrichment" } dnstap-parser = { path = "../../dnstap-parser", optional = true } vector-vrl-metrics = { path = "../../vector-vrl-metrics", optional = true } +vector-vrl-category.workspace = true [features] default = [] diff --git a/lib/vector-vrl/functions/src/get_secret.rs b/lib/vector-vrl/functions/src/get_secret.rs index 3e65a4b325ede..0f3a787d82118 100644 --- a/lib/vector-vrl/functions/src/get_secret.rs +++ b/lib/vector-vrl/functions/src/get_secret.rs @@ -1,3 +1,4 @@ +use vector_vrl_category::Category; use vrl::prelude::*; fn get_secret(ctx: &mut Context, key: Value) -> std::result::Result { @@ -21,6 +22,10 @@ impl Function for GetSecret { "Returns the value of the given secret from an event." } + fn category(&self) -> &'static str { + Category::Event.as_ref() + } + fn return_kind(&self) -> u16 { kind::BYTES | kind::NULL } diff --git a/lib/vector-vrl/functions/src/remove_secret.rs b/lib/vector-vrl/functions/src/remove_secret.rs index 95b16ecd64fd9..47d5c200497f9 100644 --- a/lib/vector-vrl/functions/src/remove_secret.rs +++ b/lib/vector-vrl/functions/src/remove_secret.rs @@ -1,3 +1,4 @@ +use vector_vrl_category::Category; use vrl::prelude::*; fn remove_secret(ctx: &mut Context, key: Value) -> std::result::Result { @@ -18,6 +19,10 @@ impl Function for RemoveSecret { "Removes a secret from an event." } + fn category(&self) -> &'static str { + Category::Event.as_ref() + } + fn return_kind(&self) -> u16 { kind::NULL } diff --git a/lib/vector-vrl/functions/src/set_secret.rs b/lib/vector-vrl/functions/src/set_secret.rs index 39739012ace15..4fba861978a12 100644 --- a/lib/vector-vrl/functions/src/set_secret.rs +++ b/lib/vector-vrl/functions/src/set_secret.rs @@ -1,3 +1,4 @@ +use vector_vrl_category::Category; use vrl::prelude::*; fn set_secret( @@ -25,6 +26,10 @@ impl Function for SetSecret { "Sets the given secret in the event." } + fn category(&self) -> &'static str { + Category::Event.as_ref() + } + fn return_kind(&self) -> u16 { kind::NULL } diff --git a/lib/vector-vrl/functions/src/set_semantic_meaning.rs b/lib/vector-vrl/functions/src/set_semantic_meaning.rs index 08d33c2d93342..13fe6239cf511 100644 --- a/lib/vector-vrl/functions/src/set_semantic_meaning.rs +++ b/lib/vector-vrl/functions/src/set_semantic_meaning.rs @@ -3,6 +3,7 @@ use std::{ ops::{Deref, DerefMut}, }; +use vector_vrl_category::Category; use vrl::{ diagnostic::Label, path::{OwnedTargetPath, PathPrefix}, @@ -46,6 +47,10 @@ impl Function for SetSemanticMeaning { "} } + fn category(&self) -> &'static str { + Category::Event.as_ref() + } + fn return_kind(&self) -> u16 { kind::NULL } From e4d921af7c5cf8f1ede5e1077a20c24a93141563 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 12 Feb 2026 16:52:54 -0500 Subject: [PATCH 13/44] Use .category() --- vdev/src/commands/build/vrl_docs.rs | 123 +--------------------------- 1 file changed, 1 insertion(+), 122 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 00203d5ab3f2d..4282b42f17a2e 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -107,7 +107,6 @@ impl Cli { fn build_function_doc(func: &dyn Function) -> FunctionDoc { let name = func.identifier().to_string(); - let category = infer_category(&name); let arguments: Vec = func .parameters() @@ -149,7 +148,7 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { FunctionDoc { anchor: name.clone(), name, - category: category.to_string(), + category: func.category().to_string(), description: trim_str(func.usage()), arguments, r#return: ReturnDoc { @@ -221,123 +220,3 @@ fn trim_str(s: &'static str) -> String { fn trim_slice(slice: &'static [&'static str]) -> Vec { slice.iter().map(|s| s.trim().to_string()).collect() } - -fn infer_category(name: &str) -> &'static str { - match name { - // Exact matches first (before patterns that might match them) - - // Debug functions (log is a debug function, not number) - "log" | "assert" | "assert_eq" | "abort" => "Debug", - - // Timestamp - exact matches before patterns - "now" | "from_unix_timestamp" | "format_timestamp" => "Timestamp", - - // Cryptography - exact matches - "encrypt" | "decrypt" | "md5" => "Cryptography", - - // String functions - exact matches (including case conversion variants) - "upcase" | "downcase" | "camelcase" | "snakecase" | "kebabcase" => "String", - "screaming_snakecase" | "screamingsnakecase" | "pascalcase" => "String", - "capitalize" | "strip_whitespace" | "truncate" | "trim" => "String", - "strip_ansi_escape_codes" | "starts_with" | "ends_with" | "contains" | "contains_all" => { - "String" - } - "slice" | "split" | "join" | "replace" | "replace_with" => "String", - "redact" | "find" | "substring" | "strlen" | "sieve" => "String", - "match_datadog_query" => "String", - - // Array functions - exact matches (reverse is Array, not String) - "append" | "push" | "pop" | "shift" | "unshift" => "Array", - "flatten" | "chunks" | "unique" | "includes" | "reverse" => "Array", - "tally" | "tally_value" | "unnest" => "Array", - - // Object functions - "keys" | "values" | "object" | "merge" | "compact" => "Object", - "remove" | "set" | "get" => "Object", - "object_from_array" | "unflatten" => "Object", - - // Number functions - "abs" | "ceil" | "floor" | "round" | "mod" => "Number", - "int" | "float" | "haversine" => "Number", - "format_int" | "format_number" => "Number", - - // System functions - "get_env_var" | "get_hostname" | "get_timezone_name" => "System", - "http_request" => "System", - - // Secret/Event functions - "get_secret" | "set_secret" | "remove_secret" => "Event", - - // Enumerate functions - "for_each" | "filter" | "map_keys" | "map_values" => "Enumerate", - - // Checksum functions - "crc" | "seahash" | "xxhash" => "Checksum", - - // Coerce by name - "bool" | "string" | "array" => "Coerce", - - // Path functions - "exists" | "path_matches" | "length" => "Path", - "basename" | "dirname" | "split_path" => "Path", - - // Convert functions - "type_def" | "typeof" | "set_semantic_meaning" => "Convert", - "tag_types_externally" => "Convert", - - // IP functions - "community_id" | "dns_lookup" | "reverse_dns" => "IP", - - // Random/UUID functions - "uuid_from_friendly_id" => "Random", - - // Type/validation functions - "validate_json_schema" => "Type", - - // Now the pattern matches - - // Parse functions - n if n.starts_with("parse_") => "Parse", - - // Codec functions - n if n.starts_with("encode_") => "Codec", - n if n.starts_with("decode_") => "Codec", - - // Type checking functions - n if n.starts_with("is_") => "Type", - - // Coerce functions - n if n.starts_with("to_") => "Coerce", - - // IP functions - n if n.contains("ip") || n.contains("cidr") => "IP", - - // Timestamp functions - n if n.contains("timestamp") => "Timestamp", - - // Cryptography functions - n if n.starts_with("sha") || n.contains("hmac") => "Cryptography", - - // String matching functions - n if n.starts_with("match") => "String", - - // Object functions with del prefix - n if n.starts_with("del") => "Object", - - // Enrichment functions - n if n.starts_with("get_enrichment_table_record") - || n.starts_with("find_enrichment_table") => - { - "Enrichment" - } - - // Random functions - n if n.starts_with("random") || n.starts_with("uuid") => "Random", - - // Metrics - n if n.contains("metric") => "Metrics", - - // Default to String as a reasonable fallback (most new functions are string manipulation) - _ => "String", - } -} From cc66ebe38d7e55d08708f8451376c8ed54d81f4f Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 18 Feb 2026 12:51:08 -0500 Subject: [PATCH 14/44] chore(vrl): bump VRL and use Parameter builder --- Cargo.lock | 2 +- .../src/vrl_functions/parse_dnstap.rs | 25 ++++---- .../src/find_enrichment_table_records.rs | 61 ++++++++----------- .../src/get_enrichment_table_record.rs | 61 ++++++++----------- .../src/aggregate_vector_metrics.rs | 29 +++------ .../src/find_vector_metrics.rs | 21 +++---- .../src/get_vector_metric.rs | 21 +++---- lib/vector-vrl/functions/src/get_secret.rs | 13 ++-- lib/vector-vrl/functions/src/remove_secret.rs | 13 ++-- lib/vector-vrl/functions/src/set_secret.rs | 21 ++----- .../functions/src/set_semantic_meaning.rs | 25 +++----- 11 files changed, 112 insertions(+), 180 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 54fba6414013a..a6302b84d50c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13088,7 +13088,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#7830c051501a08a328c53033364af55fd898aa86" +source = "git+https://github.com/vectordotdev/vrl.git?branch=main#bacda767c055ff37865ec96fe168b31b344252d1" dependencies = [ "aes", "aes-siv", diff --git a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs index 0d92e5835bc9b..8c0a5d07f35e7 100644 --- a/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs +++ b/lib/dnstap-parser/src/vrl_functions/parse_dnstap.rs @@ -11,20 +11,17 @@ static DEFAULT_LOWERCASE_HOSTNAMES: LazyLock = LazyLock::new(|| Value::Bo static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "value", - kind: kind::BYTES, - required: true, - description: "The base64 encoded representation of the DNSTAP data to parse.", - default: None, - }, - Parameter { - keyword: "lowercase_hostnames", - kind: kind::BOOLEAN, - required: false, - description: "Whether to turn all hostnames found in resulting data lowercase, for consistency.", - default: Some(&DEFAULT_LOWERCASE_HOSTNAMES), - }, + Parameter::required( + "value", + kind::BYTES, + "The base64 encoded representation of the DNSTAP data to parse.", + ), + Parameter::optional( + "lowercase_hostnames", + kind::BOOLEAN, + "Whether to turn all hostnames found in resulting data lowercase, for consistency.", + ) + .default(&DEFAULT_LOWERCASE_HOSTNAMES), ] }); diff --git a/lib/enrichment/src/find_enrichment_table_records.rs b/lib/enrichment/src/find_enrichment_table_records.rs index 32a3cf949384e..e30f61967a365 100644 --- a/lib/enrichment/src/find_enrichment_table_records.rs +++ b/lib/enrichment/src/find_enrichment_table_records.rs @@ -10,41 +10,32 @@ use crate::{ static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "table", - kind: kind::BYTES, - required: true, - description: "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", - default: None, - }, - Parameter { - keyword: "condition", - kind: kind::OBJECT, - required: true, - description: "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", - default: None, - }, - Parameter { - keyword: "select", - kind: kind::ARRAY, - required: false, - description: "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", - default: None, - }, - Parameter { - keyword: "case_sensitive", - kind: kind::BOOLEAN, - required: false, - description: "Whether text fields need to match cases exactly.", - default: Some(&DEFAULT_CASE_SENSITIVE), - }, - Parameter { - keyword: "wildcard", - kind: kind::BYTES, - required: false, - description: "Value to use for wildcard matching in the search.", - default: None, - }, + Parameter::required( + "table", + kind::BYTES, + "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", + ), + Parameter::required( + "condition", + kind::OBJECT, + "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", + ), + Parameter::optional( + "select", + kind::ARRAY, + "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", + ), + Parameter::optional( + "case_sensitive", + kind::BOOLEAN, + "Whether text fields need to match cases exactly.", + ) + .default(&DEFAULT_CASE_SENSITIVE), + Parameter::optional( + "wildcard", + kind::BYTES, + "Value to use for wildcard matching in the search.", + ), ] }); diff --git a/lib/enrichment/src/get_enrichment_table_record.rs b/lib/enrichment/src/get_enrichment_table_record.rs index c8e92c3e7823e..1195c72cd2f46 100644 --- a/lib/enrichment/src/get_enrichment_table_record.rs +++ b/lib/enrichment/src/get_enrichment_table_record.rs @@ -10,41 +10,32 @@ use crate::{ static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "table", - kind: kind::BYTES, - required: true, - description: "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", - default: None, - }, - Parameter { - keyword: "condition", - kind: kind::OBJECT, - required: true, - description: "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", - default: None, - }, - Parameter { - keyword: "select", - kind: kind::ARRAY, - required: false, - description: "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", - default: None, - }, - Parameter { - keyword: "case_sensitive", - kind: kind::BOOLEAN, - required: false, - description: "Whether the text fields match the case exactly.", - default: Some(&DEFAULT_CASE_SENSITIVE), - }, - Parameter { - keyword: "wildcard", - kind: kind::BYTES, - required: false, - description: "Value to use for wildcard matching in the search.", - default: None, - }, + Parameter::required( + "table", + kind::BYTES, + "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", + ), + Parameter::required( + "condition", + kind::OBJECT, + "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", + ), + Parameter::optional( + "select", + kind::ARRAY, + "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", + ), + Parameter::optional( + "case_sensitive", + kind::BOOLEAN, + "Whether the text fields match the case exactly.", + ) + .default(&DEFAULT_CASE_SENSITIVE), + Parameter::optional( + "wildcard", + kind::BYTES, + "Value to use for wildcard matching in the search.", + ), ] }); diff --git a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs index 949b2c8316b91..6d47c76d89cf1 100644 --- a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs @@ -13,27 +13,14 @@ use crate::common::{Error, MetricsStorage}; static DEFAULT_TAGS: LazyLock = LazyLock::new(|| Value::Object(BTreeMap::new())); static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "function", - kind: kind::BYTES, - required: true, - description: "The metric name to search.", - default: None, - }, - Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The metric name to aggregate.", - default: None, - }, - Parameter { - keyword: "tags", - kind: kind::OBJECT, - required: false, - description: "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - default: Some(&DEFAULT_TAGS), - }, + Parameter::required("function", kind::BYTES, "The metric name to search."), + Parameter::required("key", kind::BYTES, "The metric name to aggregate."), + Parameter::optional( + "tags", + kind::OBJECT, + "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + ) + .default(&DEFAULT_TAGS), ] }); diff --git a/lib/vector-vrl-metrics/src/find_vector_metrics.rs b/lib/vector-vrl-metrics/src/find_vector_metrics.rs index 4db90e4df8bec..7b278a17c2fb7 100644 --- a/lib/vector-vrl-metrics/src/find_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/find_vector_metrics.rs @@ -27,20 +27,13 @@ static DEFAULT_TAGS: LazyLock = LazyLock::new(|| Value::Object(BTreeMap:: static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The metric name to search.", - default: None, - }, - Parameter { - keyword: "tags", - kind: kind::OBJECT, - required: false, - description: "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - default: Some(&DEFAULT_TAGS), - }, + Parameter::required("key", kind::BYTES, "The metric name to search."), + Parameter::optional( + "tags", + kind::OBJECT, + "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + ) + .default(&DEFAULT_TAGS), ] }); diff --git a/lib/vector-vrl-metrics/src/get_vector_metric.rs b/lib/vector-vrl-metrics/src/get_vector_metric.rs index 21193b3e80ded..08de641c67548 100644 --- a/lib/vector-vrl-metrics/src/get_vector_metric.rs +++ b/lib/vector-vrl-metrics/src/get_vector_metric.rs @@ -24,20 +24,13 @@ static DEFAULT_TAGS: LazyLock = LazyLock::new(|| Value::Object(BTreeMap:: static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The metric name to search.", - default: None, - }, - Parameter { - keyword: "tags", - kind: kind::OBJECT, - required: false, - description: "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - default: Some(&DEFAULT_TAGS), - }, + Parameter::required("key", kind::BYTES, "The metric name to search."), + Parameter::optional( + "tags", + kind::OBJECT, + "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + ) + .default(&DEFAULT_TAGS), ] }); diff --git a/lib/vector-vrl/functions/src/get_secret.rs b/lib/vector-vrl/functions/src/get_secret.rs index 0f3a787d82118..9e2e6b3cc21c1 100644 --- a/lib/vector-vrl/functions/src/get_secret.rs +++ b/lib/vector-vrl/functions/src/get_secret.rs @@ -31,13 +31,12 @@ impl Function for GetSecret { } fn parameters(&self) -> &'static [Parameter] { - &[Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The name of the secret.", - default: None, - }] + const PARAMETERS: &[Parameter] = &[Parameter::required( + "key", + kind::BYTES, + "The name of the secret.", + )]; + PARAMETERS } fn examples(&self) -> &'static [Example] { diff --git a/lib/vector-vrl/functions/src/remove_secret.rs b/lib/vector-vrl/functions/src/remove_secret.rs index 47d5c200497f9..3ba343181387e 100644 --- a/lib/vector-vrl/functions/src/remove_secret.rs +++ b/lib/vector-vrl/functions/src/remove_secret.rs @@ -28,13 +28,12 @@ impl Function for RemoveSecret { } fn parameters(&self) -> &'static [Parameter] { - &[Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The name of the secret to remove.", - default: None, - }] + const PARAMETERS: &[Parameter] = &[Parameter::required( + "key", + kind::BYTES, + "The name of the secret to remove.", + )]; + PARAMETERS } fn examples(&self) -> &'static [Example] { diff --git a/lib/vector-vrl/functions/src/set_secret.rs b/lib/vector-vrl/functions/src/set_secret.rs index 4fba861978a12..eca71bf47f000 100644 --- a/lib/vector-vrl/functions/src/set_secret.rs +++ b/lib/vector-vrl/functions/src/set_secret.rs @@ -35,22 +35,11 @@ impl Function for SetSecret { } fn parameters(&self) -> &'static [Parameter] { - &[ - Parameter { - keyword: "key", - kind: kind::BYTES, - required: true, - description: "The name of the secret.", - default: None, - }, - Parameter { - keyword: "secret", - kind: kind::BYTES, - required: true, - description: "The secret value.", - default: None, - }, - ] + const PARAMETERS: &[Parameter] = &[ + Parameter::required("key", kind::BYTES, "The name of the secret."), + Parameter::required("secret", kind::BYTES, "The secret value."), + ]; + PARAMETERS } fn examples(&self) -> &'static [Example] { diff --git a/lib/vector-vrl/functions/src/set_semantic_meaning.rs b/lib/vector-vrl/functions/src/set_semantic_meaning.rs index 13fe6239cf511..f2036cdbcfbe0 100644 --- a/lib/vector-vrl/functions/src/set_semantic_meaning.rs +++ b/lib/vector-vrl/functions/src/set_semantic_meaning.rs @@ -56,22 +56,15 @@ impl Function for SetSemanticMeaning { } fn parameters(&self) -> &'static [Parameter] { - &[ - Parameter { - keyword: "target", - kind: kind::ANY, - required: true, - description: "The path of the value that is assigned a meaning.", - default: None, - }, - Parameter { - keyword: "meaning", - kind: kind::BYTES, - required: true, - description: "The name of the meaning to assign.", - default: None, - }, - ] + const PARAMETERS: &[Parameter] = &[ + Parameter::required( + "target", + kind::ANY, + "The path of the value that is assigned a meaning.", + ), + Parameter::required("meaning", kind::BYTES, "The name of the meaning to assign."), + ]; + PARAMETERS } fn examples(&self) -> &'static [Example] { From 4b8797e2d5c1be7e1c345e0f438955a353d3d9bb Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 18 Feb 2026 13:08:33 -0500 Subject: [PATCH 15/44] Add .enum_variants to aggregate_vector_metrics --- .../src/aggregate_vector_metrics.rs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs index 6d47c76d89cf1..49711b2b49185 100644 --- a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs @@ -13,7 +13,25 @@ use crate::common::{Error, MetricsStorage}; static DEFAULT_TAGS: LazyLock = LazyLock::new(|| Value::Object(BTreeMap::new())); static PARAMETERS: LazyLock> = LazyLock::new(|| { vec![ - Parameter::required("function", kind::BYTES, "The metric name to search."), + Parameter::required("function", kind::BYTES, "The metric name to search.") + .enum_variants(&[ + EnumVariant { + value: "sum", + description: "Sum the values of all the matched metrics.", + }, + EnumVariant { + value: "avg", + description: "Find the average of the values of all the matched metrics.", + }, + EnumVariant { + value: "max", + description: "Find the highest metric value of all the matched metrics.", + }, + EnumVariant { + value: "min", + description: "Find the lowest metric value of all the matched metrics.", + }, + ]), Parameter::required("key", kind::BYTES, "The metric name to aggregate."), Parameter::optional( "tags", From f2a3ddf149c09d1d34e43751d80057a06522eeb7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 18 Feb 2026 13:17:38 -0500 Subject: [PATCH 16/44] Add missing import --- lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs index 49711b2b49185..090d51f8a864d 100644 --- a/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs +++ b/lib/vector-vrl-metrics/src/aggregate_vector_metrics.rs @@ -2,6 +2,7 @@ use std::collections::BTreeMap; use std::sync::LazyLock; use vector_vrl_category::Category; use vrl::prelude::expression::Expr; +use vrl::prelude::function::EnumVariant; use vrl::value; use vrl::prelude::*; From 44cacba9627a04a7b3e1caebe45e73abcca953c1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 18 Feb 2026 19:53:13 -0500 Subject: [PATCH 17/44] Add support for enum_variants --- vdev/src/commands/build/vrl_docs.rs | 43 +++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 4282b42f17a2e..1518a1c9b54a5 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -1,10 +1,11 @@ use anyhow::Result; use serde::Serialize; -use std::fs; -use std::path::PathBuf; +use std::{collections::HashMap, fs, path::PathBuf}; use vrl::compiler::Function; use vrl::compiler::value::kind; use vrl::core::Value; +use vrl::prelude::Parameter; +use vrl::prelude::function::EnumVariant; /// Generate VRL function documentation as JSON files. /// @@ -52,6 +53,8 @@ struct ArgumentDoc { description: String, required: bool, r#type: Vec, + #[serde(skip_serializing_if = "HashMap::is_empty")] + r#enum: HashMap, #[serde(skip_serializing_if = "Option::is_none")] default: Option, } @@ -111,12 +114,36 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { let arguments: Vec = func .parameters() .iter() - .map(|param| ArgumentDoc { - name: param.keyword.trim().to_string(), - description: param.description.trim().to_string(), - required: param.required, - r#type: kind_to_types(param.kind), - default: param.default.map(pretty_value), + .map(|param| { + let Parameter { + keyword, + kind, + required, + description, + default, + enum_variants, + } = param; + + let name = keyword.trim().to_string(); + let description = description.trim().to_string(); + let default = default.map(pretty_value); + let r#type = kind_to_types(*kind); + let r#enum = enum_variants + .unwrap_or_default() + .iter() + .map(|EnumVariant { value, description }| { + (value.to_string(), description.to_string()) + }) + .collect(); + + ArgumentDoc { + name, + description, + required: *required, + r#type, + default, + r#enum, + } }) .collect(); From 2504f35a3439a37e4c6ff24fe5ddbdb4d9e1e5ee Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 19 Feb 2026 09:40:11 -0500 Subject: [PATCH 18/44] Add Raises block to remap rendering --- website/layouts/partials/data.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/website/layouts/partials/data.html b/website/layouts/partials/data.html index 7243270d28d40..b486b1233d560 100644 --- a/website/layouts/partials/data.html +++ b/website/layouts/partials/data.html @@ -1800,6 +1800,16 @@

{{ end }} + + {{ if isset .ctx "raises" }} +
+ Raises + +
+ {{ template "code" .ctx.raises }} +
+
+ {{ end }} {{ end }} From decc3873b8391dd3bf7f92744c221b58ab401c86 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 13:31:48 -0500 Subject: [PATCH 19/44] Bump vrl --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8f53adf633903..0560958b51893 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13109,7 +13109,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#bacda767c055ff37865ec96fe168b31b344252d1" +source = "git+https://github.com/vectordotdev/vrl.git?branch=main#c4afddc9d18cc368796686c312cd87d90d3c8808" dependencies = [ "aes", "aes-siv", From 142b3d3eb02f517187b281ae868fba1216549a78 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 13:42:01 -0500 Subject: [PATCH 20/44] Fix clippy --- vdev/src/commands/build/vrl_docs.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 1518a1c9b54a5..1ec39459ae98c 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -232,9 +232,7 @@ fn kind_to_types(kind_bits: u16) -> Vec { fn pretty_value(v: &Value) -> String { if let Value::Bytes(b) = v { - str::from_utf8(&b) - .map(String::from) - .unwrap_or_else(|_| v.to_string()) + str::from_utf8(b).map_or_else(|_| v.to_string(), String::from) } else { v.to_string() } From c4b4600ff5260f288d652732360a18c21104a2a6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 13:57:07 -0500 Subject: [PATCH 21/44] Install protoc when compiling vdev --- .github/actions/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 99067675b8251..f36f1164e5986 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -211,7 +211,7 @@ runs: EOF - name: Install protoc - if: ${{ inputs.protoc == 'true' }} + if: ${{ inputs.protoc == 'true' || env.VDEV_NEEDS_COMPILE == 'true' }} shell: bash run: | echo "Installing protoc" From 5f0ef5442b33e62d7ce81b06867404c8aa203efe Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 15:19:26 -0500 Subject: [PATCH 22/44] Add generated files --- website/cue/reference/remap/functions/abs.cue | 91 ++--- .../functions/aggregate_vector_metrics.cue | 161 +++++---- .../cue/reference/remap/functions/append.cue | 83 +++-- .../cue/reference/remap/functions/array.cue | 98 ++++-- .../cue/reference/remap/functions/assert.cue | 117 ++++--- .../reference/remap/functions/assert_eq.cue | 133 ++++--- .../reference/remap/functions/basename.cue | 107 +++--- .../cue/reference/remap/functions/bool.cue | 90 +++-- .../reference/remap/functions/camelcase.cue | 103 +++--- .../cue/reference/remap/functions/ceil.cue | 107 +++--- .../cue/reference/remap/functions/chunks.cue | 111 +++--- .../remap/functions/community_id.cue | 149 ++++---- .../cue/reference/remap/functions/compact.cue | 215 +++++++----- .../reference/remap/functions/contains.cue | 106 +++--- .../remap/functions/contains_all.cue | 110 +++--- website/cue/reference/remap/functions/crc.cue | 331 +++++++++--------- .../remap/functions/decode_base16.cue | 74 ++-- .../remap/functions/decode_base64.cue | 105 +++--- .../remap/functions/decode_charset.cue | 108 +++--- .../reference/remap/functions/decode_gzip.cue | 70 ++-- .../reference/remap/functions/decode_lz4.cue | 123 +++---- .../remap/functions/decode_mime_q.cue | 93 ++--- .../remap/functions/decode_percent.cue | 64 ++-- .../remap/functions/decode_punycode.cue | 109 +++--- .../remap/functions/decode_snappy.cue | 70 ++-- .../reference/remap/functions/decode_zlib.cue | 70 ++-- .../reference/remap/functions/decode_zstd.cue | 70 ++-- .../cue/reference/remap/functions/decrypt.cue | 162 ++++----- .../reference/remap/functions/decrypt_ip.cue | 172 +++++---- website/cue/reference/remap/functions/del.cue | 153 ++++---- .../cue/reference/remap/functions/dirname.cue | 118 +++---- .../reference/remap/functions/dns_lookup.cue | 261 ++++++++++++++ .../reference/remap/functions/downcase.cue | 70 ++-- .../remap/functions/encode_base16.cue | 64 ++-- .../remap/functions/encode_base64.cue | 133 +++---- .../remap/functions/encode_charset.cue | 108 +++--- .../reference/remap/functions/encode_gzip.cue | 81 +++-- .../reference/remap/functions/encode_json.cue | 84 +++-- .../remap/functions/encode_key_value.cue | 210 ++++++----- .../remap/functions/encode_logfmt.cue | 124 +++---- .../reference/remap/functions/encode_lz4.cue | 83 ++--- .../remap/functions/encode_percent.cue | 119 ++++--- .../remap/functions/encode_proto.cue | 107 +++--- .../remap/functions/encode_punycode.cue | 121 +++---- .../remap/functions/encode_snappy.cue | 70 ++-- .../reference/remap/functions/encode_zlib.cue | 81 +++-- .../reference/remap/functions/encode_zstd.cue | 81 +++-- .../cue/reference/remap/functions/encrypt.cue | 162 ++++----- .../reference/remap/functions/encrypt_ip.cue | 154 ++++---- .../reference/remap/functions/ends_with.cue | 111 +++--- .../cue/reference/remap/functions/exists.cue | 88 ++--- .../cue/reference/remap/functions/filter.cue | 104 +++--- .../cue/reference/remap/functions/find.cue | 137 ++++---- .../find_enrichment_table_records.cue | 220 +++++++----- .../remap/functions/find_vector_metrics.cue | 121 ++++--- .../cue/reference/remap/functions/flatten.cue | 135 +++---- .../cue/reference/remap/functions/float.cue | 90 +++-- .../cue/reference/remap/functions/floor.cue | 102 +++--- .../reference/remap/functions/for_each.cue | 107 +++--- .../reference/remap/functions/format_int.cue | 102 +++--- .../remap/functions/format_number.cue | 120 ++++--- .../remap/functions/format_timestamp.cue | 114 +++--- .../remap/functions/from_unix_timestamp.cue | 123 ++++--- website/cue/reference/remap/functions/get.cue | 154 +++++--- .../functions/get_enrichment_table_record.cue | 188 +++++----- .../reference/remap/functions/get_env_var.cue | 71 ++-- .../remap/functions/get_hostname.cue | 54 +-- .../reference/remap/functions/get_secret.cue | 72 ++-- .../remap/functions/get_timezone_name.cue | 60 ++-- .../remap/functions/get_vector_metric.cue | 118 ++++--- .../reference/remap/functions/haversine.cue | 154 ++++---- .../cue/reference/remap/functions/hmac.cue | 149 ++++---- .../remap/functions/http_request.cue | 109 ++++++ .../reference/remap/functions/includes.cue | 88 +++-- website/cue/reference/remap/functions/int.cue | 90 +++-- .../cue/reference/remap/functions/ip_aton.cue | 72 ++-- .../remap/functions/ip_cidr_contains.cue | 120 ++++--- .../cue/reference/remap/functions/ip_ntoa.cue | 72 ++-- .../cue/reference/remap/functions/ip_ntop.cue | 98 +++--- .../cue/reference/remap/functions/ip_pton.cue | 97 +++-- .../reference/remap/functions/ip_subnet.cue | 114 +++--- .../reference/remap/functions/ip_to_ipv6.cue | 79 +++-- .../remap/functions/ipv6_to_ipv4.cue | 83 ++--- .../reference/remap/functions/is_array.cue | 96 ++--- .../reference/remap/functions/is_boolean.cue | 91 ++--- .../reference/remap/functions/is_empty.cue | 115 +++--- .../reference/remap/functions/is_float.cue | 96 ++--- .../reference/remap/functions/is_integer.cue | 91 ++--- .../cue/reference/remap/functions/is_ipv4.cue | 102 +++--- .../cue/reference/remap/functions/is_ipv6.cue | 98 +++--- .../cue/reference/remap/functions/is_json.cue | 145 ++++---- .../cue/reference/remap/functions/is_null.cue | 92 ++--- .../reference/remap/functions/is_nullish.cue | 118 +++---- .../reference/remap/functions/is_object.cue | 91 ++--- .../reference/remap/functions/is_regex.cue | 91 ++--- .../reference/remap/functions/is_string.cue | 96 ++--- .../remap/functions/is_timestamp.cue | 91 ++--- .../cue/reference/remap/functions/join.cue | 93 ++--- .../reference/remap/functions/kebabcase.cue | 103 +++--- .../cue/reference/remap/functions/keys.cue | 78 +++-- .../cue/reference/remap/functions/length.cue | 132 +++---- website/cue/reference/remap/functions/log.cue | 131 ++++--- .../reference/remap/functions/map_keys.cue | 164 ++++----- .../reference/remap/functions/map_values.cue | 130 +++---- .../cue/reference/remap/functions/match.cue | 90 ++--- .../reference/remap/functions/match_any.cue | 86 +++-- .../reference/remap/functions/match_array.cue | 130 +++---- .../remap/functions/match_datadog_query.cue | 114 +++--- website/cue/reference/remap/functions/md5.cue | 64 ++-- .../cue/reference/remap/functions/merge.cue | 182 +++++----- website/cue/reference/remap/functions/mod.cue | 90 ++--- website/cue/reference/remap/functions/now.cue | 48 +-- .../cue/reference/remap/functions/object.cue | 91 ++--- .../remap/functions/object_from_array.cue | 124 ++++--- .../remap/functions/parse_apache_log.cue | 222 ++++++------ .../remap/functions/parse_aws_alb_log.cue | 234 +++++++------ ...ws_cloudwatch_log_subscription_message.cue | 114 +++--- .../functions/parse_aws_vpc_flow_log.cue | 215 ++++++------ .../reference/remap/functions/parse_bytes.cue | 168 +++++---- .../reference/remap/functions/parse_cbor.cue | 113 ++++-- .../reference/remap/functions/parse_cef.cue | 257 ++++++++------ .../remap/functions/parse_common_log.cue | 159 +++++---- .../reference/remap/functions/parse_csv.cue | 114 +++--- .../remap/functions/parse_dnstap.cue | 290 +++++++-------- .../remap/functions/parse_duration.cue | 119 ++++--- .../reference/remap/functions/parse_etld.cue | 176 +++++----- .../reference/remap/functions/parse_float.cue | 88 ++--- .../reference/remap/functions/parse_glog.cue | 81 +++-- .../reference/remap/functions/parse_grok.cue | 104 +++--- .../reference/remap/functions/parse_groks.cue | 174 +++++---- .../remap/functions/parse_influxdb.cue | 215 ++++++------ .../reference/remap/functions/parse_int.cue | 139 ++++---- .../reference/remap/functions/parse_json.cue | 170 +++++---- .../remap/functions/parse_key_value.cue | 279 ++++++++------- .../reference/remap/functions/parse_klog.cue | 89 ++--- .../functions/parse_linux_authorization.cue | 93 ++--- .../remap/functions/parse_logfmt.cue | 107 +++--- .../remap/functions/parse_nginx_log.cue | 280 +++++++-------- .../reference/remap/functions/parse_proto.cue | 131 +++---- .../remap/functions/parse_query_string.cue | 110 +++--- .../reference/remap/functions/parse_regex.cue | 178 +++++----- .../remap/functions/parse_regex_all.cue | 191 ++++++---- .../remap/functions/parse_ruby_hash.cue | 93 ++--- .../remap/functions/parse_syslog.cue | 115 +++--- .../remap/functions/parse_timestamp.cue | 115 +++--- .../remap/functions/parse_tokens.cue | 89 ++--- .../reference/remap/functions/parse_url.cue | 172 ++++----- .../remap/functions/parse_user_agent.cue | 233 ++++++------ .../reference/remap/functions/parse_xml.cue | 220 +++++++----- .../reference/remap/functions/pascalcase.cue | 103 +++--- website/cue/reference/remap/functions/pop.cue | 75 ++-- .../cue/reference/remap/functions/push.cue | 97 ++--- .../reference/remap/functions/random_bool.cue | 48 +-- .../remap/functions/random_bytes.cue | 77 ++-- .../remap/functions/random_float.cue | 84 +++-- .../reference/remap/functions/random_int.cue | 84 +++-- .../cue/reference/remap/functions/redact.cue | 227 +++++------- .../cue/reference/remap/functions/remove.cue | 209 +++++++---- .../remap/functions/remove_secret.cue | 66 ++-- .../cue/reference/remap/functions/replace.cue | 162 ++++----- .../remap/functions/replace_with.cue | 162 ++++----- .../reference/remap/functions/reverse_dns.cue | 35 ++ .../cue/reference/remap/functions/round.cue | 112 +++--- .../remap/functions/screamingsnakecase.cue | 103 +++--- .../cue/reference/remap/functions/seahash.cue | 77 ++-- website/cue/reference/remap/functions/set.cue | 188 ++++++---- .../reference/remap/functions/set_secret.cue | 78 +++-- .../remap/functions/set_semantic_meaning.cue | 89 ++--- .../cue/reference/remap/functions/sha1.cue | 64 ++-- .../cue/reference/remap/functions/sha2.cue | 106 +++--- .../cue/reference/remap/functions/sha3.cue | 102 +++--- .../remap/functions/shannon_entropy.cue | 127 +++---- .../cue/reference/remap/functions/sieve.cue | 136 +++---- .../cue/reference/remap/functions/slice.cue | 125 ++++--- .../reference/remap/functions/snakecase.cue | 120 ++++--- .../cue/reference/remap/functions/split.cue | 137 +++++--- .../reference/remap/functions/split_path.cue | 116 +++--- .../reference/remap/functions/starts_with.cue | 111 +++--- .../cue/reference/remap/functions/string.cue | 85 +++-- .../functions/strip_ansi_escape_codes.cue | 57 ++- .../remap/functions/strip_whitespace.cue | 80 +++-- .../cue/reference/remap/functions/strlen.cue | 70 ++-- .../remap/functions/tag_types_externally.cue | 144 ++++---- .../cue/reference/remap/functions/tally.cue | 39 +++ .../reference/remap/functions/tally_value.cue | 43 +++ .../reference/remap/functions/timestamp.cue | 85 +++-- .../cue/reference/remap/functions/to_bool.cue | 205 +++++++---- .../reference/remap/functions/to_float.cue | 143 +++++--- .../cue/reference/remap/functions/to_int.cue | 148 +++++--- .../reference/remap/functions/to_regex.cue | 81 +++-- .../reference/remap/functions/to_string.cue | 142 +++++--- .../remap/functions/to_syslog_facility.cue | 75 ++-- .../functions/to_syslog_facility_code.cue | 75 ++-- .../remap/functions/to_syslog_level.cue | 75 ++-- .../remap/functions/to_syslog_severity.cue | 83 +++-- .../remap/functions/to_unix_timestamp.cue | 126 +++---- .../reference/remap/functions/truncate.cue | 130 ++++--- .../reference/remap/functions/type_def.cue | 37 ++ .../reference/remap/functions/unflatten.cue | 217 ++++++------ .../cue/reference/remap/functions/unique.cue | 72 ++-- .../cue/reference/remap/functions/unnest.cue | 147 ++++---- .../cue/reference/remap/functions/upcase.cue | 65 ++-- .../remap/functions/uuid_from_friendly_id.cue | 71 ++-- .../cue/reference/remap/functions/uuid_v4.cue | 48 +-- .../cue/reference/remap/functions/uuid_v7.cue | 90 ++--- .../remap/functions/validate_json_schema.cue | 160 +++++---- .../cue/reference/remap/functions/values.cue | 93 +++-- .../cue/reference/remap/functions/xxhash.cue | 133 +++---- website/cue/reference/remap/functions/zip.cue | 172 ++++++--- 209 files changed, 13546 insertions(+), 11277 deletions(-) create mode 100644 website/cue/reference/remap/functions/dns_lookup.cue create mode 100644 website/cue/reference/remap/functions/http_request.cue create mode 100644 website/cue/reference/remap/functions/reverse_dns.cue create mode 100644 website/cue/reference/remap/functions/tally.cue create mode 100644 website/cue/reference/remap/functions/tally_value.cue create mode 100644 website/cue/reference/remap/functions/type_def.cue diff --git a/website/cue/reference/remap/functions/abs.cue b/website/cue/reference/remap/functions/abs.cue index f8aad893be3a9..b655dc2a520dc 100644 --- a/website/cue/reference/remap/functions/abs.cue +++ b/website/cue/reference/remap/functions/abs.cue @@ -1,41 +1,50 @@ -package metadata - -remap: functions: abs: { - category: "Number" - description: """ - Computes the absolute value of `value`. - """ - - arguments: [ - { - name: "value" - description: "The number to calculate the absolute value." - required: true - type: ["integer", "float"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer", "float"] - rules: [ - "Returns the absolute value.", - ] - } - - examples: [ - { - title: "Computes the absolute value of the integer" - source: #""" - abs(-42) - """# - return: 42 - }, - { - title: "Computes the absolute value of the float" - source: #""" - abs(-42.2) - """# - return: 42.2 - }, - ] -} +{ + "remap": { + "functions": { + "abs": { + "anchor": "abs", + "name": "abs", + "category": "Number", + "description": "Computes the absolute value of `value`.", + "arguments": [ + { + "name": "value", + "description": "The number to calculate the absolute value.", + "required": true, + "type": [ + "integer", + "float" + ] + } + ], + "return": { + "types": [ + "integer", + "float" + ], + "rules": [ + "Returns the absolute value." + ] + }, + "examples": [ + { + "title": "Computes the absolute value of an integer", + "source": "abs(-42)", + "return": 42 + }, + { + "title": "Computes the absolute value of a float", + "source": "abs(-42.2)", + "return": 42.2 + }, + { + "title": "Computes the absolute value of a positive integer", + "source": "abs(10)", + "return": 10 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue index cdf2c0141dd70..79a420c04f90e 100644 --- a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue +++ b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue @@ -1,82 +1,79 @@ -package metadata - -remap: functions: aggregate_vector_metric: { - category: "Metrics" - description: """ - Aggregates internal Vector metrics, using one of 4 aggregation functions, filtering by name - and optionally by tags. Returns the aggregated value. Only includes counter and gauge metrics. - - \(remap._vector_metrics_explainer) - """ - - arguments: [ - { - name: "function" - description: "The metric name to search." - required: true - type: ["string"] - enum: { - sum: "Sum the values of all the matched metrics" - avg: "Find the average of the values of all the matched metrics" - max: "Find the highest metric value of all the matched metrics" - min: "Find the lowest metric value of all the matched metrics" - } - }, - { - name: "key" - description: "The metric name to aggregate." - required: true - type: ["string"] - }, - { - name: "tags" - description: """ - Tags to filter the results on. Values in this object support wildcards ('*') to - match on parts of the tag value. - """ - required: false - type: ["object"] - }, - ] - internal_failure_reasons: [] - return: types: ["float"] - - examples: [ - { - title: "Sum vector internal metrics matching the name" - source: #""" - aggregate_vector_metrics("sum", "utilization") - """# - return: 0.5 - }, - { - - title: "Sum vector internal metrics matching the name and tags" - source: #""" - aggregate_vector_metrics("sum", "utilization", tags: {"component_id": "test"}) - """# - return: 0.5 - }, - { - title: "Average of vector internal metrics matching the name" - source: #""" - aggregate_vector_metrics("avg", "utilization") - """# - return: 0.5 - }, - { - title: "Max of vector internal metrics matching the name" - source: #""" - aggregate_vector_metrics("max", "utilization") - """# - return: 0.5 - }, - { - title: "Min of vector internal metrics matching the name" - source: #""" - aggregate_vector_metrics("max", "utilization") - """# - return: 0.5 - }, - ] -} +{ + "remap": { + "functions": { + "aggregate_vector_metrics": { + "anchor": "aggregate_vector_metrics", + "name": "aggregate_vector_metrics", + "category": "Metrics", + "description": "Aggregates internal Vector metrics, using one of 4 aggregation functions, filtering by name and optionally by tags. Returns the aggregated value. Only includes counter and gauge metrics.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", + "arguments": [ + { + "name": "function", + "description": "The metric name to search.", + "required": true, + "type": [ + "string" + ], + "enum": { + "avg": "Find the average of the values of all the matched metrics.", + "min": "Find the lowest metric value of all the matched metrics.", + "sum": "Sum the values of all the matched metrics.", + "max": "Find the highest metric value of all the matched metrics." + } + }, + { + "name": "key", + "description": "The metric name to aggregate.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "tags", + "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + } + ], + "return": { + "types": [ + "float", + "null" + ] + }, + "examples": [ + { + "title": "Sum vector internal metrics matching the name", + "source": "aggregate_vector_metrics(\"sum\", \"utilization\")", + "return": 0.5 + }, + { + "title": "Sum vector internal metrics matching the name and tags", + "source": "aggregate_vector_metrics(\"sum\", \"utilization\", tags: {\"component_id\": \"test\"})", + "return": 0.5 + }, + { + "title": "Average of vector internal metrics matching the name", + "source": "aggregate_vector_metrics(\"avg\", \"utilization\")", + "return": 0.5 + }, + { + "title": "Max of vector internal metrics matching the name", + "source": "aggregate_vector_metrics(\"max\", \"utilization\")", + "return": 0.5 + }, + { + "title": "Min of vector internal metrics matching the name", + "source": "aggregate_vector_metrics(\"max\", \"utilization\")", + "return": 0.5 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/append.cue b/website/cue/reference/remap/functions/append.cue index 289c62296cd40..8424c243df174 100644 --- a/website/cue/reference/remap/functions/append.cue +++ b/website/cue/reference/remap/functions/append.cue @@ -1,35 +1,48 @@ -package metadata - -remap: functions: append: { - category: "Array" - description: """ - Appends each item in the `items` array to the end of the `value` array. - """ - - arguments: [ - { - name: "value" - description: "The initial array." - required: true - type: ["array"] - }, - { - name: "items" - description: "The items to append." - required: true - type: ["array"] - }, - ] - internal_failure_reasons: [] - return: types: ["array"] - - examples: [ - { - title: "Append to an array" - source: """ - append([1, 2], [3, 4]) - """ - return: [1, 2, 3, 4] - }, - ] -} +{ + "remap": { + "functions": { + "append": { + "anchor": "append", + "name": "append", + "category": "Array", + "description": "Appends each item in the `items` array to the end of the `value` array.", + "arguments": [ + { + "name": "value", + "description": "The initial array.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "items", + "description": "The items to append.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "examples": [ + { + "title": "Append to an array", + "source": "append([1, 2], [3, 4])", + "return": [ + 1, + 2, + 3, + 4 + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/array.cue b/website/cue/reference/remap/functions/array.cue index 9a249ce918dc0..a1c6d6d248296 100644 --- a/website/cue/reference/remap/functions/array.cue +++ b/website/cue/reference/remap/functions/array.cue @@ -1,38 +1,60 @@ -package metadata - -remap: functions: array: { - category: "Type" - description: """ - Returns `value` if it is an array, otherwise returns an error. This enables the type checker to guarantee that the - returned value is an array and can be used in any function that expects an array. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is an array." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not an array.", - ] - return: { - types: ["array"] - rules: [ - #"Returns the `value` if it's an array."#, - #"Raises an error if not an array."#, - ] - } - examples: [ - { - title: "Declare an array type" - input: log: value: [1, 2, 3] - source: #""" - array!(.value) - """# - return: input.log.value - }, - ] -} +{ + "remap": { + "functions": { + "array": { + "anchor": "array", + "name": "array", + "category": "Type", + "description": "Returns `value` if it is an array, otherwise returns an error. This enables the type checker to guarantee that the returned value is an array and can be used in any function that expects an array.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an array.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Returns the `value` if it's an array.", + "Raises an error if not an array." + ] + }, + "internal_failure_reasons": [ + "`value` is not an array." + ], + "examples": [ + { + "title": "Declare an array type", + "source": ".value = [1, 2, 3]\narray(.value)\n", + "return": [ + 1, + 2, + 3 + ] + }, + { + "title": "Valid array literal", + "source": "array([1,2,3])", + "return": [ + 1, + 2, + 3 + ] + }, + { + "title": "Invalid type", + "source": "array!(true)", + "raises": "function call error for \"array\" at (0:12): expected array, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/assert.cue b/website/cue/reference/remap/functions/assert.cue index 6e7d905ac425b..2828046db1a9f 100644 --- a/website/cue/reference/remap/functions/assert.cue +++ b/website/cue/reference/remap/functions/assert.cue @@ -1,58 +1,59 @@ -package metadata - -remap: functions: assert: { - category: "Debug" - description: """ - Asserts the `condition`, which must be a Boolean expression. The program is aborted with - `message` if the condition evaluates to `false`. - """ - notices: [ - """ - The `assert` function should be used in a standalone fashion and only when you want to abort the program. You - should avoid it in logical expressions and other situations in which you want the program to continue if the - condition evaluates to `false`. - """, - ] - - pure: false - - arguments: [ - { - name: "condition" - description: "The condition to check." - required: true - type: ["boolean"] - }, - { - name: "message" - description: """ - An optional custom error message. If the equality assertion fails, `message` is - appended to the default message prefix. See the [examples](#assert-examples) below - for a fully formed log message sample. - """ - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`condition` evaluates to `false`.", - ] - return: types: ["boolean"] - - examples: [ - { - title: "Assertion (true)" - source: #""" - assert!("foo" == "foo", message: "\"foo\" must be \"foo\"!") - """# - return: true - }, - { - title: "Assertion (false)" - source: #""" - assert!("foo" == "bar", message: "\"foo\" must be \"foo\"!") - """# - raises: runtime: #"function call error for "assert" at (0:60): "foo" must be "foo"!"# - }, - ] -} +{ + "remap": { + "functions": { + "assert": { + "anchor": "assert", + "name": "assert", + "category": "Debug", + "description": "Asserts the `condition`, which must be a Boolean expression. The program is aborted with `message` if the condition evaluates to `false`.", + "arguments": [ + { + "name": "condition", + "description": "The condition to check.", + "required": true, + "type": [ + "boolean" + ] + }, + { + "name": "message", + "description": "An optional custom error message. If the equality assertion fails, `message` is\nappended to the default message prefix. See the [examples](#assert-examples) below\nfor a fully formed log message sample.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "internal_failure_reasons": [ + "`condition` evaluates to `false`." + ], + "examples": [ + { + "title": "Assertion (true) - with message", + "source": "assert!(\"foo\" == \"foo\", message: \"\\\"foo\\\" must be \\\"foo\\\"!\")", + "return": true + }, + { + "title": "Assertion (false) - with message", + "source": "assert!(\"foo\" == \"bar\", message: \"\\\"foo\\\" must be \\\"foo\\\"!\")", + "raises": "function call error for \"assert\" at (0:60): \"foo\" must be \"foo\"!" + }, + { + "title": "Assertion (false) - simple", + "source": "assert!(false)", + "raises": "function call error for \"assert\" at (0:14): assertion failed" + } + ], + "notices": [ + "The `assert` function should be used in a standalone fashion and only when you want\nto abort the program. You should avoid it in logical expressions and other situations\nin which you want the program to continue if the condition evaluates to `false`." + ], + "pure": false + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/assert_eq.cue b/website/cue/reference/remap/functions/assert_eq.cue index 97f172470122f..3e1762e277293 100644 --- a/website/cue/reference/remap/functions/assert_eq.cue +++ b/website/cue/reference/remap/functions/assert_eq.cue @@ -1,69 +1,64 @@ -package metadata - -remap: functions: assert_eq: { - category: "Debug" - - description: """ - Asserts that two expressions, `left` and `right`, have the same value. The program is - aborted with `message` if they do not have the same value. - """ - - notices: [ - """ - The `assert_eq` function should be used in a standalone fashion and only when you want to - abort the program. You should avoid it in logical expressions and other situations in which - you want the program to continue if the condition evaluates to `false`. - """, - ] - - pure: false - - arguments: [ - { - name: "left" - description: "The value to check for equality against `right`." - required: true - type: ["any"] - }, - { - name: "right" - description: "The value to check for equality against `left`." - required: true - type: ["any"] - }, - { - name: "message" - description: """ - An optional custom error message. If the equality assertion fails, `message` is - appended to the default message prefix. See the [examples](#assert_eq-examples) - below for a fully formed log message sample. - """ - required: false - type: ["string"] - }, - ] - - internal_failure_reasons: [] - - return: types: ["boolean"] - - examples: [ - { - title: "Successful assertion" - source: "assert_eq!(1, 1)" - return: true - }, - { - title: "Unsuccessful assertion" - source: "assert_eq!(127, [1, 2, 3])" - raises: runtime: #"function call error for "assert_eq" at (0:26): assertion failed: 127 == [1, 2, 3]"# - }, - { - title: "Unsuccessful assertion with custom log message" - source: #""" - assert_eq!(1, 0, message: "Unequal integers") - """# - raises: runtime: #"function call error for "assert_eq" at (1:46): Unequal integers"# - }, - ] -} +{ + "remap": { + "functions": { + "assert_eq": { + "anchor": "assert_eq", + "name": "assert_eq", + "category": "Debug", + "description": "Asserts that two expressions, `left` and `right`, have the same value. The program is aborted with `message` if they do not have the same value.", + "arguments": [ + { + "name": "left", + "description": "The value to check for equality against `right`.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "right", + "description": "The value to check for equality against `left`.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "message", + "description": "An optional custom error message. If the equality assertion fails, `message` is\nappended to the default message prefix. See the [examples](#assert_eq-examples)\nbelow for a fully formed log message sample.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Successful assertion", + "source": "assert_eq!(1, 1)", + "return": true + }, + { + "title": "Unsuccessful assertion", + "source": "assert_eq!(127, [1, 2, 3])", + "raises": "function call error for \"assert_eq\" at (0:26): assertion failed: 127 == [1, 2, 3]" + }, + { + "title": "Unsuccessful assertion with custom log message", + "source": "assert_eq!(1, 0, message: \"Unequal integers\")", + "raises": "function call error for \"assert_eq\" at (0:45): Unequal integers" + } + ], + "notices": [ + "The `assert_eq` function should be used in a standalone fashion and only when you want\nto abort the program. You should avoid it in logical expressions and other situations in\nwhich you want the program to continue if the condition evaluates to `false`." + ], + "pure": false + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/basename.cue b/website/cue/reference/remap/functions/basename.cue index 1d0c4d88eb315..ec2fa08ce954a 100644 --- a/website/cue/reference/remap/functions/basename.cue +++ b/website/cue/reference/remap/functions/basename.cue @@ -1,53 +1,54 @@ -package metadata - -remap: functions: basename: { - category: "String" - description: """ - Returns the filename component of the given `path`. This is similar to the Unix `basename` command. - If the path ends in a directory separator, the function returns the name of the directory. - """ - - arguments: [ - { - name: "value" - description: "The path from which to extract the basename." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid string.", - ] - return: types: ["string", "null"] - - examples: [ - { - title: "Extract basename from file path" - source: """ - basename!("/usr/local/bin/vrl") - """ - return: "vrl" - }, - { - title: "Extract basename from file path with extension" - source: """ - basename!("/home/user/file.txt") - """ - return: "file.txt" - }, - { - title: "Extract basename from directory path" - source: """ - basename!("/home/user/") - """ - return: "user" - }, - { - title: "Root directory has no basename" - source: """ - basename!("/") - """ - return: null - }, - ] -} +{ + "remap": { + "functions": { + "basename": { + "anchor": "basename", + "name": "basename", + "category": "String", + "description": "Returns the filename component of the given `path`. This is similar to the Unix `basename` command. If the path ends in a directory separator, the function returns the name of the directory.", + "arguments": [ + { + "name": "value", + "description": "The path from which to extract the basename.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string", + "null" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid string." + ], + "examples": [ + { + "title": "Extract basename from file path", + "source": "basename!(\"/usr/local/bin/vrl\")", + "return": "vrl" + }, + { + "title": "Extract basename from file path with extension", + "source": "basename!(\"/home/user/file.txt\")", + "return": "file.txt" + }, + { + "title": "Extract basename from directory path", + "source": "basename!(\"/home/user/\")", + "return": "user" + }, + { + "title": "Root directory has no basename", + "source": "basename!(\"/\")", + "return": null + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/bool.cue b/website/cue/reference/remap/functions/bool.cue index e7fa4398e5969..c779e843965ff 100644 --- a/website/cue/reference/remap/functions/bool.cue +++ b/website/cue/reference/remap/functions/bool.cue @@ -1,38 +1,52 @@ -package metadata - -remap: functions: bool: { - category: "Type" - description: """ - Returns `value` if it is a Boolean, otherwise returns an error. This enables the type checker to guarantee that the - returned value is a Boolean and can be used in any function that expects a Boolean. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is a Boolean." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not a Boolean.", - ] - return: { - types: ["boolean"] - rules: [ - #"Returns `value` if it's a Boolean."#, - #"Raises an error if not a Boolean."#, - ] - } - examples: [ - { - title: "Declare a Boolean type" - input: log: value: false - source: #""" - bool!(.value) - """# - return: input.log.value - }, - ] -} +{ + "remap": { + "functions": { + "bool": { + "anchor": "bool", + "name": "bool", + "category": "Type", + "description": "Returns `value` if it is a Boolean, otherwise returns an error. This enables the type\nchecker to guarantee that the returned value is a Boolean and can be used in any\nfunction that expects a Boolean.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a Boolean.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `value` if it's a Boolean.", + "Raises an error if not a Boolean." + ] + }, + "internal_failure_reasons": [ + "`value` is not a Boolean." + ], + "examples": [ + { + "title": "Valid Boolean", + "source": "bool(false)", + "return": false + }, + { + "title": "Invalid Boolean", + "source": "bool!(42)", + "raises": "function call error for \"bool\" at (0:9): expected boolean, got integer" + }, + { + "title": "Valid Boolean from path", + "source": ". = { \"value\": true }\nbool(.value)\n", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/camelcase.cue b/website/cue/reference/remap/functions/camelcase.cue index 9c8eb246ec617..1a7b10686530d 100644 --- a/website/cue/reference/remap/functions/camelcase.cue +++ b/website/cue/reference/remap/functions/camelcase.cue @@ -1,43 +1,60 @@ -package metadata - -remap: functions: camelcase: { - category: "String" - description: """ - Takes the `value` string, and turns it into camelCase. Optionally, you can - pass in the existing case of the function, or else an attempt is made to determine the case automatically. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to camelCase." - required: true - type: ["string"] - }, - { - name: "original_case" - description: "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case" - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "camelCase a string" - source: #""" - camelcase("input-string") - """# - return: "inputString" - }, - { - title: "camelCase a string" - source: #""" - camelcase("input-string", "kebab-case") - """# - return: "inputString" - }, - ] -} +{ + "remap": { + "functions": { + "camelcase": { + "anchor": "camelcase", + "name": "camelcase", + "category": "String", + "description": "Takes the `value` string, and turns it into camelCase. Optionally, you can pass in the existing case of the function, or else an attempt is made to determine the case automatically.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to camelCase.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "original_case", + "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", + "required": false, + "type": [ + "string" + ], + "enum": { + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)" + } + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "camelCase a string without specifying original case", + "source": "camelcase(\"input-string\")", + "return": "inputString" + }, + { + "title": "camelcase a snake_case string", + "source": "camelcase(\"foo_bar_baz\", \"snake_case\")", + "return": "fooBarBaz" + }, + { + "title": "camelcase specifying the wrong original case (noop)", + "source": "camelcase(\"foo_bar_baz\", \"kebab-case\")", + "return": "foo_bar_baz" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ceil.cue b/website/cue/reference/remap/functions/ceil.cue index 8b7175ed60dc7..e2a042f13a2dc 100644 --- a/website/cue/reference/remap/functions/ceil.cue +++ b/website/cue/reference/remap/functions/ceil.cue @@ -1,48 +1,59 @@ -package metadata - -remap: functions: ceil: { - category: "Number" - description: """ - Rounds the `value` up to the specified `precision`. - """ - - arguments: [ - { - name: "value" - description: "The number to round up." - required: true - type: ["integer", "float"] - }, - { - name: "precision" - description: "The number of decimal places to round to." - required: false - default: 0 - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer", "float"] - rules: [ - "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise.", - ] - } - - examples: [ - { - title: "Round a number up (without precision)" - source: #""" - ceil(4.345) - """# - return: 5.0 - }, - { - title: "Round a number up (with precision)" - source: #""" - ceil(4.345, precision: 2) - """# - return: 4.35 - }, - ] -} +{ + "remap": { + "functions": { + "ceil": { + "anchor": "ceil", + "name": "ceil", + "category": "Number", + "description": "Rounds the `value` up to the specified `precision`.", + "arguments": [ + { + "name": "value", + "description": "The number to round up.", + "required": true, + "type": [ + "integer", + "float" + ] + }, + { + "name": "precision", + "description": "The number of decimal places to round to.", + "required": false, + "type": [ + "integer" + ], + "default": "0" + } + ], + "return": { + "types": [ + "integer", + "float" + ], + "rules": [ + "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise." + ] + }, + "examples": [ + { + "title": "Round a number up (without precision)", + "source": "ceil(4.345)", + "return": 5.0 + }, + { + "title": "Round a number up (with precision)", + "source": "ceil(4.345, precision: 2)", + "return": 4.35 + }, + { + "title": "Round an integer up (noop)", + "source": "ceil(5)", + "return": 5 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/chunks.cue b/website/cue/reference/remap/functions/chunks.cue index 3ad4cf375badf..ed24a124214bf 100644 --- a/website/cue/reference/remap/functions/chunks.cue +++ b/website/cue/reference/remap/functions/chunks.cue @@ -1,50 +1,61 @@ -package metadata - -remap: functions: chunks: { - category: "Array" - description: """ - Chunks `value` into slices of length `chunk_size` bytes. - """ - - arguments: [ - { - name: "value" - description: "The array of bytes to split." - required: true - type: ["array", "string"] - }, - { - name: "chunk_size" - description: "The desired length of each chunk in bytes. This may be constrained by the host platform architecture." - required: true - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "`chunk_size` must be at least 1 byte.", - "`chunk_size` is too large.", - ] - return: { - types: ["array"] - rules: [ - "`chunks` is considered fallible if the supplied `chunk_size` is an expression, and infallible if it's a literal integer.", - ] - } - - examples: [ - { - title: "Split a string into chunks" - source: #""" - chunks("abcdefgh", 4) - """# - return: ["abcd", "efgh"] - }, - { - title: "Chunks do not respect unicode code point boundaries" - source: #""" - chunks("ab你好", 4) - """# - return: ["ab�", "�好"] - }, - ] -} +{ + "remap": { + "functions": { + "chunks": { + "anchor": "chunks", + "name": "chunks", + "category": "Array", + "description": "Chunks `value` into slices of length `chunk_size` bytes.", + "arguments": [ + { + "name": "value", + "description": "The array of bytes to split.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "chunk_size", + "description": "The desired length of each chunk in bytes. This may be constrained by the host platform architecture.", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "`chunks` is considered fallible if the supplied `chunk_size` is an expression, and infallible if it's a literal integer." + ] + }, + "internal_failure_reasons": [ + "`chunk_size` must be at least 1 byte.", + "`chunk_size` is too large." + ], + "examples": [ + { + "title": "Split a string into chunks", + "source": "chunks(\"abcdefgh\", 4)", + "return": [ + "abcd", + "efgh" + ] + }, + { + "title": "Chunks do not respect unicode code point boundaries", + "source": "chunks(\"ab你好\", 4)", + "return": [ + "ab�", + "�好" + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/community_id.cue b/website/cue/reference/remap/functions/community_id.cue index f03541319d158..e964a2ee9930a 100644 --- a/website/cue/reference/remap/functions/community_id.cue +++ b/website/cue/reference/remap/functions/community_id.cue @@ -1,59 +1,90 @@ -package metadata - -remap: functions: community_id: { - category: "String" - description: """ - Generates an ID based on the [Community ID Spec](\(urls.community_id_spec)). - """ - - arguments: [ - { - name: "source_ip" - description: "The source IP address." - required: true - type: ["string"] - }, - { - name: "destination_ip" - description: "The destination IP address." - required: true - type: ["string"] - }, - { - name: "protocol" - description: "The protocol number." - required: true - type: ["integer"] - }, - { - name: "source_port" - description: "The source port or ICMP type." - required: false - type: ["integer"] - }, - { - name: "destination_port" - description: "The destination port or ICMP code." - required: false - type: ["integer"] - }, - { - name: "seed" - description: "The custom seed number." - required: false - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "TCP" - source: #""" - community_id!(source_ip: "1.2.3.4", destination_ip: "5.6.7.8", source_port: 1122, destination_port: 3344, protocol: 6) - """# - return: "1:wCb3OG7yAFWelaUydu0D+125CLM=" - }, - ] -} +{ + "remap": { + "functions": { + "community_id": { + "anchor": "community_id", + "name": "community_id", + "category": "String", + "description": "Generates an ID based on the [Community ID Spec](https://github.com/corelight/community-id-spec).", + "arguments": [ + { + "name": "source_ip", + "description": "The source IP address.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "destination_ip", + "description": "The destination IP address.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "protocol", + "description": "The protocol number.", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "source_port", + "description": "The source port or ICMP type.", + "required": false, + "type": [ + "integer" + ] + }, + { + "name": "destination_port", + "description": "The destination port or ICMP code.", + "required": false, + "type": [ + "integer" + ] + }, + { + "name": "seed", + "description": "The custom seed number.", + "required": false, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Generate Community ID for TCP", + "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 1122, destination_port: 3344, protocol: 6)", + "return": "1:wCb3OG7yAFWelaUydu0D+125CLM=" + }, + { + "title": "Generate Community ID for UDP", + "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 1122, destination_port: 3344, protocol: 17)", + "return": "1:0Mu9InQx6z4ZiCZM/7HXi2WMhOg=" + }, + { + "title": "Generate Community ID for ICMP", + "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 8, destination_port: 0, protocol: 1)", + "return": "1:crodRHL2FEsHjbv3UkRrfbs4bZ0=" + }, + { + "title": "Generate Community ID for RSVP", + "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", protocol: 46)", + "return": "1:ikv3kmf89luf73WPz1jOs49S768=" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/compact.cue b/website/cue/reference/remap/functions/compact.cue index d64f0104064bd..66f8196da4847 100644 --- a/website/cue/reference/remap/functions/compact.cue +++ b/website/cue/reference/remap/functions/compact.cue @@ -1,83 +1,132 @@ -package metadata - -remap: functions: compact: { - category: "Enumerate" - description: """ - Compacts the `value` by removing empty values, where empty values are defined using the - available parameters. - """ - - arguments: [ - { - name: "value" - description: "The object or array to compact." - required: true - type: ["array", "object"] - }, - { - name: "recursive" - description: "Whether the compaction be recursive." - required: false - default: true - type: ["boolean"] - }, - { - name: "null" - description: "Whether null should be treated as an empty value." - required: false - default: true - type: ["boolean"] - }, - { - name: "string" - description: "Whether an empty string should be treated as an empty value." - required: false - default: true - type: ["boolean"] - }, - { - name: "object" - description: "Whether an empty object should be treated as an empty value." - required: false - default: true - type: ["boolean"] - }, - { - name: "array" - description: "Whether an empty array should be treated as an empty value." - required: false - default: true - type: ["boolean"] - }, - { - name: "nullish" - description: #"Tests whether the value is "nullish" as defined by the [`is_nullish`](#is_nullish) function."# - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array", "object"] - rules: [ - "The return type matches the `value` type.", - ] - } - examples: [ - { - title: "Compact an array" - source: #""" - compact(["foo", "bar", "", null, [], "buzz"], string: true, array: true, null: true) - """# - return: ["foo", "bar", "buzz"] - }, - { - title: "Compact an object" - source: #""" - compact({"field1": 1, "field2": "", "field3": [], "field4": null}, string: true, array: true, null: true) - """# - return: field1: 1 - }, - ] -} +{ + "remap": { + "functions": { + "compact": { + "anchor": "compact", + "name": "compact", + "category": "Enumerate", + "description": "Compacts the `value` by removing empty values, where empty values are defined using the available parameters.", + "arguments": [ + { + "name": "value", + "description": "The object or array to compact.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "recursive", + "description": "Whether the compaction be recursive.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "null", + "description": "Whether null should be treated as an empty value.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "string", + "description": "Whether an empty string should be treated as an empty value.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "object", + "description": "Whether an empty object should be treated as an empty value.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "array", + "description": "Whether an empty array should be treated as an empty value.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "nullish", + "description": "Tests whether the value is \"nullish\" as defined by the [`is_nullish`](#is_nullish) function.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object", + "array" + ], + "rules": [ + "The return type matches the `value` type." + ] + }, + "examples": [ + { + "title": "Compact an object with default parameters", + "source": "compact({\"field1\": 1, \"field2\": \"\", \"field3\": [], \"field4\": null})", + "return": { + "field1": 1 + } + }, + { + "title": "Compact an array with default parameters", + "source": "compact([\"foo\", \"bar\", \"\", null, [], \"buzz\"])", + "return": [ + "foo", + "bar", + "buzz" + ] + }, + { + "title": "Compact an array using nullish", + "source": "compact([\"-\", \" \", \"\\n\", null, true], nullish: true)", + "return": [ + true + ] + }, + { + "title": "Compact a complex object with default parameters", + "source": "compact({ \"a\": {}, \"b\": null, \"c\": [null], \"d\": \"\", \"e\": \"-\", \"f\": true })", + "return": { + "e": "-", + "f": true + } + }, + { + "title": "Compact a complex object using null: false", + "source": "compact({ \"a\": {}, \"b\": null, \"c\": [null], \"d\": \"\", \"e\": \"-\", \"f\": true }, null: false)", + "return": { + "b": null, + "c": [ + null + ], + "e": "-", + "f": true + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/contains.cue b/website/cue/reference/remap/functions/contains.cue index c12d36edb5df5..755d5ab52febf 100644 --- a/website/cue/reference/remap/functions/contains.cue +++ b/website/cue/reference/remap/functions/contains.cue @@ -1,49 +1,57 @@ -package metadata - -remap: functions: contains: { - category: "String" - description: """ - Determines whether the `value` string contains the specified `substring`. - """ - - arguments: [ - { - name: "value" - description: "The text to search." - required: true - type: ["string"] - }, - { - name: "substring" - description: "The substring to search for in `value`." - required: true - type: ["string"] - }, - { - name: "case_sensitive" - description: "Whether the match should be case sensitive." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "String contains (case sensitive)" - source: #""" - contains("The Needle In The Haystack", "Needle") - """# - return: true - }, - { - title: "String contains (case insensitive)" - source: #""" - contains("The Needle In The Haystack", "needle", case_sensitive: false) - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "contains": { + "anchor": "contains", + "name": "contains", + "category": "String", + "description": "Determines whether the `value` string contains the specified `substring`.", + "arguments": [ + { + "name": "value", + "description": "The text to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "substring", + "description": "The substring to search for in `value`.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "case_sensitive", + "description": "Whether the match should be case sensitive.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "String contains with default parameters (case sensitive)", + "source": "contains(\"banana\", \"AnA\")", + "return": false + }, + { + "title": "String contains (case insensitive)", + "source": "contains(\"banana\", \"AnA\", case_sensitive: false)", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/contains_all.cue b/website/cue/reference/remap/functions/contains_all.cue index dfd7cf07eeb78..0f371c867acfe 100644 --- a/website/cue/reference/remap/functions/contains_all.cue +++ b/website/cue/reference/remap/functions/contains_all.cue @@ -1,49 +1,61 @@ -package metadata - -remap: functions: contains_all: { - category: "String" - description: """ - Determines whether the `value` string contains all the specified `substrings`. - """ - - arguments: [ - { - name: "value" - description: "The text to search." - required: true - type: ["string"] - }, - { - name: "substrings" - description: "An array of substrings to search for in `value`." - required: true - type: ["array"] - }, - { - name: "case_sensitive" - description: "Whether the match should be case sensitive." - required: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "String contains all" - source: #""" - contains_all("The Needle In The Haystack", ["Needle", "Haystack"]) - """# - return: true - }, - { - title: "String contains all (case sensitive)" - source: #""" - contains_all("the NEEDLE in the haystack", ["needle", "haystack"]) - """# - return: false - }, - ] - -} +{ + "remap": { + "functions": { + "contains_all": { + "anchor": "contains_all", + "name": "contains_all", + "category": "String", + "description": "Determines whether the `value` string contains all the specified `substrings`.", + "arguments": [ + { + "name": "value", + "description": "The text to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "substrings", + "description": "An array of substrings to search for in `value`.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "case_sensitive", + "description": "Whether the match should be case sensitive.", + "required": false, + "type": [ + "boolean" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "String contains all with default parameters (case sensitive)", + "source": "contains_all(\"The NEEDLE in the Haystack\", [\"NEEDLE\", \"Haystack\"])", + "return": true + }, + { + "title": "String doesn't contain all with default parameters (case sensitive)", + "source": "contains_all(\"The NEEDLE in the Haystack\", [\"needle\", \"Haystack\"])", + "return": false + }, + { + "title": "String contains all (case insensitive)", + "source": "contains_all(\"The NEEDLE in the HaYsTaCk\", [\"nEeDlE\", \"haystack\"], case_sensitive: false)", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/crc.cue b/website/cue/reference/remap/functions/crc.cue index d42e6faf5fd70..79735b25c7c30 100644 --- a/website/cue/reference/remap/functions/crc.cue +++ b/website/cue/reference/remap/functions/crc.cue @@ -1,164 +1,167 @@ -package metadata - -remap: functions: crc: { - category: "Checksum" - description: """ - Calculates a CRC of the `value`. - The CRC `algorithm` used can be optionally specified. - - This function is infallible if either the default `algorithm` value or a recognized-valid compile-time - `algorithm` string literal is used. Otherwise, it is fallible. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the checksum for." - required: true - type: ["string"] - }, - { - name: "algorithm" - description: "The CRC algorithm to use." - enum: { - "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection" - "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol" - "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems" - "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol" - "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard" - "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard" - "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors" - "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols" - "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols" - "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication" - "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications" - "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication" - "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection" - "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol" - "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)" - "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard" - "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols" - "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard" - "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication" - "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)" - "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications" - "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications" - "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems" - "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard" - "CRC_8_I_CODE": "8-bit CRC used in I-CODE RFID systems" - "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks" - "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices" - "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol" - "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard" - "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol" - "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol" - "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol" - "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication" - "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard" - "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks" - "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers" - "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard" - "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications" - "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol" - "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)" - "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard" - "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards" - "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications" - "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)" - "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission" - "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication" - "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications" - "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication" - "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system" - "CRC_16_ARC": "16-bit CRC used in ARC (Adaptive Routing Code) communication" - "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard" - "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity" - "CRC_16_DDS_110": "16-bit CRC used in DDS (Digital Data Storage) standard" - "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication" - "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication" - "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities" - "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication" - "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol" - "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications" - "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks" - "CRC_16_IBM_SDLC": "16-bit CRC used in IBM SDLC (Synchronous Data Link Control)" - "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards" - "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol" - "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system" - "CRC_16_M17": "16-bit CRC used in M17 digital radio communication" - "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity" - "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems" - "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection" - "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard" - "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication" - "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication" - "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol" - "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication" - "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication" - "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard" - "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format" - "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication" - "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)" - "CRC_16_USB": "16-bit CRC used in USB communication for error detection" - "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol" - "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol" - "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication" - "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking" - "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol" - "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol" - "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol" - "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks" - "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks" - "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity" - "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection" - "CRC_30_CDMA": "30-bit CRC used in CDMA (Code Division Multiple Access) communication standard" - "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols" - "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)" - "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard" - "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding" - "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm" - "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems" - "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity" - "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)" - "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)" - "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection" - "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards" - "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection" - "CRC_32_XFER": "32-bit CRC used in data transfer protocols" - "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications" - "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard" - "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards" - "CRC_64_MS": "64-bit CRC variant used in Microsoft systems" - "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store" - "CRC_64_WE": "64-bit CRC variant for wide-area error detection" - "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification" - "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication" - } - required: false - default: "CRC_32_ISO_HDLC" - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a string.", - "`algorithm` is not a supported algorithm.", - ] - return: types: ["string"] - - examples: [ - { - title: "Create CRC checksum using the default algorithm" - source: #""" - crc("foo") - """# - return: "2356372769" - }, - { - title: "Create CRC checksum using the CRC_32_CKSUM algorithm" - source: #""" - crc("foo", algorithm: "CRC_32_CKSUM") - """# - return: "4271552933" - }, - ] -} +{ + "remap": { + "functions": { + "crc": { + "anchor": "crc", + "name": "crc", + "category": "Checksum", + "description": "Calculates a CRC of the `value`.The CRC `algorithm` used can be optionally specified.\n\nThis function is infallible if either the default `algorithm` value or a recognized-valid compile-time `algorithm` string literal is used. Otherwise, it is fallible.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the checksum for.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "algorithm", + "description": "The CRC algorithm to use.", + "required": false, + "type": [ + "string" + ], + "enum": { + "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", + "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", + "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", + "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", + "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard", + "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", + "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", + "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", + "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", + "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", + "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", + "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities", + "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", + "CRC_8_I_CODE": "8-bit CRC used in I-CODE RFID systems", + "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", + "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication", + "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication", + "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks", + "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", + "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", + "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards", + "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", + "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", + "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", + "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity", + "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", + "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", + "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks", + "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", + "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)", + "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", + "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards", + "CRC_32_XFER": "32-bit CRC used in data transfer protocols", + "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", + "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard", + "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", + "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", + "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", + "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", + "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format", + "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", + "CRC_16_ARC": "16-bit CRC used in ARC (Adaptive Routing Code) communication", + "CRC_16_USB": "16-bit CRC used in USB communication for error detection", + "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol", + "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", + "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)", + "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", + "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols", + "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems", + "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", + "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", + "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", + "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", + "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", + "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", + "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard", + "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication", + "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", + "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", + "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", + "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", + "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", + "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", + "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications", + "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", + "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", + "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", + "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", + "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", + "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", + "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", + "CRC_16_DDS_110": "16-bit CRC used in DDS (Digital Data Storage) standard", + "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", + "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", + "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity", + "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", + "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", + "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", + "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", + "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", + "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems", + "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications", + "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", + "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection", + "CRC_64_WE": "64-bit CRC variant for wide-area error detection", + "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications", + "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", + "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", + "CRC_16_IBM_SDLC": "16-bit CRC used in IBM SDLC (Synchronous Data Link Control)", + "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", + "CRC_30_CDMA": "30-bit CRC used in CDMA (Code Division Multiple Access) communication standard", + "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication", + "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", + "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", + "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", + "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", + "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol" + }, + "default": "CRC_32_ISO_HDLC" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is not a string.", + "`algorithm` is not a supported algorithm." + ], + "examples": [ + { + "title": "Create CRC checksum using the default algorithm", + "source": "crc(\"foo\")", + "return": "2356372769" + }, + { + "title": "Create CRC checksum using the CRC_32_CKSUM algorithm", + "source": "crc(\"foo\", algorithm: \"CRC_32_CKSUM\")", + "return": "4271552933" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_base16.cue b/website/cue/reference/remap/functions/decode_base16.cue index 12cb4d4959a9e..249199bf6e9f4 100644 --- a/website/cue/reference/remap/functions/decode_base16.cue +++ b/website/cue/reference/remap/functions/decode_base16.cue @@ -1,31 +1,43 @@ -package metadata - -remap: functions: decode_base16: { - category: "Codec" - description: """ - Decodes the `value` (a [Base16](\(urls.base16)) string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The [Base16](\(urls.base16)) data to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Base16 string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Base16 data" - source: """ - decode_base16!("796f752068617665207375636365737366756c6c79206465636f646564206d65") - """ - return: "you have successfully decoded me" - }, - ] -} +{ + "remap": { + "functions": { + "decode_base16": { + "anchor": "decode_base16", + "name": "decode_base16", + "category": "Codec", + "description": "Decodes the `value` (a [Base16](https://en.wikipedia.org/wiki/Hexadecimal) string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The [Base16](https://en.wikipedia.org/wiki/Hexadecimal) data to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Base16 string." + ], + "examples": [ + { + "title": "Decode Base16 data", + "source": "decode_base16!(\"736F6D6520737472696E672076616C7565\")", + "return": "some string value" + }, + { + "title": "Decode longer Base16 data", + "source": "decode_base16!(\"796f752068617665207375636365737366756c6c79206465636f646564206d65\")", + "return": "you have successfully decoded me" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_base64.cue b/website/cue/reference/remap/functions/decode_base64.cue index 1ba2efbef296c..723a6703fc6b1 100644 --- a/website/cue/reference/remap/functions/decode_base64.cue +++ b/website/cue/reference/remap/functions/decode_base64.cue @@ -1,49 +1,56 @@ -package metadata - -remap: functions: decode_base64: { - category: "Codec" - description: """ - Decodes the `value` (a [Base64](\(urls.base64)) string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The [Base64](\(urls.base64)) data to decode." - required: true - type: ["string"] - }, - { - name: "charset" - description: "The character set to use when decoding the data." - required: false - type: ["string"] - default: "standard" - enum: { - standard: "[Standard](\(urls.base64_standard)) Base64 format." - url_safe: "Modified Base64 for [URL variants](\(urls.base64_url_safe))." - } - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Base64 string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Base64 data (default)" - source: """ - decode_base64!("eW91IGhhdmUgc3VjY2Vzc2Z1bGx5IGRlY29kZWQgbWU=") - """ - return: "you have successfully decoded me" - }, - { - title: "Decode Base64 data (URL safe)" - source: """ - decode_base64!("eW91IGNhbid0IG1ha2UgeW91ciBoZWFydCBmZWVsIHNvbWV0aGluZyBpdCB3b24ndA==", charset: "url_safe") - """ - return: "you can't make your heart feel something it won't" - }, - ] -} +{ + "remap": { + "functions": { + "decode_base64": { + "anchor": "decode_base64", + "name": "decode_base64", + "category": "Codec", + "description": "Decodes the `value` (a [Base64](https://en.wikipedia.org/wiki/Base64) string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The [Base64](https://en.wikipedia.org/wiki/Base64) data to decode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "charset", + "description": "The character set to use when decoding the data.", + "required": false, + "type": [ + "string" + ], + "enum": { + "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications).", + "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format." + }, + "default": "standard" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Base64 string." + ], + "examples": [ + { + "title": "Decode Base64 data (default)", + "source": "decode_base64!(\"eW91IGhhdmUgc3VjY2Vzc2Z1bGx5IGRlY29kZWQgbWU=\")", + "return": "you have successfully decoded me" + }, + { + "title": "Decode Base64 data (URL safe)", + "source": "decode_base64!(\"eW91IGNhbid0IG1ha2UgeW91ciBoZWFydCBmZWVsIHNvbWV0aGluZyBpdCB3b24ndA==\", charset: \"url_safe\")", + "return": "you can't make your heart feel something it won't" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_charset.cue b/website/cue/reference/remap/functions/decode_charset.cue index 8d1d35fc90510..e1fb19ffbd220 100644 --- a/website/cue/reference/remap/functions/decode_charset.cue +++ b/website/cue/reference/remap/functions/decode_charset.cue @@ -1,52 +1,56 @@ -package metadata - -remap: functions: decode_charset: { - category: "Codec" - description: """ - Decodes the `value` (a non-UTF8 string) to a UTF8 string using the specified [character set](\(urls.charset_standard)). - """ - - arguments: [ - { - name: "value" - description: "The non-UTF8 string to decode." - required: true - type: ["string"] - }, - { - name: "from_charset" - description: "The [character set](\(urls.charset_standard)) to use when decoding the data." - required: true - type: ["string"] - - }, - ] - internal_failure_reasons: [ - "`from_charset` isn't a valid [character set](\(urls.charset_standard)).", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode EUC-KR string" - source: """ - decode_charset!(decode_base64!("vsiz58fPvLy/5A=="), "euc-kr") - """ - return: "안녕하세요" - }, - { - title: "Decode EUC-JP string" - source: """ - decode_charset!(decode_base64!("pLOk86TLpMGkzw=="), "euc-jp") - """ - return: "こんにちは" - }, - { - title: "Decode GB2312 string" - source: """ - decode_charset!(decode_base64!("xOO6ww=="), "gb2312") - """ - return: "你好" - }, - ] -} +{ + "remap": { + "functions": { + "decode_charset": { + "anchor": "decode_charset", + "name": "decode_charset", + "category": "Codec", + "description": "Decodes the `value` (a non-UTF8 string) to a UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", + "arguments": [ + { + "name": "value", + "description": "The non-UTF8 string to decode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "from_charset", + "description": "The [character set](https://encoding.spec.whatwg.org/#names-and-labels) to use when decoding the data.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`from_charset` isn't a valid [character set](https://encoding.spec.whatwg.org/#names-and-labels)." + ], + "examples": [ + { + "title": "Decode EUC-KR string", + "source": "decode_charset!(decode_base64!(\"vsiz58fPvLy/5A==\"), \"euc-kr\")", + "return": "안녕하세요" + }, + { + "title": "Decode EUC-JP string", + "source": "decode_charset!(decode_base64!(\"pLOk86TLpMGkzw==\"), \"euc-jp\")", + "return": "こんにちは" + }, + { + "title": "Decode GB2312 string", + "source": "decode_charset!(decode_base64!(\"xOO6ww==\"), \"gb2312\")", + "return": "你好" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_gzip.cue b/website/cue/reference/remap/functions/decode_gzip.cue index 099a3e53a0400..0d695ff8a930c 100644 --- a/website/cue/reference/remap/functions/decode_gzip.cue +++ b/website/cue/reference/remap/functions/decode_gzip.cue @@ -1,32 +1,38 @@ -package metadata - -remap: functions: decode_gzip: { - category: "Codec" - description: """ - Decodes the `value` (a [Gzip](\(urls.gzip)) string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The [Gzip](\(urls.gzip)) data to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Gzip string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Gzip data" - source: #""" - encoded_text = decode_base64!("H4sIAHEAymMAA6vML1XISCxLVSguTU5OLS5OK83JqVRISU3OT0lNUchNBQD7BGDaIAAAAA==") - decode_gzip!(encoded_text) - """# - return: "you have successfully decoded me" - }, - ] -} +{ + "remap": { + "functions": { + "decode_gzip": { + "anchor": "decode_gzip", + "name": "decode_gzip", + "category": "Codec", + "description": "Decodes the `value` (a [Gzip](https://www.gzip.org/) string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The [Gzip](https://www.gzip.org/) data to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Gzip string." + ], + "examples": [ + { + "title": "Decode Gzip data", + "source": "decode_gzip!(decode_base64!(\"H4sIAB8BymMAAyvISU0sTlVISU3OT0lVyE0FAJsZ870QAAAA\"))", + "return": "please decode me" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_lz4.cue b/website/cue/reference/remap/functions/decode_lz4.cue index a77cd38f0ffb6..37bae74042685 100644 --- a/website/cue/reference/remap/functions/decode_lz4.cue +++ b/website/cue/reference/remap/functions/decode_lz4.cue @@ -1,59 +1,64 @@ -package metadata - -remap: functions: decode_lz4: { - category: "Codec" - description: """ - Decodes the `value` (an lz4 string) into its original string. `buf_size` is the size of the buffer to decode into, this must be equal to or larger than the uncompressed size. - If `prepended_size` is set to `true`, it expects the original uncompressed size to be prepended to the compressed data. - `prepended_size` is useful for some implementations of lz4 that require the original size to be known before decoding. - """ - - arguments: [ - { - name: "value" - description: "The lz4 block data to decode." - required: true - type: ["string"] - }, - { - name: "buf_size" - description: "The size of the buffer to decode into, this must be equal to or larger than the uncompressed size." - required: false - default: 1024 * 1024 // 1 MiB - type: ["integer"] - }, - { - name: "prepended_size" - description: "Some implementations of lz4 require the original uncompressed size to be prepended to the compressed data." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - "`value` unable to decode value with lz4 frame decoder.", - "`value` unable to decode value with lz4 block decoder.", - "`value` unable to decode because the output is too large for the buffer.", - "`value` unable to decode because the prepended size is not a valid integer.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Lz4 data with prepended size." - source: #""" - encoded_text = decode_base64!("LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=") - decode_lz4!(encoded_text, prepended_size: true) - """# - return: "The quick brown fox jumps over 13 lazy dogs." - }, - { - title: "Decode Lz4 data without prepended size." - source: #""" - encoded_text = decode_base64!("8B1UaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==") - decode_lz4!(encoded_text) - """# - return: "The quick brown fox jumps over 13 lazy dogs." - }, - ] -} +{ + "remap": { + "functions": { + "decode_lz4": { + "anchor": "decode_lz4", + "name": "decode_lz4", + "category": "Codec", + "description": "Decodes the `value` (an lz4 string) into its original string. `buf_size` is the size of the buffer to decode into, this must be equal to or larger than the uncompressed size.\n If `prepended_size` is set to `true`, it expects the original uncompressed size to be prepended to the compressed data.\n `prepended_size` is useful for some implementations of lz4 that require the original size to be known before decoding.", + "arguments": [ + { + "name": "value", + "description": "The lz4 block data to decode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "buf_size", + "description": "The size of the buffer to decode into, this must be equal to or larger than the uncompressed size.", + "required": false, + "type": [ + "integer" + ], + "default": "1000000" + }, + { + "name": "prepended_size", + "description": "Some implementations of lz4 require the original uncompressed size to be prepended to the compressed data.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` unable to decode value with lz4 frame decoder.", + "`value` unable to decode value with lz4 block decoder.", + "`value` unable to decode because the output is too large for the buffer.", + "`value` unable to decode because the prepended size is not a valid integer." + ], + "examples": [ + { + "title": "LZ4 block with prepended size", + "source": "decode_lz4!(decode_base64!(\"LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=\"), prepended_size: true)", + "return": "The quick brown fox jumps over 13 lazy dogs." + }, + { + "title": "Decode Lz4 data without prepended size.", + "source": "decode_lz4!(decode_base64!(\"BCJNGGBAgiwAAIBUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLgAAAAA=\"))", + "return": "The quick brown fox jumps over 13 lazy dogs." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_mime_q.cue b/website/cue/reference/remap/functions/decode_mime_q.cue index 31b725df90f1c..5612ffd7a6c7a 100644 --- a/website/cue/reference/remap/functions/decode_mime_q.cue +++ b/website/cue/reference/remap/functions/decode_mime_q.cue @@ -1,45 +1,48 @@ -package metadata - -remap: functions: decode_mime_q: { - category: "Codec" - description: """ - Replaces q-encoded or base64-encoded [encoded-word](\(urls.encoded_word)) substrings in the `value` with their original string. - """ - - arguments: [ - { - name: "value" - description: "The string with [encoded-words](\(urls.encoded_word)) to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` has invalid encoded [encoded-word](\(urls.encoded_word)) string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode single encoded-word" - source: """ - decode_mime_q!("=?utf-8?b?SGVsbG8sIFdvcmxkIQ==?=") - """ - return: "Hello, World!" - }, - { - title: "Embedded" - source: """ - decode_mime_q!("From: =?utf-8?b?SGVsbG8sIFdvcmxkIQ==?= <=?utf-8?q?hello=5Fworld=40example=2ecom?=>") - """ - return: "From: Hello, World! " - }, - { - title: "Without charset" - source: """ - decode_mime_q!("?b?SGVsbG8sIFdvcmxkIQ==") - """ - return: "Hello, World!" - }, - ] -} +{ + "remap": { + "functions": { + "decode_mime_q": { + "anchor": "decode_mime_q", + "name": "decode_mime_q", + "category": "Codec", + "description": "Replaces q-encoded or base64-encoded [encoded-word](https://datatracker.ietf.org/doc/html/rfc2047#section-2) substrings in the `value` with their original string.", + "arguments": [ + { + "name": "value", + "description": "The string with [encoded-words](https://datatracker.ietf.org/doc/html/rfc2047#section-2) to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` has invalid encoded [encoded-word](https://datatracker.ietf.org/doc/html/rfc2047#section-2) string." + ], + "examples": [ + { + "title": "Decode single encoded-word", + "source": "decode_mime_q!(\"=?utf-8?b?SGVsbG8sIFdvcmxkIQ==?=\")", + "return": "Hello, World!" + }, + { + "title": "Embedded", + "source": "decode_mime_q!(\"From: =?utf-8?b?SGVsbG8sIFdvcmxkIQ==?= <=?utf-8?q?hello=5Fworld=40example=2ecom?=>\")", + "return": "From: Hello, World! " + }, + { + "title": "Without charset", + "source": "decode_mime_q!(\"?b?SGVsbG8sIFdvcmxkIQ==\")", + "return": "Hello, World!" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_percent.cue b/website/cue/reference/remap/functions/decode_percent.cue index 9c355792e1676..bd4c5d42102db 100644 --- a/website/cue/reference/remap/functions/decode_percent.cue +++ b/website/cue/reference/remap/functions/decode_percent.cue @@ -1,29 +1,35 @@ -package metadata - -remap: functions: decode_percent: { - category: "Codec" - description: """ - Decodes a [percent-encoded](\(urls.percent_encoded_bytes)) `value` like a URL. - """ - - arguments: [ - { - name: "value" - description: "The string to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Percent decode a value" - source: """ - decode_percent("foo%20bar%3F") - """ - return: "foo bar?" - }, - ] -} +{ + "remap": { + "functions": { + "decode_percent": { + "anchor": "decode_percent", + "name": "decode_percent", + "category": "Codec", + "description": "Decodes a [percent-encoded](https://url.spec.whatwg.org/#percent-encoded-bytes) `value` like a URL.", + "arguments": [ + { + "name": "value", + "description": "The string to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Percent decode a value", + "source": "decode_percent(\"foo%20bar%3F\")", + "return": "foo bar?" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_punycode.cue b/website/cue/reference/remap/functions/decode_punycode.cue index 89491b4971877..16bae236824ce 100644 --- a/website/cue/reference/remap/functions/decode_punycode.cue +++ b/website/cue/reference/remap/functions/decode_punycode.cue @@ -1,52 +1,57 @@ -package metadata - -remap: functions: decode_punycode: { - category: "Codec" - description: """ - Decodes a [punycode](\(urls.punycode)) encoded `value`, such as an internationalized domain name ([IDN](\(urls.idn))). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it. - """ - - arguments: [ - { - name: "value" - description: "The string to decode." - required: true - type: ["string"] - }, - { - name: "validate" - description: "If enabled, checks if the input string is a valid domain name." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [ - "`value` is not valid `punycode`", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode a punycode encoded internationalized domain name" - source: """ - decode_punycode!("www.xn--caf-dma.com") - """ - return: "www.café.com" - }, - { - title: "Decode an ASCII only string" - source: """ - decode_punycode!("www.cafe.com") - """ - return: "www.cafe.com" - }, - { - title: "Ignore validation" - source: """ - decode_punycode!("xn--8hbb.xn--fiba.xn--8hbf.xn--eib.", validate: false) - """ - return: "١٠.٦٦.٣٠.٥." - }, - ] -} +{ + "remap": { + "functions": { + "decode_punycode": { + "anchor": "decode_punycode", + "name": "decode_punycode", + "category": "Codec", + "description": "Decodes a [punycode](https://en.wikipedia.org/wiki/Punycode) encoded `value`, such as an internationalized domain name ([IDN](https://en.wikipedia.org/wiki/Internationalized_domain_name)). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it.", + "arguments": [ + { + "name": "value", + "description": "The string to decode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "validate", + "description": "If enabled, checks if the input string is a valid domain name.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is not valid `punycode`" + ], + "examples": [ + { + "title": "Decode a punycode encoded internationalized domain name", + "source": "decode_punycode!(\"www.xn--caf-dma.com\")", + "return": "www.café.com" + }, + { + "title": "Decode an ASCII only string", + "source": "decode_punycode!(\"www.cafe.com\")", + "return": "www.cafe.com" + }, + { + "title": "Ignore validation", + "source": "decode_punycode!(\"xn--8hbb.xn--fiba.xn--8hbf.xn--eib.\", validate: false)", + "return": "١٠.٦٦.٣٠.٥." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_snappy.cue b/website/cue/reference/remap/functions/decode_snappy.cue index 473613297267e..471b921aade6a 100644 --- a/website/cue/reference/remap/functions/decode_snappy.cue +++ b/website/cue/reference/remap/functions/decode_snappy.cue @@ -1,32 +1,38 @@ -package metadata - -remap: functions: decode_snappy: { - category: "Codec" - description: """ - Decodes the `value` (a Snappy string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The Snappy data to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Snappy string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Snappy data" - source: #""" - encoded_text = decode_base64!("LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==") - decode_snappy!(encoded_text) - """# - return: "The quick brown fox jumps over 13 lazy dogs." - }, - ] -} +{ + "remap": { + "functions": { + "decode_snappy": { + "anchor": "decode_snappy", + "name": "decode_snappy", + "category": "Codec", + "description": "Decodes the `value` (a Snappy string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The Snappy data to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Snappy string." + ], + "examples": [ + { + "title": "Decode Snappy data", + "source": "decode_snappy!(decode_base64!(\"LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==\"))", + "return": "The quick brown fox jumps over 13 lazy dogs." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_zlib.cue b/website/cue/reference/remap/functions/decode_zlib.cue index 2fe4f4aa5a1d7..6936da70306cb 100644 --- a/website/cue/reference/remap/functions/decode_zlib.cue +++ b/website/cue/reference/remap/functions/decode_zlib.cue @@ -1,32 +1,38 @@ -package metadata - -remap: functions: decode_zlib: { - category: "Codec" - description: """ - Decodes the `value` (a [Zlib](\(urls.zlib)) string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The [Zlib](\(urls.zlib)) data to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Zlib string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Zlib data" - source: #""" - encoded_text = decode_base64!("eJwNy4ENwCAIBMCNXIlQ/KqplUSgCdvXAS41qPMHshCB2R1zJlWIVlR6UURX2+wx2YcuK3kAb9C1wd6dn7Fa+QH9gRxr") - decode_zlib!(encoded_text) - """# - return: "you_have_successfully_decoded_me.congratulations.you_are_breathtaking." - }, - ] -} +{ + "remap": { + "functions": { + "decode_zlib": { + "anchor": "decode_zlib", + "name": "decode_zlib", + "category": "Codec", + "description": "Decodes the `value` (a [Zlib](https://www.zlib.net) string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The [Zlib](https://www.zlib.net) data to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Zlib string." + ], + "examples": [ + { + "title": "Decode Zlib data", + "source": "decode_zlib!(decode_base64!(\"eJxLzUvOT0mNz00FABI5A6A=\"))", + "return": "encode_me" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decode_zstd.cue b/website/cue/reference/remap/functions/decode_zstd.cue index 8b20e55e81337..a9fce0bf20ea4 100644 --- a/website/cue/reference/remap/functions/decode_zstd.cue +++ b/website/cue/reference/remap/functions/decode_zstd.cue @@ -1,32 +1,38 @@ -package metadata - -remap: functions: decode_zstd: { - category: "Codec" - description: """ - Decodes the `value` (a [Zstandard](\(urls.zstd)) string) into its original string. - """ - - arguments: [ - { - name: "value" - description: "The [Zstandard](\(urls.zstd)) data to decode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid encoded Zstd string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decode Zstd data" - source: #""" - encoded_text = decode_base64!("KLUv/QBY/QEAYsQOFKClbQBedqXsb96EWDax/f/F/z+gNU4ZTInaUeAj82KqPFjUzKqhcfDqAIsLvAsnY1bI/N2mHzDixRQA") - decode_zstd!(encoded_text) - """# - return: "you_have_successfully_decoded_me.congratulations.you_are_breathtaking." - }, - ] -} +{ + "remap": { + "functions": { + "decode_zstd": { + "anchor": "decode_zstd", + "name": "decode_zstd", + "category": "Codec", + "description": "Decodes the `value` (a [Zstandard](https://facebook.github.io/zstd) string) into its original string.", + "arguments": [ + { + "name": "value", + "description": "The [Zstandard](https://facebook.github.io/zstd) data to decode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid encoded Zstd string." + ], + "examples": [ + { + "title": "Decode Zstd data", + "source": "decode_zstd!(decode_base64!(\"KLUv/QBY/QEAYsQOFKClbQBedqXsb96EWDax/f/F/z+gNU4ZTInaUeAj82KqPFjUzKqhcfDqAIsLvAsnY1bI/N2mHzDixRQA\"))", + "return": "you_have_successfully_decoded_me.congratulations.you_are_breathtaking." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decrypt.cue b/website/cue/reference/remap/functions/decrypt.cue index 2f53615d721ee..cffd38c8cf420 100644 --- a/website/cue/reference/remap/functions/decrypt.cue +++ b/website/cue/reference/remap/functions/decrypt.cue @@ -1,93 +1,69 @@ -package metadata - -remap: functions: decrypt: { - category: "Cryptography" - description: """ - Decrypts a string with a symmetric encryption algorithm. - - Supported Algorithms: - - * AES-256-CFB (key = 32 bytes, iv = 16 bytes) - * AES-192-CFB (key = 24 bytes, iv = 16 bytes) - * AES-128-CFB (key = 16 bytes, iv = 16 bytes) - * AES-256-OFB (key = 32 bytes, iv = 16 bytes) - * AES-192-OFB (key = 24 bytes, iv = 16 bytes) - * AES-128-OFB (key = 16 bytes, iv = 16 bytes) - * AES-128-SIV (key = 32 bytes, iv = 16 bytes) - * AES-256-SIV (key = 64 bytes, iv = 16 bytes) - * Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes) - * Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes) - * Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes) - * AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes) - * AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes) - * AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes) - * AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes) - * AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes) - * AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes) - * CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes) - * XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes) - * XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes) - """ - - arguments: [ - { - name: "ciphertext" - description: "The string in raw bytes (not encoded) to decrypt." - required: true - type: ["string"] - }, - { - name: "algorithm" - description: "The algorithm to use." - required: true - type: ["string"] - }, - { - name: "key" - description: "The key in raw bytes (not encoded) for decryption. The length must match the algorithm requested." - required: true - type: ["string"] - }, - { - name: "iv" - description: #""" - The IV in raw bytes (not encoded) for decryption. The length must match the algorithm requested. - A new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value. - The value should match the one used during encryption. - """# - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`algorithm` is not a supported algorithm.", - "`key` length does not match the key size required for the algorithm specified.", - "`iv` length does not match the `iv` size required for the algorithm specified.", - ] - return: types: ["string"] - - examples: [ - { - title: "Decrypt value" - source: #""" - ciphertext = decode_base64!("5fLGcu1VHdzsPcGNDio7asLqE1P43QrVfPfmP4i4zOU=") - iv = decode_base64!("fVEIRkIiczCRWNxaarsyxA==") - key = "16_byte_keyxxxxx" - decrypt!(ciphertext, "AES-128-CBC-PKCS7", key, iv: iv) - """# - return: "super_secret_message" - }, - ] -} +{ + "remap": { + "functions": { + "decrypt": { + "anchor": "decrypt", + "name": "decrypt", + "category": "Cryptography", + "description": "Decrypts a string with a symmetric encryption algorithm.\n\nSupported Algorithms:\n\n* AES-256-CFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-CFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-CFB (key = 16 bytes, iv = 16 bytes)\n* AES-256-OFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-OFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-OFB (key = 16 bytes, iv = 16 bytes)\n* AES-128-SIV (key = 32 bytes, iv = 16 bytes)\n* AES-256-SIV (key = 64 bytes, iv = 16 bytes)\n* Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes)\n* Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes)\n* Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes)\n* CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes)\n* XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes)\n* XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes)", + "arguments": [ + { + "name": "ciphertext", + "description": "The string in raw bytes (not encoded) to decrypt.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "algorithm", + "description": "The algorithm to use.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key", + "description": "The key in raw bytes (not encoded) for decryption. The length must match the algorithm requested.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "iv", + "description": "The IV in raw bytes (not encoded) for decryption. The length must match the algorithm requested.\nA new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value.\nThe value should match the one used during encryption.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`algorithm` is not a supported algorithm.", + "`key` length does not match the key size required for the algorithm specified.", + "`iv` length does not match the `iv` size required for the algorithm specified." + ], + "examples": [ + { + "title": "Decrypt value using AES-256-CFB", + "source": "iv = \"0123456789012345\"\nkey = \"01234567890123456789012345678912\"\nciphertext = decode_base64!(\"c/dIOA==\")\ndecrypt!(ciphertext, \"AES-256-CFB\", key: key, iv: iv)\n", + "return": "data" + }, + { + "title": "Decrypt value using AES-128-CBC-PKCS7", + "source": "iv = decode_base64!(\"fVEIRkIiczCRWNxaarsyxA==\")\nkey = \"16_byte_keyxxxxx\"\nciphertext = decode_base64!(\"5fLGcu1VHdzsPcGNDio7asLqE1P43QrVfPfmP4i4zOU=\")\ndecrypt!(ciphertext, \"AES-128-CBC-PKCS7\", key: key, iv: iv)\n", + "return": "super_secret_message" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/decrypt_ip.cue b/website/cue/reference/remap/functions/decrypt_ip.cue index 8bc782c68c7ef..567dfe827636d 100644 --- a/website/cue/reference/remap/functions/decrypt_ip.cue +++ b/website/cue/reference/remap/functions/decrypt_ip.cue @@ -1,93 +1,79 @@ -package metadata - -remap: functions: decrypt_ip: { - category: "IP" - description: """ - Decrypts an IP address that was previously encrypted, restoring the original IP address. - - Supported Modes: - - * AES128 - Decrypts an IP address that was scrambled using AES-128 encryption. Can transform between IPv4 and IPv6. - * PFX (Prefix-preserving) - Decrypts an IP address that was encrypted with prefix-preserving mode, where network hierarchy was maintained. - """ - notices: [ - """ - The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt specification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. This function reverses the encryption performed by `encrypt_ip` - the same key and algorithm that were used for encryption must be used for decryption. - """, - ] - - arguments: [ - { - name: "ip" - description: "The encrypted IP address to decrypt (v4 or v6)." - required: true - type: ["string"] - }, - { - name: "key" - description: "The decryption key in raw bytes (not encoded). Must be the same key that was used for encryption. For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes." - required: true - type: ["string"] - }, - { - name: "mode" - description: "The decryption mode to use. Must match the mode used for encryption: either `aes128` or `pfx`." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`ip` is not a valid IP address.", - "`mode` is not a supported mode (must be `aes128` or `pfx`).", - "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`).", - ] - return: types: ["string"] - - examples: [ - { - title: "Decrypt IPv4 address with AES128" - source: #""" - decrypted_ip = decrypt_ip!("72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0", "sixteen byte key", "aes128") - decrypted_ip - """# - return: "192.168.1.1" - }, - { - title: "Decrypt IPv6 address with AES128" - source: #""" - decrypted_ip = decrypt_ip!("c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a", "sixteen byte key", "aes128") - decrypted_ip - """# - return: "2001:db8::1" - }, - { - title: "Decrypt IPv4 address with prefix-preserving mode" - source: #""" - decrypted_ip = decrypt_ip!("33.245.248.61", "thirty-two bytes key for pfx use", "pfx") - decrypted_ip - """# - return: "192.168.1.1" - }, - { - title: "Decrypt IPv6 address with prefix-preserving mode" - source: #""" - decrypted_ip = decrypt_ip!("88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9", "thirty-two bytes key for ipv6pfx", "pfx") - decrypted_ip - """# - return: "2001:db8::1" - }, - { - title: "Round-trip encryption and decryption" - source: #""" - original_ip = "192.168.1.100" - key = "sixteen byte key" - - encrypted = encrypt_ip!(original_ip, key, "aes128") - decrypted = decrypt_ip!(encrypted, key, "aes128") - - decrypted == original_ip - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "decrypt_ip": { + "anchor": "decrypt_ip", + "name": "decrypt_ip", + "category": "IP", + "description": "Decrypts an IP address that was previously encrypted, restoring the original IP address.\n\nSupported Modes:\n\n* AES128 - Decrypts an IP address that was scrambled using AES-128 encryption. Can transform between IPv4 and IPv6.\n* PFX (Prefix-preserving) - Decrypts an IP address that was encrypted with prefix-preserving mode, where network hierarchy was maintained.", + "arguments": [ + { + "name": "ip", + "description": "The encrypted IP address to decrypt (v4 or v6).", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key", + "description": "The decryption key in raw bytes (not encoded). Must be the same key that was used for encryption. For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "mode", + "description": "The decryption mode to use. Must match the mode used for encryption: either `aes128` or `pfx`.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`ip` is not a valid IP address.", + "`mode` is not a supported mode (must be `aes128` or `pfx`).", + "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`)." + ], + "examples": [ + { + "title": "Decrypt IPv4 address with AES128", + "source": "decrypt_ip!(\"72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0\", \"sixteen byte key\", \"aes128\")", + "return": "192.168.1.1" + }, + { + "title": "Decrypt IPv6 address with AES128", + "source": "decrypt_ip!(\"c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a\", \"sixteen byte key\", \"aes128\")", + "return": "2001:db8::1" + }, + { + "title": "Decrypt IPv4 address with prefix-preserving mode", + "source": "decrypt_ip!(\"33.245.248.61\", \"thirty-two bytes key for pfx use\", \"pfx\")", + "return": "192.168.1.1" + }, + { + "title": "Decrypt IPv6 address with prefix-preserving mode", + "source": "decrypt_ip!(\"88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9\", \"thirty-two bytes key for ipv6pfx\", \"pfx\")", + "return": "2001:db8::1" + }, + { + "title": "Round-trip encryption and decryption", + "source": "original_ip = \"192.168.1.100\"\nkey = \"sixteen byte key\"\nmode = \"aes128\"\n\nencrypted = encrypt_ip!(original_ip, key, mode)\ndecrypt_ip!(encrypted, key, mode)\n", + "return": "192.168.1.100" + } + ], + "notices": [ + "The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt\nspecification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. This\nfunction reverses the encryption performed by `encrypt_ip` - the same key and algorithm\nthat were used for encryption must be used for decryption." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/del.cue b/website/cue/reference/remap/functions/del.cue index 5a825aa6e40f7..c15f26f307393 100644 --- a/website/cue/reference/remap/functions/del.cue +++ b/website/cue/reference/remap/functions/del.cue @@ -1,62 +1,91 @@ -package metadata - -remap: functions: del: { - category: "Path" - description: """ - Removes the field specified by the static `path` from the target. - - For dynamic path deletion, see the `remove` function. - """ - - pure: false - - arguments: [ - { - name: "path" - description: "The path of the field to delete." - required: true - type: ["path"] - }, - { - name: "compact" - description: """ - After deletion, if `compact` is `true` and there is an empty object or array left, - the empty object or array is also removed, cascading up to the root. This only - applies to the path being deleted, and any parent paths. - """ - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - notices: [ - """ - The `del` function _modifies the current event in place_ and returns the value of the deleted field. - """, - ] - return: { - types: ["any", "null"] - rules: [ - "Returns the value of the field being deleted. Returns `null` if the field doesn't exist.", - ] - } - - examples: [ - { - title: "Delete a field" - input: log: { - field1: 1 - field2: 2 - } - source: "del(.field1)" - output: log: field2: 2 - }, - { - title: "Rename a field" - input: log: old_field: "please rename me" - source: ".new_field = del(.old_field)" - output: log: new_field: "please rename me" - }, - ] -} +{ + "remap": { + "functions": { + "del": { + "anchor": "del", + "name": "del", + "category": "Path", + "description": "Removes the field specified by the static `path` from the target.\n\nFor dynamic path deletion, see the `remove` function.", + "arguments": [ + { + "name": "target", + "description": "The path of the field to delete", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "compact", + "description": "After deletion, if `compact` is `true` and there is an empty object or array left,\nthe empty object or array is also removed, cascading up to the root. This only\napplies to the path being deleted, and any parent paths.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "any" + ], + "rules": [ + "Returns the value of the field being deleted. Returns `null` if the field doesn't exist." + ] + }, + "examples": [ + { + "title": "Delete a field", + "source": ". = { \"foo\": \"bar\" }\ndel(.foo)\n", + "return": "bar" + }, + { + "title": "Rename a field", + "source": ". = { \"old\": \"foo\" }\n.new = del(.old)\n.\n", + "return": { + "new": "foo" + } + }, + { + "title": "Returns null for unknown field", + "source": "del({\"foo\": \"bar\"}.baz)", + "return": null + }, + { + "title": "External target", + "source": ". = { \"foo\": true, \"bar\": 10 }\ndel(.foo)\n.\n", + "return": { + "bar": 10 + } + }, + { + "title": "Delete field from variable", + "source": "var = { \"foo\": true, \"bar\": 10 }\ndel(var.foo)\nvar\n", + "return": { + "bar": 10 + } + }, + { + "title": "Delete object field", + "source": "var = { \"foo\": {\"nested\": true}, \"bar\": 10 }\ndel(var.foo.nested, false)\nvar\n", + "return": { + "bar": 10, + "foo": {} + } + }, + { + "title": "Compact object field", + "source": "var = { \"foo\": {\"nested\": true}, \"bar\": 10 }\ndel(var.foo.nested, true)\nvar\n", + "return": { + "bar": 10 + } + } + ], + "notices": [ + "The `del` function _modifies the current event in place_ and returns the value of the deleted field." + ], + "pure": false + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/dirname.cue b/website/cue/reference/remap/functions/dirname.cue index a8bac71de6c84..922a796ae3ac3 100644 --- a/website/cue/reference/remap/functions/dirname.cue +++ b/website/cue/reference/remap/functions/dirname.cue @@ -1,60 +1,58 @@ -package metadata - -remap: functions: dirname: { - category: "String" - description: """ - Returns the directory component of the given `path`. This is similar to the Unix `dirname` command. - The directory component is the path with the final component removed. - """ - - arguments: [ - { - name: "value" - description: "The path from which to extract the directory name." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Extract dirname from file path" - source: """ - dirname!("/usr/local/bin/vrl") - """ - return: "/usr/local/bin" - }, - { - title: "Extract dirname from file path with extension" - source: """ - dirname!("/home/user/file.txt") - """ - return: "/home/user" - }, - { - title: "Extract dirname from directory path" - source: """ - dirname!("/home/user/") - """ - return: "/home" - }, - { - title: "Root directory dirname is itself" - source: """ - dirname!("/") - """ - return: "/" - }, - { - title: "Relative files have current directory as dirname" - source: """ - dirname!("file.txt") - """ - return: "." - }, - ] -} +{ + "remap": { + "functions": { + "dirname": { + "anchor": "dirname", + "name": "dirname", + "category": "String", + "description": "Returns the directory component of the given `path`. This is similar to the Unix `dirname` command. The directory component is the path with the final component removed.", + "arguments": [ + { + "name": "value", + "description": "The path from which to extract the directory name.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid string." + ], + "examples": [ + { + "title": "Extract dirname from file path", + "source": "dirname!(\"/usr/local/bin/vrl\")", + "return": "/usr/local/bin" + }, + { + "title": "Extract dirname from file path with extension", + "source": "dirname!(\"/home/user/file.txt\")", + "return": "/home/user" + }, + { + "title": "Extract dirname from directory path", + "source": "dirname!(\"/home/user/\")", + "return": "/home" + }, + { + "title": "Root directory dirname is itself", + "source": "dirname!(\"/\")", + "return": "/" + }, + { + "title": "Relative files have current directory as dirname", + "source": "dirname!(\"file.txt\")", + "return": "." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/dns_lookup.cue b/website/cue/reference/remap/functions/dns_lookup.cue new file mode 100644 index 0000000000000..8ad0e232ecbdb --- /dev/null +++ b/website/cue/reference/remap/functions/dns_lookup.cue @@ -0,0 +1,261 @@ +{ + "remap": { + "functions": { + "dns_lookup": { + "anchor": "dns_lookup", + "name": "dns_lookup", + "category": "System", + "description": "Performs a DNS lookup on the provided domain name. This function performs network calls and blocks on each request until a response is received. It is not recommended for frequent or performance-critical workflows.", + "arguments": [ + { + "name": "value", + "description": "The domain name to query.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "qtype", + "description": "The DNS record type to query (e.g., A, AAAA, MX, TXT). Defaults to A.", + "required": false, + "type": [ + "string" + ], + "default": "A" + }, + { + "name": "class", + "description": "The DNS query class. Defaults to IN (Internet).", + "required": false, + "type": [ + "string" + ], + "default": "IN" + }, + { + "name": "options", + "description": "DNS resolver options. Supported fields: servers (array of nameserver addresses), timeout (seconds), attempts (number of retry attempts), ndots, aa_only, tcp, recurse, rotate.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Basic lookup", + "source": "res = dns_lookup!(\"dns.google\")\n# reset non-static ttl so result is static\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", + "return": { + "additional": [ + { + "domainName": "", + "rData": "OPT ...", + "recordType": "OPT", + "recordTypeId": 41, + "ttl": 0 + } + ], + "answers": [ + { + "class": "IN", + "domainName": "dns.google", + "rData": "8.8.8.8", + "recordType": "A", + "recordTypeId": 1, + "ttl": 600 + } + ], + "authority": [], + "fullRcode": 0, + "header": { + "aa": false, + "ad": false, + "anCount": 2, + "arCount": 1, + "cd": false, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": true, + "ra": true, + "rcode": 0, + "rd": true, + "tc": false + }, + "question": [ + { + "class": "IN", + "domainName": "dns.google", + "questionType": "A", + "questionTypeId": 1 + } + ], + "rcodeName": "NOERROR" + } + }, + { + "title": "Custom class and qtype", + "source": "res = dns_lookup!(\"dns.google\", class: \"IN\", qtype: \"A\")\n# reset non-static ttl so result is static\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", + "return": { + "additional": [ + { + "domainName": "", + "rData": "OPT ...", + "recordType": "OPT", + "recordTypeId": 41, + "ttl": 0 + } + ], + "answers": [ + { + "class": "IN", + "domainName": "dns.google", + "rData": "8.8.8.8", + "recordType": "A", + "recordTypeId": 1, + "ttl": 600 + } + ], + "authority": [], + "fullRcode": 0, + "header": { + "aa": false, + "ad": false, + "anCount": 2, + "arCount": 1, + "cd": false, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": true, + "ra": true, + "rcode": 0, + "rd": true, + "tc": false + }, + "question": [ + { + "class": "IN", + "domainName": "dns.google", + "questionType": "A", + "questionTypeId": 1 + } + ], + "rcodeName": "NOERROR" + } + }, + { + "title": "Custom options", + "source": "res = dns_lookup!(\"dns.google\", options: {\"timeout\": 30, \"attempts\": 5})\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", + "return": { + "additional": [ + { + "domainName": "", + "rData": "OPT ...", + "recordType": "OPT", + "recordTypeId": 41, + "ttl": 0 + } + ], + "answers": [ + { + "class": "IN", + "domainName": "dns.google", + "rData": "8.8.8.8", + "recordType": "A", + "recordTypeId": 1, + "ttl": 600 + } + ], + "authority": [], + "fullRcode": 0, + "header": { + "aa": false, + "ad": false, + "anCount": 2, + "arCount": 1, + "cd": false, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": true, + "ra": true, + "rcode": 0, + "rd": true, + "tc": false + }, + "question": [ + { + "class": "IN", + "domainName": "dns.google", + "questionType": "A", + "questionTypeId": 1 + } + ], + "rcodeName": "NOERROR" + } + }, + { + "title": "Custom server", + "source": "res = dns_lookup!(\"dns.google\", options: {\"servers\": [\"dns.quad9.net\"]})\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", + "return": { + "additional": [ + { + "domainName": "", + "rData": "OPT ...", + "recordType": "OPT", + "recordTypeId": 41, + "ttl": 0 + } + ], + "answers": [ + { + "class": "IN", + "domainName": "dns.google", + "rData": "8.8.8.8", + "recordType": "A", + "recordTypeId": 1, + "ttl": 600 + } + ], + "authority": [], + "fullRcode": 0, + "header": { + "aa": false, + "ad": false, + "anCount": 2, + "arCount": 1, + "cd": false, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": true, + "ra": true, + "rcode": 0, + "rd": true, + "tc": false + }, + "question": [ + { + "class": "IN", + "domainName": "dns.google", + "questionType": "A", + "questionTypeId": 1 + } + ], + "rcodeName": "NOERROR" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/downcase.cue b/website/cue/reference/remap/functions/downcase.cue index 1feb707899324..237ac00540080 100644 --- a/website/cue/reference/remap/functions/downcase.cue +++ b/website/cue/reference/remap/functions/downcase.cue @@ -1,30 +1,40 @@ -package metadata - -remap: functions: downcase: { - category: "String" - description: """ - Downcases the `value` string, where downcase is defined according to the - Unicode Derived Core Property Lowercase. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to lowercase." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Downcase a string" - source: #""" - downcase("Hello, World!") - """# - return: "hello, world!" - }, - ] -} +{ + "remap": { + "functions": { + "downcase": { + "anchor": "downcase", + "name": "downcase", + "category": "String", + "description": "Downcases the `value` string, where downcase is defined according to the Unicode Derived Core Property Lowercase.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to lowercase.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Downcase a string", + "source": "downcase(\"Hello, World!\")", + "return": "hello, world!" + }, + { + "title": "Downcase with number", + "source": "downcase(\"FOO 2 BAR\")", + "return": "foo 2 bar" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_base16.cue b/website/cue/reference/remap/functions/encode_base16.cue index b93cbb9843113..f71bfae2f68fa 100644 --- a/website/cue/reference/remap/functions/encode_base16.cue +++ b/website/cue/reference/remap/functions/encode_base16.cue @@ -1,29 +1,35 @@ -package metadata - -remap: functions: encode_base16: { - category: "Codec" - description: """ - Encodes the `value` to [Base16](\(urls.base16)). - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Base16" - source: """ - encode_base16("please encode me") - """ - return: "706c6561736520656e636f6465206d65" - }, - ] -} +{ + "remap": { + "functions": { + "encode_base16": { + "anchor": "encode_base16", + "name": "encode_base16", + "category": "Codec", + "description": "Encodes the `value` to [Base16](https://en.wikipedia.org/wiki/Hexadecimal).", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Base16", + "source": "encode_base16(\"some string value\")", + "return": "736f6d6520737472696e672076616c7565" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_base64.cue b/website/cue/reference/remap/functions/encode_base64.cue index 840d8cd321337..f444c02ba49ad 100644 --- a/website/cue/reference/remap/functions/encode_base64.cue +++ b/website/cue/reference/remap/functions/encode_base64.cue @@ -1,61 +1,72 @@ -package metadata - -remap: functions: encode_base64: { - category: "Codec" - description: """ - Encodes the `value` to [Base64](\(urls.base64)). - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "padding" - description: "Whether the Base64 output is [padded](\(urls.base64_padding))." - required: false - type: ["boolean"] - default: true - }, - { - name: "charset" - description: "The character set to use when encoding the data." - required: false - type: ["string"] - default: "standard" - enum: { - standard: "[Standard](\(urls.base64_standard)) Base64 format." - url_safe: "Modified Base64 for [URL variants](\(urls.base64_url_safe))." - } - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Base64 (default)" - source: """ - encode_base64("please encode me") - """ - return: "cGxlYXNlIGVuY29kZSBtZQ==" - }, - { - title: "Encode to Base64 (without padding)" - source: """ - encode_base64("please encode me, no padding though", padding: false) - """ - return: "cGxlYXNlIGVuY29kZSBtZSwgbm8gcGFkZGluZyB0aG91Z2g" - }, - { - title: "Encode to Base64 (URL safe)" - source: """ - encode_base64("please encode me, but safe for URLs", charset: "url_safe") - """ - return: "cGxlYXNlIGVuY29kZSBtZSwgYnV0IHNhZmUgZm9yIFVSTHM=" - }, - ] -} +{ + "remap": { + "functions": { + "encode_base64": { + "anchor": "encode_base64", + "name": "encode_base64", + "category": "Codec", + "description": "Encodes the `value` to [Base64](https://en.wikipedia.org/wiki/Base64).", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "padding", + "description": "Whether the Base64 output is [padded](https://en.wikipedia.org/wiki/Base64#Output_padding).", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "charset", + "description": "The character set to use when encoding the data.", + "required": false, + "type": [ + "string" + ], + "enum": { + "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications).", + "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format." + }, + "default": "standard" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Base64 (default)", + "source": "encode_base64(\"please encode me\")", + "return": "cGxlYXNlIGVuY29kZSBtZQ==" + }, + { + "title": "Encode to Base64 (without padding)", + "source": "encode_base64(\"please encode me, no padding though\", padding: false)", + "return": "cGxlYXNlIGVuY29kZSBtZSwgbm8gcGFkZGluZyB0aG91Z2g" + }, + { + "title": "Encode to Base64 (URL safe)", + "source": "encode_base64(\"please encode me, but safe for URLs\", charset: \"url_safe\")", + "return": "cGxlYXNlIGVuY29kZSBtZSwgYnV0IHNhZmUgZm9yIFVSTHM=" + }, + { + "title": "Encode to Base64 (without padding and URL safe)", + "source": "encode_base64(\"some string value\", padding: false, charset: \"url_safe\")", + "return": "c29tZSBzdHJpbmcgdmFsdWU" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_charset.cue b/website/cue/reference/remap/functions/encode_charset.cue index 9bb98b04adafa..9152417299809 100644 --- a/website/cue/reference/remap/functions/encode_charset.cue +++ b/website/cue/reference/remap/functions/encode_charset.cue @@ -1,52 +1,56 @@ -package metadata - -remap: functions: encode_charset: { - category: "Codec" - description: """ - Encodes the `value` (a UTF8 string) to a non-UTF8 string using the specified [character set](\(urls.charset_standard)). - """ - - arguments: [ - { - name: "value" - description: "The UTF8 string to encode." - required: true - type: ["string"] - }, - { - name: "to_charset" - description: "The [character set](\(urls.charset_standard)) to use when encoding the data." - required: true - type: ["string"] - - }, - ] - internal_failure_reasons: [ - "`to_charset` isn't a valid [character set](\(urls.charset_standard)).", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode UTF8 string to EUC-KR" - source: """ - encode_base64(encode_charset!("안녕하세요", "euc-kr")) - """ - return: "vsiz58fPvLy/5A==" - }, - { - title: "Encode UTF8 string to EUC-JP" - source: """ - encode_base64(encode_charset!("こんにちは", "euc-jp")) - """ - return: "pLOk86TLpMGkzw==" - }, - { - title: "Encode UTF8 string to GB2312" - source: """ - encode_base64(encode_charset!("你好", "gb2312")) - """ - return: "xOO6ww==" - }, - ] -} +{ + "remap": { + "functions": { + "encode_charset": { + "anchor": "encode_charset", + "name": "encode_charset", + "category": "Codec", + "description": "Encodes the `value` (a non-UTF8 string) to a UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", + "arguments": [ + { + "name": "value", + "description": "The UTF8 string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "to_charset", + "description": "The [character set](https://encoding.spec.whatwg.org/#names-and-labels) to use when encoding the data.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`to_charset` isn't a valid [character set](https://encoding.spec.whatwg.org/#names-and-labels)." + ], + "examples": [ + { + "title": "Encode UTF8 string to EUC-KR", + "source": "encode_base64(encode_charset!(\"안녕하세요\", \"euc-kr\"))", + "return": "vsiz58fPvLy/5A==" + }, + { + "title": "Encode UTF8 string to EUC-JP", + "source": "encode_base64(encode_charset!(\"こんにちは\", \"euc-jp\"))", + "return": "pLOk86TLpMGkzw==" + }, + { + "title": "Encode UTF8 string to GB2312", + "source": "encode_base64(encode_charset!(\"你好\", \"gb2312\"))", + "return": "xOO6ww==" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_gzip.cue b/website/cue/reference/remap/functions/encode_gzip.cue index a30c545dfe8ec..dd15ab0dd42ff 100644 --- a/website/cue/reference/remap/functions/encode_gzip.cue +++ b/website/cue/reference/remap/functions/encode_gzip.cue @@ -1,37 +1,44 @@ -package metadata - -remap: functions: encode_gzip: { - category: "Codec" - description: """ - Encodes the `value` to [Gzip](\(urls.gzip)). - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "compression_level" - description: "The default compression level." - required: false - type: ["integer"] - default: 6 - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Gzip" - source: #""" - encoded_text = encode_gzip("please encode me") - encode_base64(encoded_text) - """# - return: "H4sIAAAAAAAA/yvISU0sTlVIzUvOT0lVyE0FAI4R4vcQAAAA" - }, - ] -} +{ + "remap": { + "functions": { + "encode_gzip": { + "anchor": "encode_gzip", + "name": "encode_gzip", + "category": "Codec", + "description": "Encodes the `value` to [Gzip](https://www.gzip.org/).", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "compression_level", + "description": "The default compression level.", + "required": false, + "type": [ + "integer" + ], + "default": "6" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Gzip", + "source": "encode_base64(encode_gzip(\"please encode me\"))", + "return": "H4sIAAAAAAAA/yvISU0sTlVIzUvOT0lVyE0FAI4R4vcQAAAA" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_json.cue b/website/cue/reference/remap/functions/encode_json.cue index 1757905cf7ee6..9f3e1420caa2b 100644 --- a/website/cue/reference/remap/functions/encode_json.cue +++ b/website/cue/reference/remap/functions/encode_json.cue @@ -1,35 +1,49 @@ -package metadata - -remap: functions: encode_json: { - category: "Codec" - description: """ - Encodes the `value` to JSON. - """ - - arguments: [ - { - name: "value" - description: "The value to convert to a JSON string." - required: true - type: ["any"] - }, - { - name: "pretty" - description: "Whether to pretty print the JSON string or not." - required: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to JSON" - source: #""" - .payload = encode_json({"hello": "world"}) - """# - return: #"{"hello":"world"}"# - }, - ] -} +{ + "remap": { + "functions": { + "encode_json": { + "anchor": "encode_json", + "name": "encode_json", + "category": "Codec", + "description": "Encodes the `value` to JSON.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a JSON string.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "pretty", + "description": "Whether to pretty print the JSON string or not.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode object to JSON", + "source": "encode_json({\"field\": \"value\", \"another\": [1,2,3]})", + "return": "s'{\"another\":[1,2,3],\"field\":\"value\"}'" + }, + { + "title": "Encode object to as pretty-printed JSON", + "source": "encode_json({\"field\": \"value\", \"another\": [1,2,3]}, true)", + "return": "{\n \"another\": [\n 1,\n 2,\n 3\n ],\n \"field\": \"value\"\n}" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_key_value.cue b/website/cue/reference/remap/functions/encode_key_value.cue index 2af964dab8f6b..f7a5e56cac04e 100644 --- a/website/cue/reference/remap/functions/encode_key_value.cue +++ b/website/cue/reference/remap/functions/encode_key_value.cue @@ -1,108 +1,102 @@ -package metadata - -remap: functions: encode_key_value: { - category: "Codec" - description: """ - Encodes the `value` into key-value format with customizable delimiters. Default delimiters match - the [logfmt](\(urls.logfmt)) format. - """ - notices: [ - """ - If `fields_ordering` is specified then the function is fallible else it is infallible. - """, - ] - - arguments: [ - { - name: "value" - description: "The value to convert to a string." - required: true - type: ["object"] - }, - { - name: "fields_ordering" - description: "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields." - required: false - type: ["array"] - }, - { - name: "key_value_delimiter" - description: "The string that separates the key from the value." - required: false - default: "=" - type: ["string"] - }, - { - name: "field_delimiter" - description: "The string that separates each key-value pair." - required: false - default: " " - type: ["string"] - }, - { - name: "flatten_boolean" - description: "Whether to encode key-value with a boolean value as a standalone key if `true` and nothing if `false`." - required: false - type: ["boolean"] - default: false - }, - ] - internal_failure_reasons: [ - "`fields_ordering` contains a non-string element.", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode with default delimiters (no ordering)" - source: """ - encode_key_value({"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info"}) - """ - return: #"lvl=info msg="This is a message" ts=2021-06-05T17:20:00Z"# - }, - { - title: "Encode with default delimiters (fields ordering)" - source: """ - encode_key_value!({"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info", "log_id": 12345}, ["ts", "lvl", "msg"]) - """ - return: #"ts=2021-06-05T17:20:00Z lvl=info msg="This is a message" log_id=12345"# - }, - { - title: "Encode with default delimiters (nested fields)" - source: """ - encode_key_value({"agent": {"name": "foo"}, "log": {"file": {"path": "my.log"}}, "event": "log"}) - """ - return: #"agent.name=foo event=log log.file.path=my.log"# - }, - { - title: "Encode with default delimiters (nested fields ordering)" - source: """ - encode_key_value!({"agent": {"name": "foo"}, "log": {"file": {"path": "my.log"}}, "event": "log"}, ["event", "log.file.path", "agent.name"]) - """ - return: #"event=log log.file.path=my.log agent.name=foo"# - }, - { - title: "Encode with custom delimiters (no ordering)" - source: """ - encode_key_value( - {"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info"}, - field_delimiter: ",", - key_value_delimiter: ":" - ) - """ - return: #"lvl:info,msg:"This is a message",ts:2021-06-05T17:20:00Z"# - }, - { - title: "Encode with custom delimiters and flatten boolean" - source: """ - encode_key_value( - {"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info", "beta": true, "dropped": false}, - field_delimiter: ",", - key_value_delimiter: ":", - flatten_boolean: true - ) - """ - return: #"beta,lvl:info,msg:"This is a message",ts:2021-06-05T17:20:00Z"# - }, - ] -} +{ + "remap": { + "functions": { + "encode_key_value": { + "anchor": "encode_key_value", + "name": "encode_key_value", + "category": "Codec", + "description": "Encodes the `value` into key-value format with customizable delimiters. Default delimiters match the [logfmt](https://brandur.org/logfmt) format.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a string.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "fields_ordering", + "description": "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields.", + "required": false, + "type": [ + "array" + ], + "default": "[]" + }, + { + "name": "key_value_delimiter", + "description": "The string that separates the key from the value.", + "required": false, + "type": [ + "string" + ], + "default": "=" + }, + { + "name": "field_delimiter", + "description": "The string that separates each key-value pair.", + "required": false, + "type": [ + "string" + ], + "default": " " + }, + { + "name": "flatten_boolean", + "description": "Whether to encode key-value with a boolean value as a standalone key if `true` and nothing if `false`.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`fields_ordering` contains a non-string element." + ], + "examples": [ + { + "title": "Encode with default delimiters (no ordering)", + "source": "encode_key_value(\n {\n \"ts\": \"2021-06-05T17:20:00Z\",\n \"msg\": \"This is a message\",\n \"lvl\": \"info\"\n }\n)\n", + "return": "lvl=info msg=\"This is a message\" ts=2021-06-05T17:20:00Z" + }, + { + "title": "Encode with default delimiters (fields ordering)", + "source": "encode_key_value!(\n {\n \"ts\": \"2021-06-05T17:20:00Z\",\n \"msg\": \"This is a message\",\n \"lvl\": \"info\",\n \"log_id\": 12345\n },\n [\"ts\", \"lvl\", \"msg\"]\n)\n", + "return": "ts=2021-06-05T17:20:00Z lvl=info msg=\"This is a message\" log_id=12345" + }, + { + "title": "Encode with default delimiters (nested fields)", + "source": "encode_key_value(\n {\n \"agent\": {\"name\": \"foo\"},\n \"log\": {\"file\": {\"path\": \"my.log\"}},\n \"event\": \"log\"\n }\n)\n", + "return": "agent.name=foo event=log log.file.path=my.log" + }, + { + "title": "Encode with default delimiters (nested fields ordering)", + "source": "encode_key_value!(\n {\n \"agent\": {\"name\": \"foo\"},\n \"log\": {\"file\": {\"path\": \"my.log\"}},\n \"event\": \"log\"\n },\n [\"event\", \"log.file.path\", \"agent.name\"])\n", + "return": "event=log log.file.path=my.log agent.name=foo" + }, + { + "title": "Encode with custom delimiters (no ordering)", + "source": "encode_key_value(\n {\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\"},\n field_delimiter: \",\",\n key_value_delimiter: \":\"\n)\n", + "return": "lvl:info,msg:\"This is a message\",ts:2021-06-05T17:20:00Z" + }, + { + "title": "Encode with custom delimiters and flatten boolean", + "source": "encode_key_value(\n {\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\", \"beta\": true, \"dropped\": false},\n field_delimiter: \",\",\n key_value_delimiter: \":\",\n flatten_boolean: true\n)\n", + "return": "beta,lvl:info,msg:\"This is a message\",ts:2021-06-05T17:20:00Z" + } + ], + "notices": [ + "If `fields_ordering` is specified then the function is fallible else it is infallible." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_logfmt.cue b/website/cue/reference/remap/functions/encode_logfmt.cue index 9fa01e746a7b4..0e102d647c6fb 100644 --- a/website/cue/reference/remap/functions/encode_logfmt.cue +++ b/website/cue/reference/remap/functions/encode_logfmt.cue @@ -1,59 +1,65 @@ -package metadata - -remap: functions: encode_logfmt: { - category: "Codec" - description: """ - Encodes the `value` to [logfmt](\(urls.logfmt)). - """ - notices: functions.encode_key_value.notices - - arguments: [ - { - name: "value" - description: "The value to convert to a logfmt string." - required: true - type: ["object"] - }, - { - name: "fields_ordering" - description: "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields." - required: false - type: ["array"] - }, - ] - internal_failure_reasons: [ - "`fields_ordering` contains a non-string element.", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode to logfmt (no ordering)" - source: """ - encode_logfmt({"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info"}) - """ - return: #"lvl=info msg="This is a message" ts=2021-06-05T17:20:00Z"# - }, - { - title: "Encode to logfmt (fields ordering)" - source: """ - encode_logfmt!({"ts": "2021-06-05T17:20:00Z", "msg": "This is a message", "lvl": "info", "log_id": 12345}, ["ts", "lvl", "msg"]) - """ - return: #"ts=2021-06-05T17:20:00Z lvl=info msg="This is a message" log_id=12345"# - }, - { - title: "Encode to logfmt (nested fields)" - source: """ - encode_logfmt({"agent": {"name": "foo"}, "log": {"file": {"path": "my.log"}}, "event": "log"}) - """ - return: #"agent.name=foo event=log log.file.path=my.log"# - }, - { - title: "Encode to logfmt (nested fields ordering)" - source: """ - encode_logfmt!({"agent": {"name": "foo"}, "log": {"file": {"path": "my.log"}}, "event": "log"}, ["event", "log.file.path", "agent.name"]) - """ - return: #"event=log log.file.path=my.log agent.name=foo"# - }, - ] -} +{ + "remap": { + "functions": { + "encode_logfmt": { + "anchor": "encode_logfmt", + "name": "encode_logfmt", + "category": "Codec", + "description": "Encodes the `value` to [logfmt](https://brandur.org/logfmt).", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a logfmt string.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "fields_ordering", + "description": "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields.", + "required": false, + "type": [ + "array" + ], + "default": "[]" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`fields_ordering` contains a non-string element." + ], + "examples": [ + { + "title": "Encode to logfmt (no ordering)", + "source": "encode_logfmt({\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\"})", + "return": "lvl=info msg=\"This is a message\" ts=2021-06-05T17:20:00Z" + }, + { + "title": "Encode to logfmt (fields ordering)", + "source": "encode_logfmt!({\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\", \"log_id\": 12345}, [\"ts\", \"lvl\", \"msg\"])", + "return": "ts=2021-06-05T17:20:00Z lvl=info msg=\"This is a message\" log_id=12345" + }, + { + "title": "Encode to logfmt (nested fields)", + "source": "encode_logfmt({\"agent\": {\"name\": \"foo\"}, \"log\": {\"file\": {\"path\": \"my.log\"}}, \"event\": \"log\"})", + "return": "agent.name=foo event=log log.file.path=my.log" + }, + { + "title": "Encode to logfmt (nested fields ordering)", + "source": "encode_logfmt!({\"agent\": {\"name\": \"foo\"}, \"log\": {\"file\": {\"path\": \"my.log\"}}, \"event\": \"log\"}, [\"event\", \"log.file.path\", \"agent.name\"])", + "return": "event=log log.file.path=my.log agent.name=foo" + } + ], + "notices": [ + "If `fields_ordering` is specified then the function is fallible else it is infallible." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_lz4.cue b/website/cue/reference/remap/functions/encode_lz4.cue index 66ebe7e45bcd9..4ddcca363e03d 100644 --- a/website/cue/reference/remap/functions/encode_lz4.cue +++ b/website/cue/reference/remap/functions/encode_lz4.cue @@ -1,39 +1,44 @@ -package metadata - -remap: functions: encode_lz4: { - category: "Codec" - description: """ - Encodes the `value` to [Lz4](\(urls.lz4)). This function compresses the input string into an lz4 block. - If `prepend_size` is set to `true`, it prepends the original uncompressed size to the compressed data. - This is useful for some implementations of lz4 that require the original size to be known before decoding. - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "prepend_size" - description: "Whether to prepend the original size to the compressed data." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Lz4" - source: #""" - encoded_text = encode_lz4!("The quick brown fox jumps over 13 lazy dogs.") - encode_base64(encoded_text) - """# - return: "LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=" - }, - ] -} +{ + "remap": { + "functions": { + "encode_lz4": { + "anchor": "encode_lz4", + "name": "encode_lz4", + "category": "Codec", + "description": "Encodes the `value` to [Lz4](https://lz4.github.io/lz4/). This function compresses the\ninput string into an lz4 block. If `prepend_size` is set to `true`, it prepends the\noriginal uncompressed size to the compressed data. This is useful for some\nimplementations of lz4 that require the original size to be known before decoding.", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "prepend_size", + "description": "Whether to prepend the original size to the compressed data.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Lz4", + "source": "encode_base64(encode_lz4!(\"The quick brown fox jumps over 13 lazy dogs.\", true))", + "return": "LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_percent.cue b/website/cue/reference/remap/functions/encode_percent.cue index c6f9a3d61b0c7..0e673042bca02 100644 --- a/website/cue/reference/remap/functions/encode_percent.cue +++ b/website/cue/reference/remap/functions/encode_percent.cue @@ -1,54 +1,65 @@ -package metadata - -remap: functions: encode_percent: { - category: "Codec" - description: """ - Encodes a `value` with [percent encoding](\(urls.percent_encoded_bytes)) to safely be used in URLs. - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "ascii_set" - description: "The ASCII set to use when encoding the data." - required: false - type: ["string"] - default: "NON_ALPHANUMERIC" - enum: { - NON_ALPHANUMERIC: "Encode any non-alphanumeric characters. This is the safest option." - CONTROLS: "Encode only [control characters](\(urls.percent_encoding_controls))." - FRAGMENT: "Encode only [fragment characters](\(urls.percent_encoding_fragment))" - QUERY: "Encode only [query characters](\(urls.percent_encoding_query))" - SPECIAL: "Encode only [special characters](\(urls.percent_encoding_special))" - PATH: "Encode only [path characters](\(urls.percent_encoding_path))" - USERINFO: "Encode only [userinfo characters](\(urls.percent_encoding_userinfo))" - COMPONENT: "Encode only [component characters](\(urls.percent_encoding_component))" - WWW_FORM_URLENCODED: "Encode only [`application/x-www-form-urlencoded`](\(urls.percent_encoding_www_form_urlencoded))" - } - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Percent encode all non-alphanumeric characters (default)" - source: """ - encode_percent("foo bar?") - """ - return: "foo%20bar%3F" - }, - { - title: "Percent encode only control characters" - source: """ - encode_percent("foo \tbar", ascii_set: "CONTROLS") - """ - return: "foo %09bar" - }, - ] -} +{ + "remap": { + "functions": { + "encode_percent": { + "anchor": "encode_percent", + "name": "encode_percent", + "category": "Codec", + "description": "Encodes a `value` with [percent encoding](https://url.spec.whatwg.org/#percent-encoded-bytes) to safely be used in URLs.", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "ascii_set", + "description": "The ASCII set to use when encoding the data.", + "required": false, + "type": [ + "string" + ], + "enum": { + "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option.", + "COMPONENT": "Encode only [component characters](https://url.spec.whatwg.org/#component-percent-encode-set)", + "PATH": "Encode only [path characters](https://url.spec.whatwg.org/#path-percent-encode-set)", + "QUERY": "Encode only [query characters](https://url.spec.whatwg.org/#query-percent-encode-set)", + "FRAGMENT": "Encode only [fragment characters](https://url.spec.whatwg.org/#fragment-percent-encode-set)", + "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)", + "CONTROLS": "Encode only [control characters](https://infra.spec.whatwg.org/#c0-control).", + "USERINFO": "Encode only [userinfo characters](https://url.spec.whatwg.org/#userinfo-percent-encode-set)", + "SPECIAL": "Encode only [special characters](https://url.spec.whatwg.org/#special-percent-encode-set)" + }, + "default": "NON_ALPHANUMERIC" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Percent encode all non-alphanumeric characters (default)", + "source": "encode_percent(\"foo bar?\")", + "return": "foo%20bar%3F" + }, + { + "title": "Percent encode only control characters", + "source": "encode_percent(\"foo \\tbar\", ascii_set: \"CONTROLS\")", + "return": "foo %09bar" + }, + { + "title": "Percent encode special characters", + "source": "encode_percent(\"foo@bar?\")", + "return": "foo%40bar%3F" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_proto.cue b/website/cue/reference/remap/functions/encode_proto.cue index 253bcf01e9241..000803a765620 100644 --- a/website/cue/reference/remap/functions/encode_proto.cue +++ b/website/cue/reference/remap/functions/encode_proto.cue @@ -1,52 +1,55 @@ -package metadata - -remap: functions: encode_proto: { - category: "Codec" - description: """ - Encodes the `value` into a protocol buffer payload. - """ - - arguments: [ - { - name: "value" - description: "The object to convert to a protocol buffer payload." - required: true - type: ["object"] - }, - { - name: "desc_file" - description: """ - The path to the protobuf descriptor set file. Must be a literal string. - - This file is the output of protoc -o ... - """ - required: true - type: ["string"] - }, - { - name: "message_type" - description: """ - The name of the message type to use for serializing. - - Must be a literal string. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`desc_file` file does not exist.", - "`message_type` message type does not exist in the descriptor file.", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode to proto" - source: #""" - .payload = encode_base64(encode_proto!({"name": "someone", "phones": [{"number": "123456"}]}, "resources/protobuf_descriptor_set.desc", "test_protobuf.Person")) - """# - return: #"Cgdzb21lb25lIggKBjEyMzQ1Ng=="# - }, - ] -} +{ + "remap": { + "functions": { + "encode_proto": { + "anchor": "encode_proto", + "name": "encode_proto", + "category": "Codec", + "description": "Encodes the `value` into a protocol buffer payload.", + "arguments": [ + { + "name": "value", + "description": "The object to convert to a protocol buffer payload.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "desc_file", + "description": "The path to the protobuf descriptor set file. Must be a literal string.\n\nThis file is the output of protoc -o ...", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "message_type", + "description": "The name of the message type to use for serializing.\n\nMust be a literal string.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`desc_file` file does not exist.", + "`message_type` message type does not exist in the descriptor file." + ], + "examples": [ + { + "title": "Encode to proto", + "source": "encode_base64(encode_proto!({ \"name\": \"someone\", \"phones\": [{\"number\": \"123456\"}]}, \"test_protobuf.desc\", \"test_protobuf.v1.Person\"))", + "return": "Cgdzb21lb25lIggKBjEyMzQ1Ng==" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_punycode.cue b/website/cue/reference/remap/functions/encode_punycode.cue index d5d72439f7a86..6f31a595a81fd 100644 --- a/website/cue/reference/remap/functions/encode_punycode.cue +++ b/website/cue/reference/remap/functions/encode_punycode.cue @@ -1,59 +1,62 @@ -package metadata - -remap: functions: encode_punycode: { - category: "Codec" - description: """ - Encodes a `value` to [punycode](\(urls.punycode)). Useful for internationalized domain names ([IDN](\(urls.idn))). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it. - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "validate" - description: "Whether to validate the input string to check if it is a valid domain name." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [ - "`value` can not be encoded to `punycode`", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode an internationalized domain name" - source: """ - encode_punycode!("www.café.com") - """ - return: "www.xn--caf-dma.com" - }, - { - title: "Encode an internationalized domain name with mixed case" - source: """ - encode_punycode!("www.CAFé.com") - """ - return: "www.xn--caf-dma.com" - }, - { - title: "Encode an ASCII only string" - source: """ - encode_punycode!("www.cafe.com") - """ - return: "www.cafe.com" - }, - { - title: "Ignore validation" - source: """ - encode_punycode!("xn--8hbb.xn--fiba.xn--8hbf.xn--eib.", validate: false) - """ - return: "xn--8hbb.xn--fiba.xn--8hbf.xn--eib." - }, - ] -} +{ + "remap": { + "functions": { + "encode_punycode": { + "anchor": "encode_punycode", + "name": "encode_punycode", + "category": "Codec", + "description": "Encodes a `value` to [punycode](https://en.wikipedia.org/wiki/Punycode). Useful for internationalized domain names ([IDN](https://en.wikipedia.org/wiki/Internationalized_domain_name)). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it.", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "validate", + "description": "Whether to validate the input string to check if it is a valid domain name.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` can not be encoded to `punycode`" + ], + "examples": [ + { + "title": "Encode an internationalized domain name", + "source": "encode_punycode!(\"www.café.com\")", + "return": "www.xn--caf-dma.com" + }, + { + "title": "Encode an internationalized domain name with mixed case", + "source": "encode_punycode!(\"www.CAFé.com\")", + "return": "www.xn--caf-dma.com" + }, + { + "title": "Encode an ASCII only string", + "source": "encode_punycode!(\"www.cafe.com\")", + "return": "www.cafe.com" + }, + { + "title": "Ignore validation", + "source": "encode_punycode!(\"xn--8hbb.xn--fiba.xn--8hbf.xn--eib.\", validate: false)", + "return": "xn--8hbb.xn--fiba.xn--8hbf.xn--eib." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_snappy.cue b/website/cue/reference/remap/functions/encode_snappy.cue index f8a56c9ca653a..ad4df2d45ed20 100644 --- a/website/cue/reference/remap/functions/encode_snappy.cue +++ b/website/cue/reference/remap/functions/encode_snappy.cue @@ -1,32 +1,38 @@ -package metadata - -remap: functions: encode_snappy: { - category: "Codec" - description: """ - Encodes the `value` to Snappy. - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` cannot be encoded into a Snappy string.", - ] - return: types: ["string"] - - examples: [ - { - title: "Encode to Snappy" - source: #""" - encoded_text = encode_snappy!("The quick brown fox jumps over 13 lazy dogs.") - encode_base64(encoded_text) - """# - return: "LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==" - }, - ] -} +{ + "remap": { + "functions": { + "encode_snappy": { + "anchor": "encode_snappy", + "name": "encode_snappy", + "category": "Codec", + "description": "Encodes the `value` to Snappy.", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` cannot be encoded into a Snappy string." + ], + "examples": [ + { + "title": "Encode to Snappy", + "source": "encode_base64(encode_snappy!(\"The quick brown fox jumps over 13 lazy dogs.\"))", + "return": "LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_zlib.cue b/website/cue/reference/remap/functions/encode_zlib.cue index 73921d92c3a17..8f4e8382a58fb 100644 --- a/website/cue/reference/remap/functions/encode_zlib.cue +++ b/website/cue/reference/remap/functions/encode_zlib.cue @@ -1,37 +1,44 @@ -package metadata - -remap: functions: encode_zlib: { - category: "Codec" - description: """ - Encodes the `value` to [Zlib](\(urls.zlib)). - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "compression_level" - description: "The default compression level." - required: false - type: ["integer"] - default: 6 - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Zlib" - source: #""" - encoded_text = encode_zlib("please encode me") - encode_base64(encoded_text) - """# - return: "eJwryElNLE5VSM1Lzk9JVchNBQA0RQX7" - }, - ] -} +{ + "remap": { + "functions": { + "encode_zlib": { + "anchor": "encode_zlib", + "name": "encode_zlib", + "category": "Codec", + "description": "Encodes the `value` to [Zlib](https://www.zlib.net).", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "compression_level", + "description": "The default compression level.", + "required": false, + "type": [ + "integer" + ], + "default": "6" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Zlib", + "source": "encode_base64(encode_zlib(\"please encode me\"))", + "return": "eJwryElNLE5VSM1Lzk9JVchNBQA0RQX7" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encode_zstd.cue b/website/cue/reference/remap/functions/encode_zstd.cue index fb9cf17296a78..86009ff1b50a0 100644 --- a/website/cue/reference/remap/functions/encode_zstd.cue +++ b/website/cue/reference/remap/functions/encode_zstd.cue @@ -1,37 +1,44 @@ -package metadata - -remap: functions: encode_zstd: { - category: "Codec" - description: """ - Encodes the `value` to [Zstandard](\(urls.zstd)). - """ - - arguments: [ - { - name: "value" - description: "The string to encode." - required: true - type: ["string"] - }, - { - name: "compression_level" - description: "The default compression level." - required: false - type: ["integer"] - default: 3 - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Encode to Zstd" - source: #""" - encoded_text = encode_zstd("please encode me") - encode_base64(encoded_text) - """# - return: "KLUv/QBYgQAAcGxlYXNlIGVuY29kZSBtZQ==" - }, - ] -} +{ + "remap": { + "functions": { + "encode_zstd": { + "anchor": "encode_zstd", + "name": "encode_zstd", + "category": "Codec", + "description": "Encodes the `value` to [Zstandard](https://facebook.github.io/zstd).", + "arguments": [ + { + "name": "value", + "description": "The string to encode.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "compression_level", + "description": "The default compression level.", + "required": false, + "type": [ + "integer" + ], + "default": "3" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Encode to Zstd", + "source": "encode_base64(encode_zstd(\"please encode me\"))", + "return": "KLUv/QBYgQAAcGxlYXNlIGVuY29kZSBtZQ==" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encrypt.cue b/website/cue/reference/remap/functions/encrypt.cue index 0703654e9ba2e..fe46747da89c6 100644 --- a/website/cue/reference/remap/functions/encrypt.cue +++ b/website/cue/reference/remap/functions/encrypt.cue @@ -1,93 +1,69 @@ -package metadata - -remap: functions: encrypt: { - category: "Cryptography" - description: """ - Encrypts a string with a symmetric encryption algorithm. - - Supported Algorithms: - - * AES-256-CFB (key = 32 bytes, iv = 16 bytes) - * AES-192-CFB (key = 24 bytes, iv = 16 bytes) - * AES-128-CFB (key = 16 bytes, iv = 16 bytes) - * AES-256-OFB (key = 32 bytes, iv = 16 bytes) - * AES-192-OFB (key = 24 bytes, iv = 16 bytes) - * AES-128-OFB (key = 16 bytes, iv = 16 bytes) - * AES-128-SIV (key = 32 bytes, iv = 16 bytes) - * AES-256-SIV (key = 64 bytes, iv = 16 bytes) - * Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes) - * Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes) - * Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes) - * AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes) - * AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes) - * AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes) - * AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes) - * AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes) - * AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes) - * AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes) - * AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes) - * AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes) - * CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes) - * XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes) - * XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes) - """ - - arguments: [ - { - name: "plaintext" - description: "The string to encrypt." - required: true - type: ["string"] - }, - { - name: "algorithm" - description: "The algorithm to use." - required: true - type: ["string"] - }, - { - name: "key" - description: "The key in raw bytes (not encoded) for encryption. The length must match the algorithm requested." - required: true - type: ["string"] - }, - { - name: "iv" - description: #""" - The IV in raw bytes (not encoded) for encryption. The length must match the algorithm requested. - A new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value. - """# - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`algorithm` is not a supported algorithm.", - "`key` length does not match the key size required for the algorithm specified.", - "`iv` length does not match the `iv` size required for the algorithm specified.", - ] - return: types: ["string"] - - examples: [ - { - title: "Encrypt value" - source: #""" - plaintext = "super secret message" - iv = "1234567890123456" # typically you would call random_bytes(16) - key = "16_byte_keyxxxxx" - encrypted_message = encrypt!(plaintext, "AES-128-CBC-PKCS7", key, iv: iv) - encode_base64(encrypted_message) - """# - return: "GBw8Mu00v0Kc38+/PvsVtGgWuUJ+ZNLgF8Opy8ohIYE=" - }, - ] -} +{ + "remap": { + "functions": { + "encrypt": { + "anchor": "encrypt", + "name": "encrypt", + "category": "Cryptography", + "description": "Encrypts a string with a symmetric encryption algorithm.\n\nSupported Algorithms:\n\n* AES-256-CFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-CFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-CFB (key = 16 bytes, iv = 16 bytes)\n* AES-256-OFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-OFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-OFB (key = 16 bytes, iv = 16 bytes)\n* AES-128-SIV (key = 32 bytes, iv = 16 bytes)\n* AES-256-SIV (key = 64 bytes, iv = 16 bytes)\n* Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes)\n* Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes)\n* Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes)\n* CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes)\n* XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes)\n* XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes)", + "arguments": [ + { + "name": "plaintext", + "description": "The string to encrypt.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "algorithm", + "description": "The algorithm to use.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key", + "description": "The key in raw bytes (not encoded) for encryption. The length must match the algorithm requested.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "iv", + "description": "The IV in raw bytes (not encoded) for encryption. The length must match the algorithm requested.\nA new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`algorithm` is not a supported algorithm.", + "`key` length does not match the key size required for the algorithm specified.", + "`iv` length does not match the `iv` size required for the algorithm specified." + ], + "examples": [ + { + "title": "Encrypt value using AES-256-CFB", + "source": "iv = \"0123456789012345\" # typically you would call random_bytes(16)\nkey = \"01234567890123456789012345678912\"\nencrypted_message = encrypt!(\"data\", \"AES-256-CFB\", key: key, iv: iv)\nencode_base64(encrypted_message)\n", + "return": "c/dIOA==" + }, + { + "title": "Encrypt value using AES-128-CBC-PKCS7", + "source": "iv = \"1234567890123456\" # typically you would call random_bytes(16)\nkey = \"16_byte_keyxxxxx\"\nencrypted_message = encrypt!(\"super secret message\", \"AES-128-CBC-PKCS7\", key: key, iv: iv)\nencode_base64(encrypted_message)\n", + "return": "GBw8Mu00v0Kc38+/PvsVtGgWuUJ+ZNLgF8Opy8ohIYE=" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/encrypt_ip.cue b/website/cue/reference/remap/functions/encrypt_ip.cue index 5888f2c22055a..6126f91564ac8 100644 --- a/website/cue/reference/remap/functions/encrypt_ip.cue +++ b/website/cue/reference/remap/functions/encrypt_ip.cue @@ -1,80 +1,74 @@ -package metadata - -remap: functions: encrypt_ip: { - category: "IP" - description: """ - Encrypts an IP address, transforming it into a different valid IP address. - - Supported Modes: - - * AES128 - Scrambles the entire IP address using AES-128 encryption. Can transform between IPv4 and IPv6. - * PFX (Prefix-preserving) - Maintains network hierarchy by ensuring that IP addresses within the same network are encrypted to addresses that also share a common network. This preserves prefix relationships while providing confidentiality. - """ - notices: [ - """ - The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt specification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. Both modes provide deterministic encryption where the same input IP address encrypted with the same key will always produce the same encrypted output. - """, - ] - - arguments: [ - { - name: "ip" - description: "The IP address to encrypt (v4 or v6)." - required: true - type: ["string"] - }, - { - name: "key" - description: "The encryption key in raw bytes (not encoded). For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes." - required: true - type: ["string"] - }, - { - name: "mode" - description: "The encryption mode to use. Must be either `aes128` or `pfx`." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`ip` is not a valid IP address.", - "`mode` is not a supported mode (must be `aes128` or `pfx`).", - "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`).", - ] - return: types: ["string"] - - examples: [ - { - title: "Encrypt IPv4 address with AES128" - source: #""" - encrypted_ip = encrypt_ip!("192.168.1.1", "sixteen byte key", "aes128") - encrypted_ip - """# - return: "72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0" - }, - { - title: "Encrypt IPv6 address with AES128" - source: #""" - encrypted_ip = encrypt_ip!("2001:db8::1", "sixteen byte key", "aes128") - encrypted_ip - """# - return: "c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a" - }, - { - title: "Encrypt IPv4 address with prefix-preserving mode" - source: #""" - encrypted_ip = encrypt_ip!("192.168.1.1", "thirty-two bytes key for pfx use", "pfx") - encrypted_ip - """# - return: "33.245.248.61" - }, - { - title: "Encrypt IPv6 address with prefix-preserving mode" - source: #""" - encrypted_ip = encrypt_ip!("2001:db8::1", "thirty-two bytes key for ipv6pfx", "pfx") - encrypted_ip - """# - return: "88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9" - }, - ] -} +{ + "remap": { + "functions": { + "encrypt_ip": { + "anchor": "encrypt_ip", + "name": "encrypt_ip", + "category": "IP", + "description": "Encrypts an IP address, transforming it into a different valid IP address.\n\nSupported Modes:\n\n* AES128 - Scrambles the entire IP address using AES-128 encryption. Can transform between IPv4 and IPv6.\n* PFX (Prefix-preserving) - Maintains network hierarchy by ensuring that IP addresses within the same network are encrypted to addresses that also share a common network. This preserves prefix relationships while providing confidentiality.", + "arguments": [ + { + "name": "ip", + "description": "The IP address to encrypt (v4 or v6).", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key", + "description": "The encryption key in raw bytes (not encoded). For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "mode", + "description": "The encryption mode to use. Must be either `aes128` or `pfx`.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`ip` is not a valid IP address.", + "`mode` is not a supported mode (must be `aes128` or `pfx`).", + "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`)." + ], + "examples": [ + { + "title": "Encrypt IPv4 address with AES128", + "source": "encrypt_ip!(\"192.168.1.1\", \"sixteen byte key\", \"aes128\")", + "return": "72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0" + }, + { + "title": "Encrypt IPv6 address with AES128", + "source": "encrypt_ip!(\"2001:db8::1\", \"sixteen byte key\", \"aes128\")", + "return": "c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a" + }, + { + "title": "Encrypt IPv4 address with prefix-preserving mode", + "source": "encrypt_ip!(\"192.168.1.1\", \"thirty-two bytes key for pfx use\", \"pfx\")", + "return": "33.245.248.61" + }, + { + "title": "Encrypt IPv6 address with prefix-preserving mode", + "source": "encrypt_ip!(\"2001:db8::1\", \"thirty-two bytes key for ipv6pfx\", \"pfx\")", + "return": "88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9" + } + ], + "notices": [ + "The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt\nspecification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. Both modes\nprovide deterministic encryption where the same input IP address encrypted with the\nsame key will always produce the same encrypted output." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ends_with.cue b/website/cue/reference/remap/functions/ends_with.cue index 4251fe0146ea4..cfd34fa06bb94 100644 --- a/website/cue/reference/remap/functions/ends_with.cue +++ b/website/cue/reference/remap/functions/ends_with.cue @@ -1,49 +1,62 @@ -package metadata - -remap: functions: ends_with: { - category: "String" - description: """ - Determines whether the `value` string ends with the specified `substring`. - """ - - arguments: [ - { - name: "value" - description: "The string to search." - required: true - type: ["string"] - }, - { - name: "substring" - description: "The substring with which `value` must end." - required: true - type: ["string"] - }, - { - name: "case_sensitive" - description: "Whether the match should be case sensitive." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "String ends with (case sensitive)" - source: #""" - ends_with("The Needle In The Haystack", "The Haystack") - """# - return: true - }, - { - title: "String ends with (case insensitive)" - source: #""" - ends_with("The Needle In The Haystack", "the haystack", case_sensitive: false) - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "ends_with": { + "anchor": "ends_with", + "name": "ends_with", + "category": "String", + "description": "Determines whether the `value` string ends with the specified `substring`.", + "arguments": [ + { + "name": "value", + "description": "The string to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "substring", + "description": "The substring with which `value` must end.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "case_sensitive", + "description": "Whether the match should be case sensitive.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "String ends with (case sensitive)", + "source": "ends_with(\"The Needle In The Haystack\", \"The Haystack\")", + "return": true + }, + { + "title": "String ends with (case insensitive)", + "source": "ends_with(\"The Needle In The Haystack\", \"the haystack\", case_sensitive: false)", + "return": true + }, + { + "title": "String ends with (case sensitive failure)", + "source": "ends_with(\"foobar\", \"R\")", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/exists.cue b/website/cue/reference/remap/functions/exists.cue index ec37aa5ae7558..a799c54d4e911 100644 --- a/website/cue/reference/remap/functions/exists.cue +++ b/website/cue/reference/remap/functions/exists.cue @@ -1,43 +1,45 @@ -package metadata - -remap: functions: exists: { - category: "Path" - description: """ - Checks whether the `path` exists for the target. - - This function distinguishes between a missing path - and a path with a `null` value. A regular path lookup, - such as `.foo`, cannot distinguish between the two cases - since it always returns `null` if the path doesn't exist. - """ - - arguments: [ - { - name: "path" - description: "The path of the field to check." - required: true - type: ["path"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Exists (field)" - input: log: field: 1 - source: #""" - exists(.field) - """# - return: true - }, - { - title: "Exists (array element)" - input: log: array: [1, 2, 3] - source: #""" - exists(.array[2]) - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "exists": { + "anchor": "exists", + "name": "exists", + "category": "Path", + "description": "Checks whether the `path` exists for the target.\n\nThis function distinguishes between a missing path\nand a path with a `null` value. A regular path lookup,\nsuch as `.foo`, cannot distinguish between the two cases\nsince it always returns `null` if the path doesn't exist.", + "arguments": [ + { + "name": "field", + "description": "The path of the field to check.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Exists (field)", + "source": ". = { \"field\": 1 }\nexists(.field)\n", + "return": true + }, + { + "title": "Exists (array element)", + "source": ". = { \"array\": [1, 2, 3] }\nexists(.array[2])\n", + "return": true + }, + { + "title": "Does not exist (field)", + "source": "exists({ \"foo\": \"bar\"}.baz)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/filter.cue b/website/cue/reference/remap/functions/filter.cue index 690d4b845234a..dc033487a01d2 100644 --- a/website/cue/reference/remap/functions/filter.cue +++ b/website/cue/reference/remap/functions/filter.cue @@ -1,50 +1,54 @@ -package metadata - -remap: functions: filter: { - category: "Enumerate" - description: """ - Filter elements from a collection. - - This function currently *does not* support recursive iteration. - - The function uses the function closure syntax to allow reading - the key-value or index-value combination for each item in the - collection. - - The same scoping rules apply to closure blocks as they do for - regular blocks. This means that any variable defined in parent scopes - is accessible, and mutations to those variables are preserved, - but any new variables instantiated in the closure block are - unavailable outside of the block. - - See the examples below to learn about the closure syntax. - """ - - arguments: [ - { - name: "value" - description: "The array or object to filter." - required: true - type: ["array", "object"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array", "object"] - } - examples: [ - { - title: "Filter elements" - input: log: { - tags: ["foo", "bar", "foo", "baz"] - } - source: #""" - filter(array!(.tags)) -> |_index, value| { - # keep any elements that aren't equal to "foo" - value != "foo" - } - """# - return: ["bar", "baz"] - }, - ] -} +{ + "remap": { + "functions": { + "filter": { + "anchor": "filter", + "name": "filter", + "category": "Enumerate", + "description": "Filter elements from a collection.\n\nThis function currently *does not* support recursive iteration.\n\nThe function uses the function closure syntax to allow reading\nthe key-value or index-value combination for each item in the\ncollection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", + "arguments": [ + { + "name": "value", + "description": "The array or object to filter.", + "required": true, + "type": [ + "object", + "array" + ] + } + ], + "return": { + "types": [ + "object", + "array" + ] + }, + "examples": [ + { + "title": "Filter elements", + "source": ". = { \"tags\": [\"foo\", \"bar\", \"foo\", \"baz\"] }\nfilter(array(.tags)) -> |_index, value| {\n value != \"foo\"\n}\n", + "return": [ + "bar", + "baz" + ] + }, + { + "title": "Filter object", + "source": "filter({ \"a\": 1, \"b\": 2 }) -> |key, _value| { key == \"a\" }", + "return": { + "a": 1 + } + }, + { + "title": "Filter array", + "source": "filter([1, 2]) -> |_index, value| { value < 2 }", + "return": [ + 1 + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/find.cue b/website/cue/reference/remap/functions/find.cue index 5cf6bd3ab1283..ff44ca52b3baa 100644 --- a/website/cue/reference/remap/functions/find.cue +++ b/website/cue/reference/remap/functions/find.cue @@ -1,64 +1,73 @@ -package metadata - -remap: functions: find: { - category: "String" - description: """ - Determines from left to right the start position of the first found element in `value` - that matches `pattern`. Returns `-1` if not found. - """ - - arguments: [ - { - name: "value" - description: "The string to find the pattern in." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The regular expression or string pattern to match against." - required: true - type: ["regex", "string"] - }, - { - name: "from" - description: "Offset to start searching." - required: false - default: 0 - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: types: ["integer"] - - examples: [ - { - title: "Match text" - source: #""" - find("foobar", "foo") - """# - return: 0 - }, - { - title: "Match regex" - source: #""" - find("foobar", r'b.r') - """# - return: 3 - }, - { - title: "No matches" - source: #""" - find("foobar", "baz") - """# - return: null - }, - { - title: "With an offset" - source: #""" - find("foobarfoobarfoo", "bar", 4) - """# - return: 9 - }, - ] -} +{ + "remap": { + "functions": { + "find": { + "anchor": "find", + "name": "find", + "category": "String", + "description": "Determines from left to right the start position of the first found element in `value` that matches `pattern`. Returns `-1` if not found.", + "arguments": [ + { + "name": "value", + "description": "The string to find the pattern in.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "The regular expression or string pattern to match against.", + "required": true, + "type": [ + "string", + "regex" + ] + }, + { + "name": "from", + "description": "Offset to start searching.", + "required": false, + "type": [ + "integer" + ], + "default": "0" + } + ], + "return": { + "types": [ + "integer" + ] + }, + "examples": [ + { + "title": "Match text", + "source": "find(\"foobar\", \"bar\")", + "return": 3 + }, + { + "title": "Match text at start", + "source": "find(\"foobar\", \"foo\")", + "return": 0 + }, + { + "title": "Match regex", + "source": "find(\"foobar\", r'b.r')", + "return": 3 + }, + { + "title": "No matches", + "source": "find(\"foobar\", \"baz\")", + "return": null + }, + { + "title": "With an offset", + "source": "find(\"foobarfoobarfoo\", \"bar\", 4)", + "return": 9 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/find_enrichment_table_records.cue b/website/cue/reference/remap/functions/find_enrichment_table_records.cue index 1848f163edd4d..76a9a23bf8bf1 100644 --- a/website/cue/reference/remap/functions/find_enrichment_table_records.cue +++ b/website/cue/reference/remap/functions/find_enrichment_table_records.cue @@ -1,93 +1,127 @@ -package metadata - -remap: functions: find_enrichment_table_records: { - category: "Enrichment" - description: """ - Searches an [enrichment table](\(urls.enrichment_tables_concept)) for rows that match the - provided condition. - - \(remap._enrichment_table_explainer) - """ - - arguments: [ - { - name: "table" - description: "The [enrichment table](\(urls.enrichment_tables_concept)) to search." - required: true - type: ["string"] - }, - { - name: "condition" - description: """ - The condition to search on. Since the condition is used at boot time to create - indices into the data, these conditions must be statically defined. - """ - required: true - type: ["object"] - }, - { - name: "select" - description: """ - A subset of fields from the enrichment table to return. If not specified, - all fields are returned. - """ - required: false - type: ["array"] - }, - { - name: "case_sensitive" - description: "Whether text fields need to match cases exactly." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [] - return: types: ["array"] - - examples: [ - { - title: "Exact match" - source: #""" - find_enrichment_table_records!("test", - { - "surname": "smith", - }, - case_sensitive: false) - """# - return: [{"id": 1, "firstname": "Bob", "surname": "Smith"}, - {"id": 2, "firstname": "Fred", "surname": "Smith"}, - ] - }, - { - title: "Wildcard match" - source: #""" - find_enrichment_table_records!("test", - { - "firstname": "Bob", - }, - wildcard: "fred", - case_sensitive: false) - """# - return: [{"id": 1, "firstname": "Bob", "surname": "Smith"}, - {"id": 2, "firstname": "Fred", "surname": "Smith"}, - ] - }, - { - title: "Date range search" - source: #""" - find_enrichment_table_records!("test", - { - "surname": "Smith", - "date_of_birth": { - "from": t'1985-01-01T00:00:00Z', - "to": t'1985-12-31T00:00:00Z' - } - }) - """# - return: [{"id": 1, "firstname": "Bob", "surname": "Smith"}, - {"id": 2, "firstname": "Fred", "surname": "Smith"}, - ] - }, - ] -} +{ + "remap": { + "functions": { + "find_enrichment_table_records": { + "anchor": "find_enrichment_table_records", + "name": "find_enrichment_table_records", + "category": "Enrichment", + "description": "Searches an [enrichment table](/docs/reference/glossary/#enrichment-tables) for rows that match the provided condition.\n\nFor `file` enrichment tables, this condition needs to be a VRL object in which\nthe key-value pairs indicate a field to search mapped to a value to search in that field.\nThis function returns the rows that match the provided condition(s). _All_ fields need to\nmatch for rows to be returned; if any fields do not match, then no rows are returned.\n\nThere are currently three forms of search criteria:\n\n1. **Exact match search**. The given field must match the value exactly. Case sensitivity\n can be specified using the `case_sensitive` argument. An exact match search can use an\n index directly into the dataset, which should make this search fairly \"cheap\" from a\n performance perspective.\n\n2. **Wildcard match search**. The given fields specified by the exact match search may also\n be matched exactly to the value provided to the `wildcard` parameter.\n A wildcard match search can also use an index directly into the dataset.\n\n3. **Date range search**. The given field must be greater than or equal to the `from` date\n and/or less than or equal to the `to` date. A date range search involves\n sequentially scanning through the rows that have been located using any exact match\n criteria. This can be an expensive operation if there are many rows returned by any exact\n match criteria. Therefore, use date ranges as the _only_ criteria when the enrichment\n data set is very small.\n\nFor `geoip` and `mmdb` enrichment tables, this condition needs to be a VRL object with a single key-value pair\nwhose value needs to be a valid IP address. Example: `{\"ip\": .ip }`. If a return field is expected\nand without a value, `null` is used. This table can return the following fields:\n\n* ISP databases:\n * `autonomous_system_number`\n * `autonomous_system_organization`\n * `isp`\n * `organization`\n\n* City databases:\n * `city_name`\n * `continent_code`\n * `country_code`\n * `country_name`\n * `region_code`\n * `region_name`\n * `metro_code`\n * `latitude`\n * `longitude`\n * `postal_code`\n * `timezone`\n\n* Connection-Type databases:\n * `connection_type`\n\nTo use this function, you need to update your configuration to\ninclude an\n[`enrichment_tables`](/docs/reference/configuration/global-options/#enrichment_tables)\nparameter.", + "arguments": [ + { + "name": "table", + "description": "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "condition", + "description": "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "select", + "description": "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", + "required": false, + "type": [ + "array" + ] + }, + { + "name": "case_sensitive", + "description": "Whether text fields need to match cases exactly.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "wildcard", + "description": "Value to use for wildcard matching in the search.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "examples": [ + { + "title": "Exact match", + "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"Smith\"}\n)\n", + "return": [ + { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + }, + { + "firstname": "Fred", + "id": 2, + "surname": "Smith" + } + ] + }, + { + "title": "Case insensitive match", + "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"smith\"},\n case_sensitive: false\n)\n", + "return": [ + { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + }, + { + "firstname": "Fred", + "id": 2, + "surname": "Smith" + } + ] + }, + { + "title": "Wildcard match", + "source": "find_enrichment_table_records!(\n \"test\",\n {\"firstname\": \"Bob\"},\n wildcard: \"fred\",\n case_sensitive: false\n)\n", + "return": [ + { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + }, + { + "firstname": "Fred", + "id": 2, + "surname": "Smith" + } + ] + }, + { + "title": "Date range search", + "source": "find_enrichment_table_records!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", + "return": [ + { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + }, + { + "firstname": "Fred", + "id": 2, + "surname": "Smith" + } + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/find_vector_metrics.cue b/website/cue/reference/remap/functions/find_vector_metrics.cue index dbfbd230a859d..e6ad660ed2c06 100644 --- a/website/cue/reference/remap/functions/find_vector_metrics.cue +++ b/website/cue/reference/remap/functions/find_vector_metrics.cue @@ -1,48 +1,73 @@ -package metadata - -remap: functions: find_vector_metrics: { - category: "Metrics" - description: """ - Searches internal Vector metrics by name and optionally by tags. Returns all matching - metrics. - - \(remap._vector_metrics_explainer) - """ - - arguments: [ - { - name: "key" - description: "The metric name to search." - required: true - type: ["string"] - }, - { - name: "tags" - description: """ - Tags to filter the results on. Values in this object support wildcards ('*') to - match on parts of the tag value. - """ - required: false - type: ["object"] - }, - ] - internal_failure_reasons: [] - return: types: ["array"] - - examples: [ - { - title: "Find vector internal metrics matching the name" - source: #""" - find_vector_metrics("utilization") - """# - return: [{"name": "utilization", "tags": {"component_id": ["test"]}, "type": "gauge", "kind": "absolute", "value": 0.5}] - }, - { - title: "Find vector internal metrics matching the name and tags" - source: #""" - find_vector_metrics("utilization", tags: {"component_id": "test"}) - """# - return: [{"name": "utilization", "tags": {"component_id": ["test"]}, "type": "gauge", "kind": "absolute", "value": 0.5}] - }, - ] -} +{ + "remap": { + "functions": { + "find_vector_metrics": { + "anchor": "find_vector_metrics", + "name": "find_vector_metrics", + "category": "Metrics", + "description": "Searches internal Vector metrics by name and optionally by tags. Returns all matching metrics.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", + "arguments": [ + { + "name": "key", + "description": "The metric name to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "tags", + "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + } + ], + "return": { + "types": [ + "array" + ] + }, + "examples": [ + { + "title": "Find vector internal metrics matching the name", + "source": "find_vector_metrics(\"utilization\")", + "return": [ + { + "kind": "absolute", + "name": "utilization", + "tags": { + "component_id": [ + "test" + ] + }, + "type": "gauge", + "value": 0.5 + } + ] + }, + { + "title": "Find vector internal metrics matching the name and tags", + "source": "find_vector_metrics(\"utilization\", tags: {\"component_id\": \"test\"})", + "return": [ + { + "kind": "absolute", + "name": "utilization", + "tags": { + "component_id": [ + "test" + ] + }, + "type": "gauge", + "value": 0.5 + } + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/flatten.cue b/website/cue/reference/remap/functions/flatten.cue index 13f86f79a2318..69675c83b1462 100644 --- a/website/cue/reference/remap/functions/flatten.cue +++ b/website/cue/reference/remap/functions/flatten.cue @@ -1,60 +1,75 @@ -package metadata - -remap: functions: flatten: { - category: "Enumerate" - description: #""" - Flattens the `value` into a single-level representation. - """# - - arguments: [ - { - name: "value" - description: "The array or object to flatten." - required: true - type: ["array", "object"] - }, - { - name: "separator" - description: "The separator to join nested keys" - required: false - default: "." - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array", "object"] - rules: [ - "The return type matches the `value` type.", - ] - } - - examples: [ - { - title: "Flatten array" - source: #""" - flatten([1, [2, 3, 4], [5, [6, 7], 8], 9]) - """# - return: [1, 2, 3, 4, 5, 6, 7, 8, 9] - }, - { - title: "Flatten object" - source: #""" - flatten({ - "parent1": { - "child1": 1, - "child2": 2 - }, - "parent2": { - "child3": 3 - } - }) - """# - return: { - "parent1.child1": 1 - "parent1.child2": 2 - "parent2.child3": 3 - } - }, - ] -} +{ + "remap": { + "functions": { + "flatten": { + "anchor": "flatten", + "name": "flatten", + "category": "Enumerate", + "description": "Flattens the `value` into a single-level representation.", + "arguments": [ + { + "name": "value", + "description": "The array or object to flatten.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "separator", + "description": "The separator to join nested keys", + "required": false, + "type": [ + "string" + ], + "default": "." + } + ], + "return": { + "types": [ + "object", + "array" + ], + "rules": [ + "The return type matches the `value` type." + ] + }, + "examples": [ + { + "title": "Flatten array", + "source": "flatten([1, [2, 3, 4], [5, [6, 7], 8], 9])", + "return": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ] + }, + { + "title": "Flatten object", + "source": "flatten({\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n})\n", + "return": { + "parent1.child1": 1, + "parent1.child2": 2, + "parent2.child3": 3 + } + }, + { + "title": "Flatten object with custom separator", + "source": "flatten({ \"foo\": { \"bar\": true }}, \"_\")", + "return": { + "foo_bar": true + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/float.cue b/website/cue/reference/remap/functions/float.cue index 122390344dcfa..730bc80ff8d25 100644 --- a/website/cue/reference/remap/functions/float.cue +++ b/website/cue/reference/remap/functions/float.cue @@ -1,38 +1,52 @@ -package metadata - -remap: functions: float: { - category: "Type" - description: """ - Returns `value` if it is a float, otherwise returns an error. This enables the type checker to guarantee that the - returned value is a float and can be used in any function that expects a float. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is a float." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not a float.", - ] - return: { - types: ["float"] - rules: [ - #"Returns the `value` if it's a float."#, - #"Raises an error if not a float."#, - ] - } - examples: [ - { - title: "Declare a float type" - input: log: value: 42.0 - source: #""" - float!(.value) - """# - return: input.log.value - }, - ] -} +{ + "remap": { + "functions": { + "float": { + "anchor": "float", + "name": "float", + "category": "Type", + "description": "Returns `value` if it is a float, otherwise returns an error. This enables the type checker to guarantee that the returned value is a float and can be used in any function that expects a float.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a float.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "float" + ], + "rules": [ + "Returns the `value` if it's a float.", + "Raises an error if not a float." + ] + }, + "internal_failure_reasons": [ + "`value` is not a float." + ], + "examples": [ + { + "title": "Declare a float type", + "source": ". = { \"value\": 42.0 }\nfloat(.value)\n", + "return": 42.0 + }, + { + "title": "Declare a float type (literal)", + "source": "float(3.1415)", + "return": 3.1415 + }, + { + "title": "Invalid float type", + "source": "float!(true)", + "raises": "function call error for \"float\" at (0:12): expected float, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/floor.cue b/website/cue/reference/remap/functions/floor.cue index 3c9bb578297c7..18c95e3b0a0fe 100644 --- a/website/cue/reference/remap/functions/floor.cue +++ b/website/cue/reference/remap/functions/floor.cue @@ -1,48 +1,54 @@ -package metadata - -remap: functions: floor: { - category: "Number" - description: #""" - Rounds the `value` down to the specified `precision`. - """# - - arguments: [ - { - name: "value" - description: "The number to round down." - required: true - type: ["integer", "float"] - }, - { - name: "precision" - description: "The number of decimal places to round to." - required: false - default: 0 - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer", "float"] - rules: [ - "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise.", - ] - } - - examples: [ - { - title: "Round a number down (without precision)" - source: #""" - floor(4.345) - """# - return: 4.0 - }, - { - title: "Round a number down (with precision)" - source: #""" - floor(4.345, precision: 2) - """# - return: 4.34 - }, - ] -} +{ + "remap": { + "functions": { + "floor": { + "anchor": "floor", + "name": "floor", + "category": "Number", + "description": "Rounds the `value` down to the specified `precision`.", + "arguments": [ + { + "name": "value", + "description": "The number to round down.", + "required": true, + "type": [ + "integer", + "float" + ] + }, + { + "name": "precision", + "description": "The number of decimal places to round to.", + "required": false, + "type": [ + "integer" + ], + "default": "0" + } + ], + "return": { + "types": [ + "integer", + "float" + ], + "rules": [ + "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise." + ] + }, + "examples": [ + { + "title": "Round a number down (without precision)", + "source": "floor(9.8)", + "return": 9.0 + }, + { + "title": "Round a number down (with precision)", + "source": "floor(4.345, precision: 2)", + "return": 4.34 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/for_each.cue b/website/cue/reference/remap/functions/for_each.cue index 2d7697e1c5462..c932216840c8c 100644 --- a/website/cue/reference/remap/functions/for_each.cue +++ b/website/cue/reference/remap/functions/for_each.cue @@ -1,57 +1,50 @@ -package metadata - -remap: functions: for_each: { - category: "Enumerate" - description: """ - Iterate over a collection. - - This function currently *does not* support recursive iteration. - - The function uses the "function closure syntax" to allow reading - the key/value or index/value combination for each item in the - collection. - - The same scoping rules apply to closure blocks as they do for - regular blocks. This means that any variable defined in parent scopes - is accessible, and mutations to those variables are preserved, - but any new variables instantiated in the closure block are - unavailable outside of the block. - - See the examples below to learn about the closure syntax. - """ - - arguments: [ - { - name: "value" - description: "The array or object to iterate." - required: true - type: ["array", "object"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["null"] - } - examples: [ - { - title: "Tally elements" - input: log: { - tags: ["foo", "bar", "foo", "baz"] - } - source: #""" - tally = {} - for_each(array!(.tags)) -> |_index, value| { - # Get the current tally for the `value`, or - # set to `0`. - count = int(get!(tally, [value])) ?? 0 - - # Increment the tally for the value by `1`. - tally = set!(tally, [value], count + 1) - } - - tally - """# - return: {"foo": 2, "bar": 1, "baz": 1} - }, - ] -} +{ + "remap": { + "functions": { + "for_each": { + "anchor": "for_each", + "name": "for_each", + "category": "Enumerate", + "description": "Iterate over a collection.\n\nThis function currently *does not* support recursive iteration.\n\nThe function uses the \"function closure syntax\" to allow reading\nthe key/value or index/value combination for each item in the\ncollection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", + "arguments": [ + { + "name": "value", + "description": "The array or object to iterate.", + "required": true, + "type": [ + "object", + "array" + ] + } + ], + "return": { + "types": [ + "null" + ] + }, + "examples": [ + { + "title": "Tally elements", + "source": ".tags = [\"foo\", \"bar\", \"foo\", \"baz\"]\ntally = {}\nfor_each(array(.tags)) -> |_index, value| {\n count = int(get!(tally, [value])) ?? 0\n tally = set!(tally, [value], count + 1)\n}\ntally\n", + "return": { + "bar": 1, + "baz": 1, + "foo": 2 + } + }, + { + "title": "Iterate over an object", + "source": "count = 0\nfor_each({ \"a\": 1, \"b\": 2 }) -> |_key, value| {\n count = count + value\n}\ncount\n", + "return": 3 + }, + { + "title": "Iterate over an array", + "source": "count = 0\nfor_each([1, 2, 3]) -> |index, value| {\n count = count + index + value\n}\ncount\n", + "return": 9 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/format_int.cue b/website/cue/reference/remap/functions/format_int.cue index dfa689ba42d5f..7f0332425b856 100644 --- a/website/cue/reference/remap/functions/format_int.cue +++ b/website/cue/reference/remap/functions/format_int.cue @@ -1,45 +1,57 @@ -package metadata - -remap: functions: format_int: { - category: "Number" - description: #""" - Formats the integer `value` into a string representation using the given base/radix. - """# - - arguments: [ - { - name: "value" - description: "The number to format." - required: true - type: ["integer"] - }, - { - name: "base" - description: "The base to format the number in. Must be between 2 and 36 (inclusive)." - required: false - type: ["integer"] - default: 10 - }, - ] - internal_failure_reasons: [ - "The base is not between 2 and 36.", - ] - return: types: ["string"] - - examples: [ - { - title: "Format as a hexadecimal integer" - source: #""" - format_int!(42, 16) - """# - return: "2a" - }, - { - title: "Format as a negative hexadecimal integer" - source: #""" - format_int!(-42, 16) - """# - return: "-2a" - }, - ] -} +{ + "remap": { + "functions": { + "format_int": { + "anchor": "format_int", + "name": "format_int", + "category": "Number", + "description": "Formats the integer `value` into a string representation using the given base/radix.", + "arguments": [ + { + "name": "value", + "description": "The number to format.", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "base", + "description": "The base to format the number in. Must be between 2 and 36 (inclusive).", + "required": false, + "type": [ + "integer" + ], + "default": "10" + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "The base is not between 2 and 36." + ], + "examples": [ + { + "title": "Format as a hexadecimal integer", + "source": "format_int!(42, 16)", + "return": "2a" + }, + { + "title": "Format as a negative hexadecimal integer", + "source": "format_int!(-42, 16)", + "return": "-2a" + }, + { + "title": "Format as a decimal integer (default base)", + "source": "format_int!(42)", + "return": "42" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/format_number.cue b/website/cue/reference/remap/functions/format_number.cue index c785f603790f4..5d8311fe032b3 100644 --- a/website/cue/reference/remap/functions/format_number.cue +++ b/website/cue/reference/remap/functions/format_number.cue @@ -1,49 +1,71 @@ -package metadata - -remap: functions: format_number: { - category: "Number" - description: #""" - Formats the `value` into a string representation of the number. - """# - - arguments: [ - { - name: "value" - description: "The number to format as a string." - required: true - type: ["integer", "float"] - }, - { - name: "scale" - description: "The number of decimal places to display." - required: false - type: ["integer"] - }, - { - name: "decimal_separator" - description: "The character to use between the whole and decimal parts of the number." - required: false - type: ["string"] - default: "." - }, - { - name: "grouping_separator" - description: "The character to use between each thousands part of the number." - required: false - type: ["string"] - default: "," - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Format a number (3 decimals)" - source: #""" - format_number(1234567.89, 3, decimal_separator: ".", grouping_separator: ",") - """# - return: "1,234,567.890" - }, - ] -} +{ + "remap": { + "functions": { + "format_number": { + "anchor": "format_number", + "name": "format_number", + "category": "Number", + "description": "Formats the `value` into a string representation of the number.", + "arguments": [ + { + "name": "value", + "description": "The number to format as a string.", + "required": true, + "type": [ + "integer", + "float" + ] + }, + { + "name": "scale", + "description": "The number of decimal places to display.", + "required": false, + "type": [ + "integer" + ] + }, + { + "name": "decimal_separator", + "description": "The character to use between the whole and decimal parts of the number.", + "required": false, + "type": [ + "string" + ], + "default": "." + }, + { + "name": "grouping_separator", + "description": "The character to use between each thousands part of the number.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Format a number (3 decimals)", + "source": "format_number(1234567.89, 3, decimal_separator: \".\", grouping_separator: \",\")", + "return": "1,234,567.890" + }, + { + "title": "Format a number with European-style separators", + "source": "format_number(4672.4, decimal_separator: \",\", grouping_separator: \"_\")", + "return": "4_672,4" + }, + { + "title": "Format a number with a middle dot separator", + "source": "format_number(4321.09, 3, decimal_separator: \"·\")", + "return": "4321·090" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/format_timestamp.cue b/website/cue/reference/remap/functions/format_timestamp.cue index 21db108fd17a0..8c7c9d2a75009 100644 --- a/website/cue/reference/remap/functions/format_timestamp.cue +++ b/website/cue/reference/remap/functions/format_timestamp.cue @@ -1,48 +1,66 @@ -package metadata - -remap: functions: format_timestamp: { - category: "Timestamp" - description: #""" - Formats `value` into a string representation of the timestamp. - """# - - arguments: [ - { - name: "value" - description: "The timestamp to format as text." - required: true - type: ["timestamp"] - }, - { - name: "format" - description: "The format string as described by the [Chrono library](\(urls.chrono_time_formats))." - required: true - type: ["string"] - }, - { - name: "timezone" - description: "The timezone to use when formatting the timestamp. The parameter uses the TZ identifier or `local`." - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Format a timestamp (ISO8601/RFC 3339)" - source: #""" - format_timestamp!(t'2020-10-21T16:00:00Z', format: "%+") - """# - return: "2020-10-21T16:00:00+00:00" - }, - { - title: "Format a timestamp (custom)" - source: #""" - format_timestamp!(t'2020-10-21T16:00:00Z', format: "%v %R") - """# - return: "21-Oct-2020 16:00" - }, - ] -} +{ + "remap": { + "functions": { + "format_timestamp": { + "anchor": "format_timestamp", + "name": "format_timestamp", + "category": "Timestamp", + "description": "Formats `value` into a string representation of the timestamp.", + "arguments": [ + { + "name": "value", + "description": "The timestamp to format as text.", + "required": true, + "type": [ + "timestamp" + ] + }, + { + "name": "format", + "description": "The format string as described by the [Chrono library](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers).", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "timezone", + "description": "The timezone to use when formatting the timestamp. The parameter uses the TZ identifier or `local`.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Format a timestamp (ISO8601/RFC 3339)", + "source": "format_timestamp!(t'2020-10-21T16:00:00Z', format: \"%+\")", + "return": "2020-10-21T16:00:00+00:00" + }, + { + "title": "Format a timestamp (custom)", + "source": "format_timestamp!(t'2020-10-21T16:00:00Z', format: \"%v %R\")", + "return": "21-Oct-2020 16:00" + }, + { + "title": "Format a timestamp with custom format string", + "source": "format_timestamp!(t'2021-02-10T23:32:00+00:00', format: \"%d %B %Y %H:%M\")", + "return": "10 February 2021 23:32" + }, + { + "title": "Format a timestamp with timezone conversion", + "source": "format_timestamp!(t'2021-02-10T23:32:00+00:00', format: \"%d %B %Y %H:%M\", timezone: \"Europe/Berlin\")", + "return": "11 February 2021 00:32" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/from_unix_timestamp.cue b/website/cue/reference/remap/functions/from_unix_timestamp.cue index a4eb4a1b08d38..e089336898215 100644 --- a/website/cue/reference/remap/functions/from_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/from_unix_timestamp.cue @@ -1,58 +1,65 @@ -package metadata - -remap: functions: from_unix_timestamp: { - category: "Convert" - description: """ - Converts the `value` integer from a [Unix timestamp](\(urls.unix_timestamp)) to a VRL `timestamp`. - - Converts from the number of seconds since the Unix epoch by default. To convert from milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`. - """ - - arguments: [ - { - name: "value" - description: "The Unix timestamp to convert." - required: true - type: ["integer"] - }, - { - name: "unit" - description: "The time unit." - type: ["string"] - required: false - enum: { - seconds: "Express Unix time in seconds" - milliseconds: "Express Unix time in milliseconds" - nanoseconds: "Express Unix time in nanoseconds" - microseconds: "Express Unix time in microseconds" - } - default: "seconds" - }, - ] - internal_failure_reasons: [] - return: types: ["timestamp"] - - examples: [ - { - title: "Convert from a Unix timestamp (seconds)" - source: #""" - from_unix_timestamp!(5) - """# - return: "1970-01-01T00:00:05Z" - }, - { - title: "Convert from a Unix timestamp (milliseconds)" - source: #""" - from_unix_timestamp!(5000, unit: "milliseconds") - """# - return: "1970-01-01T00:00:05Z" - }, - { - title: "Convert from a Unix timestamp (nanoseconds)" - source: #""" - from_unix_timestamp!(5000, unit: "nanoseconds") - """# - return: "1970-01-01T00:00:00.000005Z" - }, - ] -} +{ + "remap": { + "functions": { + "from_unix_timestamp": { + "anchor": "from_unix_timestamp", + "name": "from_unix_timestamp", + "category": "Convert", + "description": "Converts the `value` integer from a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) to a VRL `timestamp`.\n\nConverts from the number of seconds since the Unix epoch by default. To convert from milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`.", + "arguments": [ + { + "name": "value", + "description": "The Unix timestamp to convert.", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "unit", + "description": "The time unit.", + "required": false, + "type": [ + "string" + ], + "enum": { + "microseconds": "Express Unix time in microseconds", + "seconds": "Express Unix time in seconds", + "nanoseconds": "Express Unix time in nanoseconds", + "milliseconds": "Express Unix time in milliseconds" + }, + "default": "seconds" + } + ], + "return": { + "types": [ + "timestamp" + ] + }, + "examples": [ + { + "title": "Convert from a Unix timestamp (seconds)", + "source": "from_unix_timestamp!(5)", + "return": "t'1970-01-01T00:00:05Z'" + }, + { + "title": "Convert from a Unix timestamp (milliseconds)", + "source": "from_unix_timestamp!(5000, unit: \"milliseconds\")", + "return": "t'1970-01-01T00:00:05Z'" + }, + { + "title": "Convert from a Unix timestamp (microseconds)", + "source": "from_unix_timestamp!(5000, unit: \"microseconds\")", + "return": "t'1970-01-01T00:00:00.005Z'" + }, + { + "title": "Convert from a Unix timestamp (nanoseconds)", + "source": "from_unix_timestamp!(5000, unit: \"nanoseconds\")", + "return": "t'1970-01-01T00:00:00.000005Z'" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get.cue b/website/cue/reference/remap/functions/get.cue index bbdb3060e57df..c3178ae478dae 100644 --- a/website/cue/reference/remap/functions/get.cue +++ b/website/cue/reference/remap/functions/get.cue @@ -1,57 +1,97 @@ -package metadata - -remap: functions: get: { - category: "Path" - description: """ - Dynamically get the value of a given path. - - If you know the path you want to look up, use - static paths such as `.foo.bar[1]` to get the value of that - path. However, if you do not know the path names, - use the dynamic `get` function to get the requested - value. - """ - - arguments: [ - { - name: "value" - description: "The object or array to query." - required: true - type: ["object", "array"] - }, - { - name: "path" - description: "An array of path segments to look for the value." - required: true - type: ["array"] - }, - ] - internal_failure_reasons: [ - #"The `path` segment must be a string or an integer."#, - ] - return: types: ["any"] - - examples: [ - { - title: "single-segment top-level field" - source: #""" - get!(value: { "foo": "bar" }, path: ["foo"]) - """# - return: "bar" - }, - { - title: "multi-segment nested field" - source: #""" - get!(value: { "foo": { "bar": "baz" } }, path: ["foo", "bar"]) - """# - return: "baz" - }, - { - title: "array indexing" - source: #""" - get!(value: ["foo", "bar", "baz"], path: [-2]) - """# - return: "bar" - }, - ] -} +{ + "remap": { + "functions": { + "get": { + "anchor": "get", + "name": "get", + "category": "Path", + "description": "Dynamically get the value of a given path.\n\nIf you know the path you want to look up, use\nstatic paths such as `.foo.bar[1]` to get the value of that\npath. However, if you do not know the path names,\nuse the dynamic `get` function to get the requested value.", + "arguments": [ + { + "name": "value", + "description": "The object or array to query.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "path", + "description": "An array of path segments to look for the value.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "any" + ] + }, + "internal_failure_reasons": [ + "The `path` segment must be a string or an integer." + ], + "examples": [ + { + "title": "Single-segment top-level field", + "source": "get!(value: {\"foo\": \"bar\"}, path: [\"foo\"])", + "return": "bar" + }, + { + "title": "Returns null for unknown field", + "source": "get!(value: {\"foo\": \"bar\"}, path: [\"baz\"])", + "return": null + }, + { + "title": "Multi-segment nested field", + "source": "get!(value: {\"foo\": { \"bar\": true }}, path: [\"foo\", \"bar\"])", + "return": true + }, + { + "title": "Array indexing", + "source": "get!(value: [92, 42], path: [0])", + "return": 92 + }, + { + "title": "Array indexing (negative)", + "source": "get!(value: [\"foo\", \"bar\", \"baz\"], path: [-2])", + "return": "bar" + }, + { + "title": "Nested indexing", + "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1])", + "return": 42 + }, + { + "title": "External target", + "source": ". = { \"foo\": true }\nget!(value: ., path: [\"foo\"])\n", + "return": true + }, + { + "title": "Variable", + "source": "var = { \"foo\": true }\nget!(value: var, path: [\"foo\"])\n", + "return": true + }, + { + "title": "Missing index", + "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1, -1])", + "return": null + }, + { + "title": "Invalid indexing", + "source": "get!(value: [42], path: [\"foo\"])", + "return": null + }, + { + "title": "Invalid segment type", + "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", true])", + "raises": "function call error for \"get\" at (0:62): path segment must be either string or integer, not boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_enrichment_table_record.cue b/website/cue/reference/remap/functions/get_enrichment_table_record.cue index 9aae8266392b0..3cb6064631fe2 100644 --- a/website/cue/reference/remap/functions/get_enrichment_table_record.cue +++ b/website/cue/reference/remap/functions/get_enrichment_table_record.cue @@ -1,94 +1,94 @@ -package metadata - -remap: functions: get_enrichment_table_record: { - category: "Enrichment" - description: """ - Searches an [enrichment table](\(urls.enrichment_tables_concept)) for a row that matches the - provided condition. A single row must be matched. If no rows are found or more than one row is - found, an error is returned. - - \(remap._enrichment_table_explainer) - """ - - arguments: [ - { - name: "table" - description: "The [enrichment table](\(urls.enrichment_tables_concept)) to search." - required: true - type: ["string"] - }, - { - name: "condition" - description: """ - The condition to search on. Since the condition is used at boot time to create - indices into the data, these conditions must be statically defined. - """ - required: true - type: ["object"] - }, - { - name: "select" - description: """ - A subset of fields from the enrichment table to return. If not specified, - all fields are returned. - """ - required: false - type: ["array"] - }, - { - name: "case_sensitive" - description: "Whether the text fields match the case exactly." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [ - "The row is not found.", - "Multiple rows are found that match the condition.", - ] - return: types: ["object"] - - examples: [ - { - title: "Exact match" - source: #""" - get_enrichment_table_record!("test", - { - "surname": "bob", - "firstname": "John" - }, - case_sensitive: false) - """# - return: {"id": 1, "firstname": "Bob", "surname": "Smith"} - }, - { - title: "Wildcard match" - source: #""" - find_enrichment_table_records!("test", - { - "firstname": "Bob", - }, - wildcard: "fred", - case_sensitive: false) - """# - return: [{"id": 1, "firstname": "Bob", "surname": "Smith"}, - {"id": 2, "firstname": "Fred", "surname": "Smith"}, - ] - }, - { - title: "Date range search" - source: #""" - get_enrichment_table_record!("test", - { - "surname": "Smith", - "date_of_birth": { - "from": t'1985-01-01T00:00:00Z', - "to": t'1985-12-31T00:00:00Z' - } - }) - """# - return: {"id": 1, "firstname": "Bob", "surname": "Smith"} - }, - ] -} +{ + "remap": { + "functions": { + "get_enrichment_table_record": { + "anchor": "get_enrichment_table_record", + "name": "get_enrichment_table_record", + "category": "Enrichment", + "description": "Searches an [enrichment table](/docs/reference/glossary/#enrichment-tables) for a row that matches the provided condition. A single row must be matched. If no rows are found or more than one row is found, an error is returned.\n\nFor `file` enrichment tables, this condition needs to be a VRL object in which\nthe key-value pairs indicate a field to search mapped to a value to search in that field.\nThis function returns the rows that match the provided condition(s). _All_ fields need to\nmatch for rows to be returned; if any fields do not match, then no rows are returned.\n\nThere are currently three forms of search criteria:\n\n1. **Exact match search**. The given field must match the value exactly. Case sensitivity\n can be specified using the `case_sensitive` argument. An exact match search can use an\n index directly into the dataset, which should make this search fairly \"cheap\" from a\n performance perspective.\n\n2. **Wildcard match search**. The given fields specified by the exact match search may also\n be matched exactly to the value provided to the `wildcard` parameter.\n A wildcard match search can also use an index directly into the dataset.\n\n3. **Date range search**. The given field must be greater than or equal to the `from` date\n and/or less than or equal to the `to` date. A date range search involves\n sequentially scanning through the rows that have been located using any exact match\n criteria. This can be an expensive operation if there are many rows returned by any exact\n match criteria. Therefore, use date ranges as the _only_ criteria when the enrichment\n data set is very small.\n\nFor `geoip` and `mmdb` enrichment tables, this condition needs to be a VRL object with a single key-value pair\nwhose value needs to be a valid IP address. Example: `{\"ip\": .ip }`. If a return field is expected\nand without a value, `null` is used. This table can return the following fields:\n\n* ISP databases:\n * `autonomous_system_number`\n * `autonomous_system_organization`\n * `isp`\n * `organization`\n\n* City databases:\n * `city_name`\n * `continent_code`\n * `country_code`\n * `country_name`\n * `region_code`\n * `region_name`\n * `metro_code`\n * `latitude`\n * `longitude`\n * `postal_code`\n * `timezone`\n\n* Connection-Type databases:\n * `connection_type`\n\nTo use this function, you need to update your configuration to\ninclude an\n[`enrichment_tables`](/docs/reference/configuration/global-options/#enrichment_tables)\nparameter.", + "arguments": [ + { + "name": "table", + "description": "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "condition", + "description": "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "select", + "description": "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", + "required": false, + "type": [ + "array" + ] + }, + { + "name": "case_sensitive", + "description": "Whether the text fields match the case exactly.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "wildcard", + "description": "Value to use for wildcard matching in the search.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "The row is not found.", + "Multiple rows are found that match the condition." + ], + "examples": [ + { + "title": "Exact match", + "source": "get_enrichment_table_record!(\"test\", {\"id\": 1})", + "return": { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + } + }, + { + "title": "Case insensitive match", + "source": "get_enrichment_table_record!(\n \"test\",\n {\"surname\": \"bob\", \"firstname\": \"John\"},\n case_sensitive: false\n)\n", + "return": { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + } + }, + { + "title": "Date range search", + "source": "get_enrichment_table_record!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", + "return": { + "firstname": "Bob", + "id": 1, + "surname": "Smith" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_env_var.cue b/website/cue/reference/remap/functions/get_env_var.cue index b0cae2474dc17..2a0dde1abe05c 100644 --- a/website/cue/reference/remap/functions/get_env_var.cue +++ b/website/cue/reference/remap/functions/get_env_var.cue @@ -1,32 +1,39 @@ -package metadata - -remap: functions: get_env_var: { - category: "System" - description: """ - Returns the value of the environment variable specified by `name`. - """ - - arguments: [ - { - name: "name" - description: "The name of the environment variable." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "Environment variable `name` does not exist.", - "The value of environment variable `name` is not valid Unicode", - ] - return: types: ["string"] - - examples: [ - { - title: "Get an environment variable" - source: #""" - get_env_var!("HOME") - """# - return: "/root" - }, - ] -} +{ + "remap": { + "functions": { + "get_env_var": { + "anchor": "get_env_var", + "name": "get_env_var", + "category": "System", + "description": "Returns the value of the environment variable specified by `name`.", + "arguments": [ + { + "name": "name", + "description": "The name of the environment variable.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "Environment variable `name` does not exist.", + "The value of environment variable `name` is not valid Unicode" + ], + "examples": [ + { + "title": "Get an environment variable", + "source": "get_env_var!(\"HOME\")", + "return": "/root" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_hostname.cue b/website/cue/reference/remap/functions/get_hostname.cue index 474dc6949f113..1d46d584e9522 100644 --- a/website/cue/reference/remap/functions/get_hostname.cue +++ b/website/cue/reference/remap/functions/get_hostname.cue @@ -1,25 +1,29 @@ -package metadata - -remap: functions: get_hostname: { - category: "System" - description: """ - Returns the local system's hostname. - """ - - arguments: [] - internal_failure_reasons: [ - "Internal hostname resolution failed.", - ] - return: types: ["string"] - - examples: [ - { - title: "Get hostname" - input: log: {} - source: #""" - .hostname = get_hostname!() - """# - output: log: hostname: "localhost.localdomain" - }, - ] -} +{ + "remap": { + "functions": { + "get_hostname": { + "anchor": "get_hostname", + "name": "get_hostname", + "category": "System", + "description": "Returns the local system's hostname.", + "arguments": [], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "Internal hostname resolution failed." + ], + "examples": [ + { + "title": "Get hostname", + "source": "get_hostname!()", + "return": "my-hostname" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_secret.cue b/website/cue/reference/remap/functions/get_secret.cue index 8cd5e12844448..5e5a49fd8fa16 100644 --- a/website/cue/reference/remap/functions/get_secret.cue +++ b/website/cue/reference/remap/functions/get_secret.cue @@ -1,31 +1,41 @@ -package metadata - -remap: functions: get_secret: { - category: "Event" - description: """ - Returns the value of the given secret from an event. - """ - - arguments: [ - { - name: "key" - description: """ - The name of the secret. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Get the Datadog API key from the event metadata" - source: #""" - get_secret("datadog_api_key") - """# - return: "secret value" - }, - ] -} +{ + "remap": { + "functions": { + "get_secret": { + "anchor": "get_secret", + "name": "get_secret", + "category": "Event", + "description": "Returns the value of the given secret from an event.", + "arguments": [ + { + "name": "key", + "description": "The name of the secret.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string", + "null" + ] + }, + "examples": [ + { + "title": "Get the Datadog API key from the event metadata", + "source": "get_secret(\"datadog_api_key\")", + "return": "secret value" + }, + { + "title": "Get a non existent secret", + "source": "get_secret(\"i_dont_exist\")", + "return": null + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_timezone_name.cue b/website/cue/reference/remap/functions/get_timezone_name.cue index e094b1208a5b1..a31129dd09d11 100644 --- a/website/cue/reference/remap/functions/get_timezone_name.cue +++ b/website/cue/reference/remap/functions/get_timezone_name.cue @@ -1,31 +1,29 @@ -package metadata - -remap: functions: get_timezone_name: { - category: "System" - description: """ - Returns the name of the timezone in the Vector configuration (see - [global configuration options](\(urls.vector_configuration_global))). - If the configuration is set to `local`, then it attempts to - determine the name of the timezone from the host OS. If this - is not possible, then it returns the fixed offset of the - local timezone for the current time in the format `"[+-]HH:MM"`, - for example, `"+02:00"`. - """ - - arguments: [] - internal_failure_reasons: [ - "Retrieval of local timezone information failed.", - ] - return: types: ["string"] - - examples: [ - { - title: "Get the IANA name of Vector's timezone" - input: log: {} - source: #""" - .vector_timezone = get_timezone_name!() - """# - output: log: vector_timezone: "UTC" - }, - ] -} +{ + "remap": { + "functions": { + "get_timezone_name": { + "anchor": "get_timezone_name", + "name": "get_timezone_name", + "category": "System", + "description": "Returns the name of the timezone in the Vector configuration (see\n[global configuration options](/docs/reference/configuration/global-options)).\nIf the configuration is set to `local`, then it attempts to\ndetermine the name of the timezone from the host OS. If this\nis not possible, then it returns the fixed offset of the\nlocal timezone for the current time in the format `\"[+-]HH:MM\"`,\nfor example, `\"+02:00\"`.", + "arguments": [], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "Retrieval of local timezone information failed." + ], + "examples": [ + { + "title": "Get the IANA name of Vector's timezone", + "source": "get_timezone_name!()", + "return": "UTC" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/get_vector_metric.cue b/website/cue/reference/remap/functions/get_vector_metric.cue index 2ecb5ee6948f5..896b9060afa54 100644 --- a/website/cue/reference/remap/functions/get_vector_metric.cue +++ b/website/cue/reference/remap/functions/get_vector_metric.cue @@ -1,48 +1,70 @@ -package metadata - -remap: functions: get_vector_metric: { - category: "Metrics" - description: """ - Searches internal Vector metrics by name and optionally by tags. Returns the first matching - metric. - - \(remap._vector_metrics_explainer) - """ - - arguments: [ - { - name: "key" - description: "The metric name to search." - required: true - type: ["string"] - }, - { - name: "tags" - description: """ - Tags to filter the results on. Values in this object support wildcards ('*') to - match on parts of the tag value. - """ - required: false - type: ["object"] - }, - ] - internal_failure_reasons: [] - return: types: ["object"] - - examples: [ - { - title: "Get a vector internal metric matching the name" - source: #""" - get_vector_metric("utilization") - """# - return: {"name": "utilization", "tags": {"component_id": ["test"]}, "type": "gauge", "kind": "absolute", "value": 0.5} - }, - { - title: "Get a vector internal metric matching the name and tags" - source: #""" - get_vector_metric("utilization", tags: {"component_id": "test"}) - """# - return: {"name": "utilization", "tags": {"component_id": ["test"]}, "type": "gauge", "kind": "absolute", "value": 0.5} - }, - ] -} +{ + "remap": { + "functions": { + "get_vector_metric": { + "anchor": "get_vector_metric", + "name": "get_vector_metric", + "category": "Metrics", + "description": "Searches internal Vector metrics by name and optionally by tags. Returns the first matching metric.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", + "arguments": [ + { + "name": "key", + "description": "The metric name to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "tags", + "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + } + ], + "return": { + "types": [ + "object", + "null" + ] + }, + "examples": [ + { + "title": "Get a vector internal metric matching the name", + "source": "get_vector_metric(\"utilization\")", + "return": { + "kind": "absolute", + "name": "utilization", + "tags": { + "component_id": [ + "test" + ] + }, + "type": "gauge", + "value": 0.5 + } + }, + { + "title": "Get a vector internal metric matching the name and tags", + "source": "get_vector_metric(\"utilization\", tags: {\"component_id\": \"test\"})", + "return": { + "kind": "absolute", + "name": "utilization", + "tags": { + "component_id": [ + "test" + ] + }, + "type": "gauge", + "value": 0.5 + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/haversine.cue b/website/cue/reference/remap/functions/haversine.cue index ce186df426fea..5665d40d0bdaa 100644 --- a/website/cue/reference/remap/functions/haversine.cue +++ b/website/cue/reference/remap/functions/haversine.cue @@ -1,72 +1,82 @@ -package metadata - -remap: functions: haversine: { - category: "Map" - description: """ - Calculates [haversine](\(urls.haversine)) distance and bearing between two points. - Results are available in kilometers or miles. - """ - - arguments: [ - { - name: "latitude1" - description: "Latitude of the first point." - required: true - type: ["float"] - }, - { - name: "longitude1" - description: "Longitude of the first point." - required: true - type: ["float"] - }, - { - name: "latitude2" - description: "Latitude of the second point." - required: true - type: ["float"] - }, - { - name: "longitude2" - description: "Longitude of the second point." - required: true - type: ["float"] - }, - { - name: "measurement" - description: "Measurement system to use for resulting distance." - required: false - type: ["string"] - default: "kilometers" - enum: { - kilometers: "Use kilometers for the resulting distance." - miles: "Use miles for the resulting distance." - } - }, - ] - internal_failure_reasons: [] - return: types: ["object"] - - examples: [ - { - title: "Haversine in kilometers" - source: #""" - haversine(0.0, 0.0, 10.0, 10.0) - """# - return: { - distance: 1568.5227233 - bearing: 44.561 - } - }, - { - title: "Haversine in miles" - source: #""" - haversine(0.0, 0.0, 10.0, 10.0, "miles") - """# - return: { - distance: 974.6348468 - bearing: 44.561 - } - }, - ] -} +{ + "remap": { + "functions": { + "haversine": { + "anchor": "haversine", + "name": "haversine", + "category": "Map", + "description": "Calculates [haversine](https://en.wikipedia.org/wiki/Haversine_formula) distance and bearing between two points.", + "arguments": [ + { + "name": "latitude1", + "description": "Latitude of the first point.", + "required": true, + "type": [ + "float" + ] + }, + { + "name": "longitude1", + "description": "Longitude of the first point.", + "required": true, + "type": [ + "float" + ] + }, + { + "name": "latitude2", + "description": "Latitude of the second point.", + "required": true, + "type": [ + "float" + ] + }, + { + "name": "longitude2", + "description": "Longitude of the second point.", + "required": true, + "type": [ + "float" + ] + }, + { + "name": "measurement_unit", + "description": "Measurement system to use for resulting distance.", + "required": false, + "type": [ + "string" + ], + "enum": { + "miles": "Use miles for the resulting distance.", + "kilometers": "Use kilometers for the resulting distance." + } + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Haversine in kilometers", + "source": "haversine(0.0, 0.0, 10.0, 10.0)", + "return": { + "bearing": 44.561, + "distance": 1568.5227233 + } + }, + { + "title": "Haversine in miles", + "source": "haversine(0.0, 0.0, 10.0, 10.0, measurement_unit: \"miles\")", + "return": { + "bearing": 44.561, + "distance": 974.6348468 + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/hmac.cue b/website/cue/reference/remap/functions/hmac.cue index 5d6972352f7c6..9f10e9a4d3685 100644 --- a/website/cue/reference/remap/functions/hmac.cue +++ b/website/cue/reference/remap/functions/hmac.cue @@ -1,75 +1,74 @@ -package metadata - -remap: functions: hmac: { - category: "Cryptography" - description: """ - Calculates a [HMAC](\(urls.hmac)) of the `value` using the given `key`. - The hashing `algorithm` used can be optionally specified. - - For most use cases, the resulting bytestream should be encoded into a hex or base64 - string using either [encode_base16](\(urls.vrl_functions)/#encode_base16) or - [encode_base64](\(urls.vrl_functions)/#encode_base64). - - This function is infallible if either the default `algorithm` value or a recognized-valid compile-time - `algorithm` string literal is used. Otherwise, it is fallible. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the HMAC for." - required: true - type: ["string"] - }, - { - name: "key" - description: "The string to use as the cryptographic key." - required: true - type: ["string"] - }, - { - name: "algorithm" - description: "The hashing algorithm to use." - enum: { - "SHA1": "SHA1 algorithm" - "SHA-224": "SHA-224 algorithm" - "SHA-256": "SHA-256 algorithm" - "SHA-384": "SHA-384 algorithm" - "SHA-512": "SHA-512 algorithm" - } - required: false - default: "SHA-256" - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Calculate message HMAC (defaults: SHA-256), encoding to a base64 string" - source: #""" - encode_base64(hmac("Hello there", "super-secret-key")) - """# - return: "eLGE8YMviv85NPXgISRUZxstBNSU47JQdcXkUWcClmI=" - }, - { - title: "Calculate message HMAC using SHA-224, encoding to a hex-encoded string" - source: #""" - encode_base16(hmac("Hello there", "super-secret-key", algorithm: "SHA-224")) - """# - return: "42fccbc2b7d22a143b92f265a8046187558a94d11ddbb30622207e90" - }, - { - title: "Calculate message HMAC using a variable hash algorithm" - source: #""" - .hash_algo = "SHA-256" - hmac_bytes, err = hmac("Hello there", "super-secret-key", algorithm: .hash_algo) - if err == null { - .hmac = encode_base16(hmac_bytes) - } - """# - return: "78b184f1832f8aff3934f5e0212454671b2d04d494e3b25075c5e45167029662" - }, - ] -} +{ + "remap": { + "functions": { + "hmac": { + "anchor": "hmac", + "name": "hmac", + "category": "Cryptography", + "description": "Calculates a [HMAC](https://en.wikipedia.org/wiki/HMAC) of the `value` using the given `key`.\nThe hashing `algorithm` used can be optionally specified.\n\nFor most use cases, the resulting bytestream should be encoded into a hex or base64\nstring using either [encode_base16](/docs/reference/vrl/functions/#encode_base16) or\n[encode_base64](/docs/reference/vrl/functions/#encode_base64).\n\nThis function is infallible if either the default `algorithm` value or a recognized-valid compile-time\n`algorithm` string literal is used. Otherwise, it is fallible.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the HMAC for.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key", + "description": "The string to use as the cryptographic key.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "algorithm", + "description": "The hashing algorithm to use.", + "required": false, + "type": [ + "string" + ], + "enum": { + "SHA-256": "SHA-256 algorithm", + "SHA-384": "SHA-384 algorithm", + "SHA-512": "SHA-512 algorithm", + "SHA1": "SHA1 algorithm", + "SHA-224": "SHA-224 algorithm" + }, + "default": "SHA-256" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Calculate message HMAC (defaults: SHA-256), encoding to a base64 string", + "source": "encode_base64(hmac(\"Hello there\", \"super-secret-key\"))", + "return": "eLGE8YMviv85NPXgISRUZxstBNSU47JQdcXkUWcClmI=" + }, + { + "title": "Calculate message HMAC using SHA-224, encoding to a hex-encoded string", + "source": "encode_base16(hmac(\"Hello there\", \"super-secret-key\", algorithm: \"SHA-224\"))", + "return": "42fccbc2b7d22a143b92f265a8046187558a94d11ddbb30622207e90" + }, + { + "title": "Calculate message HMAC using SHA1, encoding to a base64 string", + "source": "encode_base64(hmac(\"Hello there\", \"super-secret-key\", algorithm: \"SHA1\"))", + "return": "MiyBIHO8Set9+6crALiwkS0yFPE=" + }, + { + "title": "Calculate message HMAC using a variable hash algorithm", + "source": ".hash_algo = \"SHA-256\"\nhmac_bytes, err = hmac(\"Hello there\", \"super-secret-key\", algorithm: .hash_algo)\nif err == null {\n .hmac = encode_base16(hmac_bytes)\n}\n", + "return": "78b184f1832f8aff3934f5e0212454671b2d04d494e3b25075c5e45167029662" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/http_request.cue b/website/cue/reference/remap/functions/http_request.cue new file mode 100644 index 0000000000000..6e2c56a4c34d8 --- /dev/null +++ b/website/cue/reference/remap/functions/http_request.cue @@ -0,0 +1,109 @@ +{ + "remap": { + "functions": { + "http_request": { + "anchor": "http_request", + "name": "http_request", + "category": "System", + "description": "Makes an HTTP request to the specified URL. This function performs synchronous blocking operations and is not recommended for frequent or performance-critical workflows due to potential network-related delays.", + "arguments": [ + { + "name": "url", + "description": "The URL to make the HTTP request to.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "method", + "description": "The HTTP method to use (e.g., GET, POST, PUT, DELETE). Defaults to GET.", + "required": false, + "type": [ + "string" + ], + "default": "get" + }, + { + "name": "headers", + "description": "An object containing HTTP headers to send with the request.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + }, + { + "name": "body", + "description": "The request body content to send.", + "required": false, + "type": [ + "string" + ], + "default": "" + }, + { + "name": "http_proxy", + "description": "HTTP proxy URL to use for the request.", + "required": false, + "type": [ + "string" + ] + }, + { + "name": "https_proxy", + "description": "HTTPS proxy URL to use for the request.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Basic HTTP request", + "source": "http_request(\"https://httpbin.org/get\")", + "return": { + "args": {}, + "headers": { + "Accept": "*/*", + "Host": "httpbin.org" + }, + "url": "https://httpbin.org/get" + } + }, + { + "title": "HTTP request with bearer token", + "source": "http_request(\"https://httpbin.org/bearer\", headers: {\"Authorization\": \"Bearer my_token\"})", + "return": { + "authenticated": true, + "token": "my_token" + } + }, + { + "title": "HTTP PUT request", + "source": "http_request(\"https://httpbin.org/put\", method: \"put\")", + "return": { + "args": {}, + "data": "", + "url": "https://httpbin.org/put" + } + }, + { + "title": "HTTP POST request with body", + "source": "http_request(\"https://httpbin.org/post\", method: \"post\", body: \"{\\\"data\\\":{\\\"hello\\\":\\\"world\\\"}}\")", + "return": { + "data": "{\"data\":{\"hello\":\"world\"}}" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/includes.cue b/website/cue/reference/remap/functions/includes.cue index 2719c42e1401e..b643d33601e79 100644 --- a/website/cue/reference/remap/functions/includes.cue +++ b/website/cue/reference/remap/functions/includes.cue @@ -1,35 +1,53 @@ -package metadata - -remap: functions: includes: { - category: "Enumerate" - description: """ - Determines whether the `value` array includes the specified `item`. - """ - - arguments: [ - { - name: "value" - description: "The array." - required: true - type: ["array"] - }, - { - name: "item" - description: "The item to check." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Array includes" - source: #""" - includes(["apple", "orange", "banana"], "banana") - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "includes": { + "anchor": "includes", + "name": "includes", + "category": "Enumerate", + "description": "Determines whether the `value` array includes the specified `item`.", + "arguments": [ + { + "name": "value", + "description": "The array.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "item", + "description": "The item to check.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Array includes", + "source": "includes([\"apple\", \"orange\", \"banana\"], \"banana\")", + "return": true + }, + { + "title": "Includes boolean", + "source": "includes([1, true], true)", + "return": true + }, + { + "title": "Doesn't include", + "source": "includes([\"foo\", \"bar\"], \"baz\")", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/int.cue b/website/cue/reference/remap/functions/int.cue index 6d754a63ffd4a..01d1b8d54e37a 100644 --- a/website/cue/reference/remap/functions/int.cue +++ b/website/cue/reference/remap/functions/int.cue @@ -1,38 +1,52 @@ -package metadata - -remap: functions: int: { - category: "Type" - description: """ - Returns `value` if it is an integer, otherwise returns an error. This enables the type checker to guarantee that the - returned value is an integer and can be used in any function that expects an integer. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is an integer." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not an integer.", - ] - return: { - types: ["integer"] - rules: [ - #"Returns the `value` if it's an integer."#, - #"Raises an error if not an integer."#, - ] - } - examples: [ - { - title: "Declare an integer type" - input: log: value: 42 - source: #""" - int!(.value) - """# - return: input.log.value - }, - ] -} +{ + "remap": { + "functions": { + "int": { + "anchor": "int", + "name": "int", + "category": "Type", + "description": "Returns `value` if it is an integer, otherwise returns an error. This enables the type checker to guarantee that the returned value is an integer and can be used in any function that expects an integer.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an integer.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "integer" + ], + "rules": [ + "Returns the `value` if it's an integer.", + "Raises an error if not an integer." + ] + }, + "internal_failure_reasons": [ + "`value` is not an integer." + ], + "examples": [ + { + "title": "Declare an integer type", + "source": ". = { \"value\": 42 }\nint(.value)\n", + "return": 42 + }, + { + "title": "Declare an integer type (literal)", + "source": "int(42)", + "return": 42 + }, + { + "title": "Invalid integer type", + "source": "int!(true)", + "raises": "function call error for \"int\" at (0:10): expected integer, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_aton.cue b/website/cue/reference/remap/functions/ip_aton.cue index ec0e9faa32b32..e19255309349c 100644 --- a/website/cue/reference/remap/functions/ip_aton.cue +++ b/website/cue/reference/remap/functions/ip_aton.cue @@ -1,34 +1,38 @@ -package metadata - -remap: functions: ip_aton: { - category: "IP" - description: """ - Converts IPv4 address in numbers-and-dots notation into network-order - bytes represented as an integer. - - This behavior mimics [inet_aton](\(urls.ip_aton)). - """ - - arguments: [ - { - name: "value" - description: "The IP address to convert to binary." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid IPv4 address.", - ] - return: types: ["integer"] - - examples: [ - { - title: "IPv4 to integer" - source: #""" - ip_aton!("1.2.3.4") - """# - return: 16909060 - }, - ] -} +{ + "remap": { + "functions": { + "ip_aton": { + "anchor": "ip_aton", + "name": "ip_aton", + "category": "IP", + "description": "Converts IPv4 address in numbers-and-dots notation into network-order\nbytes represented as an integer.\n\nThis behavior mimics [inet_aton](https://linux.die.net/man/3/inet_aton).", + "arguments": [ + { + "name": "value", + "description": "The IP address to convert to binary.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid IPv4 address." + ], + "examples": [ + { + "title": "IPv4 to integer", + "source": "ip_aton!(\"1.2.3.4\")", + "return": 16909060 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_cidr_contains.cue b/website/cue/reference/remap/functions/ip_cidr_contains.cue index ea435ec498c74..da66fedb2af15 100644 --- a/website/cue/reference/remap/functions/ip_cidr_contains.cue +++ b/website/cue/reference/remap/functions/ip_cidr_contains.cue @@ -1,52 +1,68 @@ -package metadata - -remap: functions: ip_cidr_contains: { - category: "IP" - description: """ - Determines whether the `ip` is contained in the block referenced by the `cidr`. - """ - - arguments: [ - { - name: "cidr" - description: "The CIDR mask (v4 or v6)." - required: true - type: ["string", "array"] - }, - { - name: "ip" - description: "The IP address (v4 or v6)." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`cidr` is not a valid CIDR.", - "`ip` is not a valid IP address.", - ] - return: types: ["boolean"] - - examples: [ - { - title: "IPv4 contains CIDR" - source: #""" - ip_cidr_contains!("192.168.0.0/16", "192.168.10.32") - """# - return: true - }, - { - title: "IPv4 is private" - source: #""" - ip_cidr_contains!(["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"], "192.168.10.32") - """# - return: true - }, - { - title: "IPv6 contains CIDR" - source: #""" - ip_cidr_contains!("2001:4f8:4:ba::/64", "2001:4f8:4:ba:2e0:81ff:fe22:d1f1") - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "ip_cidr_contains": { + "anchor": "ip_cidr_contains", + "name": "ip_cidr_contains", + "category": "IP", + "description": "Determines whether the `ip` is contained in the block referenced by the `cidr`.", + "arguments": [ + { + "name": "cidr", + "description": "The CIDR mask (v4 or v6).", + "required": true, + "type": [ + "string", + "array" + ] + }, + { + "name": "value", + "description": "The IP address (v4 or v6).", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "internal_failure_reasons": [ + "`cidr` is not a valid CIDR.", + "`ip` is not a valid IP address." + ], + "examples": [ + { + "title": "IPv4 contains CIDR", + "source": "ip_cidr_contains!(\"192.168.0.0/16\", \"192.168.10.32\")", + "return": true + }, + { + "title": "IPv4 is private", + "source": "ip_cidr_contains!([\"10.0.0.0/8\", \"172.16.0.0/12\", \"192.168.0.0/16\"], \"192.168.10.32\")", + "return": true + }, + { + "title": "IPv6 contains CIDR", + "source": "ip_cidr_contains!(\"2001:4f8:4:ba::/64\", \"2001:4f8:4:ba:2e0:81ff:fe22:d1f1\")", + "return": true + }, + { + "title": "Not in range", + "source": "ip_cidr_contains!(\"192.168.0.0/24\", \"192.168.10.32\")", + "return": false + }, + { + "title": "Invalid address", + "source": "ip_cidr_contains!(\"192.168.0.0/24\", \"INVALID\")", + "raises": "function call error for \"ip_cidr_contains\" at (0:46): unable to parse IP address: invalid IP address syntax" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_ntoa.cue b/website/cue/reference/remap/functions/ip_ntoa.cue index 26cb3aa300835..8325318db0786 100644 --- a/website/cue/reference/remap/functions/ip_ntoa.cue +++ b/website/cue/reference/remap/functions/ip_ntoa.cue @@ -1,34 +1,38 @@ -package metadata - -remap: functions: ip_ntoa: { - category: "IP" - description: """ - Converts numeric representation of IPv4 address in network-order bytes - to numbers-and-dots notation. - - This behavior mimics [inet_ntoa](\(urls.ip_ntoa)). - """ - - arguments: [ - { - name: "value" - description: "The integer representation of an IPv4 address." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` cannot fit in an unsigned 32-bit integer.", - ] - return: types: ["string"] - - examples: [ - { - title: "Integer to IPv4" - source: #""" - ip_ntoa!(16909060) - """# - return: "1.2.3.4" - }, - ] -} +{ + "remap": { + "functions": { + "ip_ntoa": { + "anchor": "ip_ntoa", + "name": "ip_ntoa", + "category": "IP", + "description": "Converts numeric representation of IPv4 address in network-order bytes\nto numbers-and-dots notation.\n\nThis behavior mimics [inet_ntoa](https://linux.die.net/man/3/inet_ntoa).", + "arguments": [ + { + "name": "value", + "description": "The integer representation of an IPv4 address.", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` cannot fit in an unsigned 32-bit integer." + ], + "examples": [ + { + "title": "Integer to IPv4", + "source": "ip_ntoa!(16909060)", + "return": "1.2.3.4" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_ntop.cue b/website/cue/reference/remap/functions/ip_ntop.cue index 4389b8fd386d7..ca34fc1728556 100644 --- a/website/cue/reference/remap/functions/ip_ntop.cue +++ b/website/cue/reference/remap/functions/ip_ntop.cue @@ -1,52 +1,46 @@ -package metadata - -remap: functions: ip_ntop: { - category: "IP" - description: """ - Converts IPv4 and IPv6 addresses from binary to text form. - - This behavior mimics [inet_ntop](\(urls.ip_ntop)). - """ - - notices: [ - """ - The binary data for this function is not easily printable. - However, the results from functions such as `decode_base64` or - `decode_percent` can still be used correctly. - """, - ] - - arguments: [ - { - name: "value" - description: """ - The binary data to convert from. - For IPv4 addresses, it must be 4 bytes (32 bits) long. - For IPv6 addresses, it must be 16 bytes (128 bits) long. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` must be of length 4 or 16 bytes.", - ] - return: types: ["string"] - - examples: [ - { - title: "Convert IPv4 address from bytes after decoding from Base64" - source: #""" - ip_ntop!(decode_base64!("wKgAAQ==")) - """# - return: "192.168.0.1" - }, - { - title: "Convert IPv6 address from bytes after decoding from Base64" - source: #""" - ip_ntop!(decode_base64!("IAENuIWjAAAAAIouA3BzNA==")) - """# - return: "2001:db8:85a3::8a2e:370:7334" - }, - ] -} +{ + "remap": { + "functions": { + "ip_ntop": { + "anchor": "ip_ntop", + "name": "ip_ntop", + "category": "IP", + "description": "Converts IPv4 and IPv6 addresses from binary to text form.\n\nThis behavior mimics [inet_ntop](https://linux.die.net/man/3/inet_ntop).", + "arguments": [ + { + "name": "value", + "description": "The binary data to convert from.\nFor IPv4 addresses, it must be 4 bytes (32 bits) long.\nFor IPv6 addresses, it must be 16 bytes (128 bits) long.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` must be of length 4 or 16 bytes." + ], + "examples": [ + { + "title": "Convert IPv4 address from bytes after decoding from Base64", + "source": "ip_ntop!(decode_base64!(\"wKgAAQ==\"))", + "return": "192.168.0.1" + }, + { + "title": "Convert IPv6 address from bytes after decoding from Base64", + "source": "ip_ntop!(decode_base64!(\"IAENuIWjAAAAAIouA3BzNA==\"))", + "return": "2001:db8:85a3::8a2e:370:7334" + } + ], + "notices": [ + "The binary data for this function is not easily printable. However, the results from\nfunctions such as `decode_base64` or `decode_percent` can still be used correctly." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_pton.cue b/website/cue/reference/remap/functions/ip_pton.cue index 2ec24fe4df180..071b68302e433 100644 --- a/website/cue/reference/remap/functions/ip_pton.cue +++ b/website/cue/reference/remap/functions/ip_pton.cue @@ -1,51 +1,46 @@ -package metadata - -remap: functions: ip_pton: { - category: "IP" - description: """ - Converts IPv4 and IPv6 addresses from text to binary form. - - * The binary form of IPv4 addresses is 4 bytes (32 bits) long. - * The binary form of IPv6 addresses is 16 bytes (128 bits) long. - - This behavior mimics [inet_pton](\(urls.ip_pton)). - """ - - notices: [ - """ - The binary data from this function is not easily printable. - However, functions such as `encode_base64` or `encode_percent` can - still process it correctly. - """, - ] - - arguments: [ - { - name: "value" - description: "The IP address (v4 or v6) to convert to binary form." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid IP (v4 or v6) address in text form.", - ] - return: types: ["string"] - - examples: [ - { - title: "Convert IPv4 address to bytes and encode to Base64" - source: #""" - encode_base64(ip_pton!("192.168.0.1")) - """# - return: "wKgAAQ==" - }, - { - title: "Convert IPv6 address to bytes and encode to Base64" - source: #""" - encode_base64(ip_pton!("2001:db8:85a3::8a2e:370:7334")) - """# - return: "IAENuIWjAAAAAIouA3BzNA==" - }, - ] -} +{ + "remap": { + "functions": { + "ip_pton": { + "anchor": "ip_pton", + "name": "ip_pton", + "category": "IP", + "description": "Converts IPv4 and IPv6 addresses from text to binary form.\n\n* The binary form of IPv4 addresses is 4 bytes (32 bits) long.\n* The binary form of IPv6 addresses is 16 bytes (128 bits) long.\n\nThis behavior mimics [inet_pton](https://linux.die.net/man/3/inet_pton).", + "arguments": [ + { + "name": "value", + "description": "The IP address (v4 or v6) to convert to binary form.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid IP (v4 or v6) address in text form." + ], + "examples": [ + { + "title": "Convert IPv4 address to bytes and encode to Base64", + "source": "encode_base64(ip_pton!(\"192.168.0.1\"))", + "return": "wKgAAQ==" + }, + { + "title": "Convert IPv6 address to bytes and encode to Base64", + "source": "encode_base64(ip_pton!(\"2001:db8:85a3::8a2e:370:7334\"))", + "return": "IAENuIWjAAAAAIouA3BzNA==" + } + ], + "notices": [ + "The binary data from this function is not easily printable. However, functions such as\n`encode_base64` or `encode_percent` can still process it correctly." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_subnet.cue b/website/cue/reference/remap/functions/ip_subnet.cue index 42b0a45df69be..575e09925e4ad 100644 --- a/website/cue/reference/remap/functions/ip_subnet.cue +++ b/website/cue/reference/remap/functions/ip_subnet.cue @@ -1,54 +1,60 @@ -package metadata - -remap: functions: ip_subnet: { - category: "IP" - description: """ - Extracts the subnet address from the `ip` using the supplied `subnet`. - """ - notices: [ - """ - Works with both IPv4 and IPv6 addresses. The IP version for the mask must be the same as the supplied - address. - """, - ] - - arguments: [ - { - name: "ip" - description: "The IP address (v4 or v6)." - required: true - type: ["string"] - }, - { - name: "subnet" - description: #""" - The subnet to extract from the IP address. This can be either a prefix length like `/8` or a net mask - like `255.255.0.0`. The net mask can be either an IPv4 or IPv6 address. - """# - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`ip` is not a valid IP address.", - "`subnet` is not a valid subnet.", - ] - return: types: ["string"] - - examples: [ - { - title: "IPv4 subnet" - source: #""" - ip_subnet!("192.168.10.32", "255.255.255.0") - """# - return: "192.168.10.0" - }, - { - title: "IPv6 subnet" - source: #""" - ip_subnet!("2404:6800:4003:c02::64", "/32") - """# - return: "2404:6800::" - }, - ] -} +{ + "remap": { + "functions": { + "ip_subnet": { + "anchor": "ip_subnet", + "name": "ip_subnet", + "category": "IP", + "description": "Extracts the subnet address from the `ip` using the supplied `subnet`.", + "arguments": [ + { + "name": "value", + "description": "The IP address (v4 or v6).", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "subnet", + "description": "The subnet to extract from the IP address. This can be either a prefix length like `/8` or a net mask\nlike `255.255.0.0`. The net mask can be either an IPv4 or IPv6 address.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`ip` is not a valid IP address.", + "`subnet` is not a valid subnet." + ], + "examples": [ + { + "title": "IPv4 subnet", + "source": "ip_subnet!(\"192.168.10.32\", \"255.255.255.0\")", + "return": "192.168.10.0" + }, + { + "title": "IPv6 subnet", + "source": "ip_subnet!(\"2404:6800:4003:c02::64\", \"/32\")", + "return": "2404:6800::" + }, + { + "title": "Subnet /1", + "source": "ip_subnet!(\"192.168.0.1\", \"/1\")", + "return": "128.0.0.0" + } + ], + "notices": [ + "Works with both IPv4 and IPv6 addresses. The IP version for the mask must be the same as\nthe supplied address." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ip_to_ipv6.cue b/website/cue/reference/remap/functions/ip_to_ipv6.cue index d1eb75082d8f2..3e82877446d2a 100644 --- a/website/cue/reference/remap/functions/ip_to_ipv6.cue +++ b/website/cue/reference/remap/functions/ip_to_ipv6.cue @@ -1,37 +1,42 @@ -package metadata - -remap: functions: ip_to_ipv6: { - category: "IP" - description: """ - Converts the `ip` to an IPv6 address. - """ - - arguments: [ - { - name: "ip" - description: "The IP address to convert to IPv6." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`ip` is not a valid IP address.", - ] - return: { - types: ["string"] - rules: [ - "The `ip` is returned unchanged if it's already an IPv6 address.", - "The `ip` is converted to an IPv6 address if it's an IPv4 address.", - ] - } - - examples: [ - { - title: "IPv4 to IPv6" - source: #""" - ip_to_ipv6!("192.168.10.32") - """# - return: "::ffff:192.168.10.32" - }, - ] -} +{ + "remap": { + "functions": { + "ip_to_ipv6": { + "anchor": "ip_to_ipv6", + "name": "ip_to_ipv6", + "category": "IP", + "description": "Converts the `ip` to an IPv6 address.", + "arguments": [ + { + "name": "value", + "description": "The IP address to convert to IPv6.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ], + "rules": [ + "The `ip` is returned unchanged if it's already an IPv6 address.", + "The `ip` is converted to an IPv6 address if it's an IPv4 address." + ] + }, + "internal_failure_reasons": [ + "`ip` is not a valid IP address." + ], + "examples": [ + { + "title": "IPv4 to IPv6", + "source": "ip_to_ipv6!(\"192.168.10.32\")", + "return": "::ffff:192.168.10.32" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue b/website/cue/reference/remap/functions/ipv6_to_ipv4.cue index fab14bde1117a..759f6388294e7 100644 --- a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue +++ b/website/cue/reference/remap/functions/ipv6_to_ipv4.cue @@ -1,41 +1,42 @@ -package metadata - -remap: functions: ipv6_to_ipv4: { - category: "IP" - description: """ - Converts the `ip` to an IPv4 address. `ip` is returned unchanged if it's already an IPv4 address. If `ip` is - currently an IPv6 address then it needs to be IPv4 compatible, otherwise an error is thrown. - """ - - arguments: [ - { - name: "ip" - description: "The IPv4-mapped IPv6 address to convert." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`ip` is not a valid IP address.", - "`ip` is an IPv6 address that is not compatible with IPv4.", - ] - return: { - types: ["string"] - rules: [ - """ - The `ip` is returned unchanged if it's already an IPv4 address. If it's an IPv6 address it must be IPv4 - compatible, otherwise an error is thrown. - """, - ] - } - - examples: [ - { - title: "IPv6 to IPv4" - source: #""" - ipv6_to_ipv4!("::ffff:192.168.0.1") - """# - return: "192.168.0.1" - }, - ] -} +{ + "remap": { + "functions": { + "ipv6_to_ipv4": { + "anchor": "ipv6_to_ipv4", + "name": "ipv6_to_ipv4", + "category": "IP", + "description": "Converts the `ip` to an IPv4 address. `ip` is returned unchanged if it's already an IPv4 address. If `ip` is\ncurrently an IPv6 address then it needs to be IPv4 compatible, otherwise an error is thrown.", + "arguments": [ + { + "name": "value", + "description": "The IPv4-mapped IPv6 address to convert.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ], + "rules": [ + "The `ip` is returned unchanged if it's already an IPv4 address. If it's an IPv6 address it must be IPv4\ncompatible, otherwise an error is thrown." + ] + }, + "internal_failure_reasons": [ + "`ip` is not a valid IP address.", + "`ip` is an IPv6 address that is not compatible with IPv4." + ], + "examples": [ + { + "title": "IPv6 to IPv4", + "source": "ipv6_to_ipv4!(\"::ffff:192.168.0.1\")", + "return": "192.168.0.1" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_array.cue b/website/cue/reference/remap/functions/is_array.cue index a72eb1589c94f..2f0b34b68f3db 100644 --- a/website/cue/reference/remap/functions/is_array.cue +++ b/website/cue/reference/remap/functions/is_array.cue @@ -1,42 +1,54 @@ -package metadata - -remap: functions: is_array: { - category: "Type" - description: """ - Check if the `value`'s type is an array. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is an array."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is an array."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid array" - source: """ - is_array([1, 2, 3]) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_array("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_array": { + "anchor": "is_array", + "name": "is_array", + "category": "Type", + "description": "Check if the `value`'s type is an array.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an array.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is an array.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid array", + "source": "is_array([1, 2, 3])", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_array(\"a string\")", + "return": false + }, + { + "title": "Boolean", + "source": "is_array(true)", + "return": false + }, + { + "title": "Null", + "source": "is_array(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_boolean.cue b/website/cue/reference/remap/functions/is_boolean.cue index e4e7ce3a3b610..c863596f444fb 100644 --- a/website/cue/reference/remap/functions/is_boolean.cue +++ b/website/cue/reference/remap/functions/is_boolean.cue @@ -1,42 +1,49 @@ -package metadata - -remap: functions: is_boolean: { - category: "Type" - description: """ - Check if the `value`'s type is a boolean. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a Boolean."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a boolean."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid boolean" - source: """ - is_boolean(false) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_boolean("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_boolean": { + "anchor": "is_boolean", + "name": "is_boolean", + "category": "Type", + "description": "Check if the `value`'s type is a boolean.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a Boolean.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a boolean.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid boolean", + "source": "is_boolean(false)", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_boolean(\"a string\")", + "return": false + }, + { + "title": "Null", + "source": "is_boolean(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_empty.cue b/website/cue/reference/remap/functions/is_empty.cue index 0aa22c1d2dd73..f653ad335ecee 100644 --- a/website/cue/reference/remap/functions/is_empty.cue +++ b/website/cue/reference/remap/functions/is_empty.cue @@ -1,49 +1,66 @@ -package metadata - -remap: functions: is_empty: { - category: "Type" - description: """ - Check if the object, array, or string has a length of `0`. - """ - - arguments: [ - { - name: "value" - description: #"The value to check."# - required: true - type: ["object", "array", "string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is empty."#, - #"Returns `false` if `value` is non-empty."#, - ] - } - - examples: [ - { - title: "Empty array" - source: """ - is_empty([]) - """ - return: true - }, - { - title: "Non-empty string" - source: """ - is_empty("a string") - """ - return: false - }, - { - title: "Non-empty object" - source: """ - is_empty({"foo": "bar"}) - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_empty": { + "anchor": "is_empty", + "name": "is_empty", + "category": "Type", + "description": "Check if the object, array, or string has a length of `0`.", + "arguments": [ + { + "name": "value", + "description": "The value to check.", + "required": true, + "type": [ + "string", + "object", + "array" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is empty.", + "Returns `false` if `value` is non-empty." + ] + }, + "examples": [ + { + "title": "Empty array", + "source": "is_empty([])", + "return": true + }, + { + "title": "Non-empty string", + "source": "is_empty(\"a string\")", + "return": false + }, + { + "title": "Non-empty object", + "source": "is_empty({\"foo\": \"bar\"})", + "return": false + }, + { + "title": "Empty string", + "source": "is_empty(\"\")", + "return": true + }, + { + "title": "Empty object", + "source": "is_empty({})", + "return": true + }, + { + "title": "Non-empty array", + "source": "is_empty([1,2,3])", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_float.cue b/website/cue/reference/remap/functions/is_float.cue index a50f1c964907c..ea4762f7324be 100644 --- a/website/cue/reference/remap/functions/is_float.cue +++ b/website/cue/reference/remap/functions/is_float.cue @@ -1,42 +1,54 @@ -package metadata - -remap: functions: is_float: { - category: "Type" - description: """ - Check if the `value`'s type is a float. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a float."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a float."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid float" - source: """ - is_float(0.577) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_float("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_float": { + "anchor": "is_float", + "name": "is_float", + "category": "Type", + "description": "Check if the `value`'s type is a float.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a float.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a float.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid float", + "source": "is_float(0.577)", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_float(\"a string\")", + "return": false + }, + { + "title": "Boolean", + "source": "is_float(true)", + "return": false + }, + { + "title": "Null", + "source": "is_float(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_integer.cue b/website/cue/reference/remap/functions/is_integer.cue index 6148399aee575..81c94a9a2b6d7 100644 --- a/website/cue/reference/remap/functions/is_integer.cue +++ b/website/cue/reference/remap/functions/is_integer.cue @@ -1,42 +1,49 @@ -package metadata - -remap: functions: is_integer: { - category: "Type" - description: """ - Check if the value`'s type is an integer. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is an integer."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is an integer."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid integer" - source: """ - is_integer(1) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_integer("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_integer": { + "anchor": "is_integer", + "name": "is_integer", + "category": "Type", + "description": "Check if the `value`'s type is an integer.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an integer.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is an integer.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid integer", + "source": "is_integer(1)", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_integer(\"a string\")", + "return": false + }, + { + "title": "Null", + "source": "is_integer(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_ipv4.cue b/website/cue/reference/remap/functions/is_ipv4.cue index fc3a20a94fcdd..1e29c7425a55c 100644 --- a/website/cue/reference/remap/functions/is_ipv4.cue +++ b/website/cue/reference/remap/functions/is_ipv4.cue @@ -1,53 +1,49 @@ -package metadata - -remap: functions: is_ipv4: { - category: "IP" - description: """ - Check if the string is a valid IPv4 address or not. - - An [IPv4-mapped][https://datatracker.ietf.org/doc/html/rfc6890] or - [IPv4-compatible][https://datatracker.ietf.org/doc/html/rfc6890] IPv6 address is not considered - valid for the purpose of this function. - """ - - arguments: [ - { - name: "value" - description: "The IP address to check" - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a valid IPv4 address."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid IPv4 address" - source: """ - is_ipv4("10.0.102.37") - """ - return: true - }, - { - title: "Valid IPv6 address" - source: """ - is_ipv4("2001:0db8:85a3:0000:0000:8a2e:0370:7334") - """ - return: false - }, - { - title: "Arbitrary string" - source: """ - is_ipv4("foobar") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_ipv4": { + "anchor": "is_ipv4", + "name": "is_ipv4", + "category": "IP", + "description": "Check if the string is a valid IPv4 address or not.\n\nAn [IPv4-mapped](https://datatracker.ietf.org/doc/html/rfc6890) or\n[IPv4-compatible](https://datatracker.ietf.org/doc/html/rfc6890) IPv6 address is not considered\nvalid for the purpose of this function.", + "arguments": [ + { + "name": "value", + "description": "The IP address to check", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a valid IPv4 address.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid IPv4 address", + "source": "is_ipv4(\"10.0.102.37\")", + "return": true + }, + { + "title": "Valid IPv6 address", + "source": "is_ipv4(\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\")", + "return": false + }, + { + "title": "Arbitrary string", + "source": "is_ipv4(\"foobar\")", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_ipv6.cue b/website/cue/reference/remap/functions/is_ipv6.cue index 14761f3e3ace8..67c17ed2b57ae 100644 --- a/website/cue/reference/remap/functions/is_ipv6.cue +++ b/website/cue/reference/remap/functions/is_ipv6.cue @@ -1,49 +1,49 @@ -package metadata - -remap: functions: is_ipv6: { - category: "IP" - description: """ - Check if the string is a valid IPv6 address or not. - """ - - arguments: [ - { - name: "value" - description: "The IP address to check" - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a valid IPv6 address."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid IPv6 address" - source: """ - is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334") - """ - return: true - }, - { - title: "Valid IPv4 address" - source: """ - is_ipv6("10.0.102.37") - """ - return: false - }, - { - title: "Arbitrary string" - source: """ - is_ipv6("foobar") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_ipv6": { + "anchor": "is_ipv6", + "name": "is_ipv6", + "category": "IP", + "description": "Check if the string is a valid IPv6 address or not.", + "arguments": [ + { + "name": "value", + "description": "The IP address to check", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a valid IPv6 address.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid IPv6 address", + "source": "is_ipv6(\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\")", + "return": true + }, + { + "title": "Valid IPv4 address", + "source": "is_ipv6(\"10.0.102.37\")", + "return": false + }, + { + "title": "Arbitrary string", + "source": "is_ipv6(\"foobar\")", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_json.cue b/website/cue/reference/remap/functions/is_json.cue index 2a24a2e606e36..98049f9f40522 100644 --- a/website/cue/reference/remap/functions/is_json.cue +++ b/website/cue/reference/remap/functions/is_json.cue @@ -1,70 +1,75 @@ -package metadata - -remap: functions: is_json: { - category: "Type" - description: """ - Check if the string is a valid JSON document. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a valid JSON document."# - required: true - type: ["string"] - }, - { - name: "variant" - description: "The variant of the JSON type to explicitly check for." - enum: { - "object": "JSON object - {}" - "array": "JSON array - []" - "string": "JSON-formatted string values wrapped with quote marks" - "number": "Integer or float numbers" - "bool": "True or false" - "null": "Exact null value" - } - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a valid JSON document."#, - #"Returns `false` if `value` is not JSON-formatted."#, - ] - } - - examples: [ - { - title: "Valid JSON object" - source: """ - is_json("{}") - """ - return: true - }, - { - title: "Non-valid value" - source: """ - is_json("{") - """ - return: false - }, - { - title: "Exact variant" - source: """ - is_json("{}", variant: "object") - """ - return: true - }, - { - title: "Non-valid exact variant" - source: """ - is_json("{}", variant: "array") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_json": { + "anchor": "is_json", + "name": "is_json", + "category": "Type", + "description": "Check if the string is a valid JSON document.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a valid JSON document.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "variant", + "description": "The variant of the JSON type to explicitly check for.", + "required": false, + "type": [ + "string" + ], + "enum": { + "number": "Integer or float numbers", + "bool": "True or false", + "object": "JSON object - {}", + "array": "JSON array - []", + "null": "Exact null value", + "string": "JSON-formatted string values wrapped with quote marks" + } + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a valid JSON document.", + "Returns `false` if `value` is not JSON-formatted." + ] + }, + "examples": [ + { + "title": "Valid JSON object", + "source": "is_json(\"{}\")", + "return": true + }, + { + "title": "Non-valid value", + "source": "is_json(\"{\")", + "return": false + }, + { + "title": "Exact variant", + "source": "is_json(\"{}\", variant: \"object\")", + "return": true + }, + { + "title": "Non-valid exact variant", + "source": "is_json(\"{}\", variant: \"array\")", + "return": false + }, + { + "title": "Valid JSON string", + "source": "is_json(s'\"test\"')", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_null.cue b/website/cue/reference/remap/functions/is_null.cue index bc85c5c378480..0338cccc2ac4a 100644 --- a/website/cue/reference/remap/functions/is_null.cue +++ b/website/cue/reference/remap/functions/is_null.cue @@ -1,43 +1,49 @@ -package metadata - -remap: functions: is_null: { - category: "Type" - description: """ - Check if `value`'s type is `null`. For a more relaxed function, - see [`is_nullish`](\(urls.vrl_functions)#\(remap.functions.is_nullish.anchor)). - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is `null`."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is null."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Null value" - source: """ - is_null(null) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_null("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_null": { + "anchor": "is_null", + "name": "is_null", + "category": "Type", + "description": "Check if `value`'s type is `null`. For a more relaxed function, see [`is_nullish`](/docs/reference/vrl/functions#is_nullish).", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is `null`.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is null.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Null value", + "source": "is_null(null)", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_null(\"a string\")", + "return": false + }, + { + "title": "Array", + "source": "is_null([1, 2, 3])", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_nullish.cue b/website/cue/reference/remap/functions/is_nullish.cue index 7f3adaa0f4dcd..9ba4fe413e276 100644 --- a/website/cue/reference/remap/functions/is_nullish.cue +++ b/website/cue/reference/remap/functions/is_nullish.cue @@ -1,59 +1,59 @@ -package metadata - -remap: functions: is_nullish: { - category: "Type" - description: """ - Determines whether `value` is nullish. Returns `true` if the specified `value` is `null`, - an empty string, a string containing only whitespace, or the string `"-"`. Returns `false` otherwise. - """ - - notices: [ - """ - This function behaves inconsistently: it returns `false` for empty arrays (`[]`) and objects (`{}`), - but `true` for empty strings (`""`) and `null`. - """, - ] - - arguments: [ - { - name: "value" - description: #"The value to check for nullishness, for example, a useless value."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is `null`."#, - #"Returns `true` if `value` is `"-"`."#, - #"Returns `true` if `value` is whitespace as defined by [Unicode `White_Space` property](\#(urls.unicode_whitespace))."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Null detection (blank string)" - source: """ - is_nullish("") - """ - return: true - }, - { - title: "Null detection (dash string)" - source: """ - is_nullish("-") - """ - return: true - }, - { - title: "Null detection (whitespace)" - source: """ - is_nullish("\n \n") - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "is_nullish": { + "anchor": "is_nullish", + "name": "is_nullish", + "category": "Type", + "description": "Determines whether `value` is nullish. Returns `true` if the specified `value` is `null`, an empty string, a string containing only whitespace, or the string `\"-\"`. Returns `false` otherwise.", + "arguments": [ + { + "name": "value", + "description": "The value to check for nullishness, for example, a useless value.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is `null`.", + "Returns `true` if `value` is `\"-\"`.", + "Returns `true` if `value` is whitespace as defined by [Unicode `White_Space` property](https://en.wikipedia.org/wiki/Unicode_character_property#Whitespace).", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Null detection (blank string)", + "source": "is_nullish(\"\")", + "return": true + }, + { + "title": "Null detection (dash string)", + "source": "is_nullish(\"-\")", + "return": true + }, + { + "title": "Null detection (whitespace)", + "source": "is_nullish(\"\n \n\")", + "return": true + }, + { + "title": "Null", + "source": "is_nullish(null)", + "return": true + } + ], + "notices": [ + "This function behaves inconsistently: it returns `false` for empty arrays (`[]`) and\nobjects (`{}`), but `true` for empty strings (`\"\"`) and `null`." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_object.cue b/website/cue/reference/remap/functions/is_object.cue index 86258aa1ca2c4..40482acd11a1d 100644 --- a/website/cue/reference/remap/functions/is_object.cue +++ b/website/cue/reference/remap/functions/is_object.cue @@ -1,42 +1,49 @@ -package metadata - -remap: functions: is_object: { - category: "Type" - description: """ - Check if `value`'s type is an object. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is an object."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is an object."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid object" - source: """ - is_object({"foo": "bar"}) - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_object("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_object": { + "anchor": "is_object", + "name": "is_object", + "category": "Type", + "description": "Check if `value`'s type is an object.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an object.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is an object.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid object", + "source": "is_object({\"foo\": \"bar\"})", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_object(\"a string\")", + "return": false + }, + { + "title": "Boolean", + "source": "is_object(true)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_regex.cue b/website/cue/reference/remap/functions/is_regex.cue index 4693aebaa0b5e..c59da40e56ff3 100644 --- a/website/cue/reference/remap/functions/is_regex.cue +++ b/website/cue/reference/remap/functions/is_regex.cue @@ -1,42 +1,49 @@ -package metadata - -remap: functions: is_regex: { - category: "Type" - description: """ - Check if `value`'s type is a regex. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a regex."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a regex."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid regex" - source: """ - is_regex(r'pattern') - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_regex("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_regex": { + "anchor": "is_regex", + "name": "is_regex", + "category": "Type", + "description": "Check if `value`'s type is a regex.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a regex.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a regex.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid regex", + "source": "is_regex(r'pattern')", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_regex(\"a string\")", + "return": false + }, + { + "title": "Null value", + "source": "is_regex(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_string.cue b/website/cue/reference/remap/functions/is_string.cue index fd1a3b9c7c8ba..e7890a0aeece6 100644 --- a/website/cue/reference/remap/functions/is_string.cue +++ b/website/cue/reference/remap/functions/is_string.cue @@ -1,42 +1,54 @@ -package metadata - -remap: functions: is_string: { - category: "Type" - description: """ - Check if `value`'s type is a string. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a string."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a string."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid string" - source: """ - is_string("a string") - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_string([1, 2, 3]) - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_string": { + "anchor": "is_string", + "name": "is_string", + "category": "Type", + "description": "Check if `value`'s type is a string.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a string.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a string.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid string", + "source": "is_string(\"a string\")", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_string([1, 2, 3])", + "return": false + }, + { + "title": "Boolean", + "source": "is_string(true)", + "return": false + }, + { + "title": "Null", + "source": "is_string(null)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/is_timestamp.cue b/website/cue/reference/remap/functions/is_timestamp.cue index 54f24b4d9b474..0b87e2eb9041e 100644 --- a/website/cue/reference/remap/functions/is_timestamp.cue +++ b/website/cue/reference/remap/functions/is_timestamp.cue @@ -1,42 +1,49 @@ -package metadata - -remap: functions: is_timestamp: { - category: "Type" - description: """ - Check if `value`'s type is a timestamp. - """ - - arguments: [ - { - name: "value" - description: #"The value to check if it is a timestamp."# - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` is a timestamp."#, - #"Returns `false` if `value` is anything else."#, - ] - } - - examples: [ - { - title: "Valid timestamp" - source: """ - is_timestamp(t'2021-03-26T16:00:00Z') - """ - return: true - }, - { - title: "Non-matching type" - source: """ - is_timestamp("a string") - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "is_timestamp": { + "anchor": "is_timestamp", + "name": "is_timestamp", + "category": "Type", + "description": "Check if `value`'s type is a timestamp.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a timestamp.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` is a timestamp.", + "Returns `false` if `value` is anything else." + ] + }, + "examples": [ + { + "title": "Valid timestamp", + "source": "is_timestamp(t'2021-03-26T16:00:00Z')", + "return": true + }, + { + "title": "Non-matching type", + "source": "is_timestamp(\"a string\")", + "return": false + }, + { + "title": "Boolean value", + "source": "is_timestamp(true)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/join.cue b/website/cue/reference/remap/functions/join.cue index fb699d1bcca5e..760c9a47aeced 100644 --- a/website/cue/reference/remap/functions/join.cue +++ b/website/cue/reference/remap/functions/join.cue @@ -1,45 +1,48 @@ -package metadata - -remap: functions: join: { - category: "String" - description: #""" - Joins each string in the `value` array into a single string, with items optionally separated from one another - by a `separator`. - """# - - arguments: [ - { - name: "value" - description: "The array of strings to join together." - required: true - type: ["array"] - }, - { - name: "separator" - description: "The string separating each original element when joined." - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["string"] - } - - examples: [ - { - title: "Join array (no separator)" - source: #""" - join!(["bring", "us", "together"]) - """# - return: "bringustogether" - }, - { - title: "Join array (comma separator)" - source: #""" - join!(["sources", "transforms", "sinks"], separator: ", ") - """# - return: "sources, transforms, sinks" - }, - ] -} +{ + "remap": { + "functions": { + "join": { + "anchor": "join", + "name": "join", + "category": "String", + "description": "Joins each string in the `value` array into a single string, with items optionally separated from one another by a `separator`.", + "arguments": [ + { + "name": "value", + "description": "The array of strings to join together.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "separator", + "description": "The string separating each original element when joined.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Join array (no separator)", + "source": "join!([\"bring\", \"us\", \"together\"])", + "return": "bringustogether" + }, + { + "title": "Join array (comma separator)", + "source": "join!([\"sources\", \"transforms\", \"sinks\"], separator: \", \")", + "return": "sources, transforms, sinks" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/kebabcase.cue b/website/cue/reference/remap/functions/kebabcase.cue index 8e113b7d2189c..fd6a340bba904 100644 --- a/website/cue/reference/remap/functions/kebabcase.cue +++ b/website/cue/reference/remap/functions/kebabcase.cue @@ -1,43 +1,60 @@ -package metadata - -remap: functions: kebabcase: { - category: "String" - description: """ - Takes the `value` string, and turns it into kebab-case. Optionally, you can - pass in the existing case of the function, or else we will try to figure out the case automatically. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to kebab-case." - required: true - type: ["string"] - }, - { - name: "original_case" - description: "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case" - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "kebab-case a string" - source: #""" - kebabcase("InputString") - """# - return: "input-string" - }, - { - title: "kebab-case a string" - source: #""" - kebabcase("InputString", "PascalCase") - """# - return: "input-string" - }, - ] -} +{ + "remap": { + "functions": { + "kebabcase": { + "anchor": "kebabcase", + "name": "kebabcase", + "category": "String", + "description": "Takes the `value` string, and turns it into kebab-case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to kebab-case.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "original_case", + "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", + "required": false, + "type": [ + "string" + ], + "enum": { + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + } + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "kebab-case a string without specifying original case", + "source": "kebabcase(\"InputString\")", + "return": "input-string" + }, + { + "title": "kebab-case a snake_case string", + "source": "kebabcase(\"foo_bar_baz\", \"snake_case\")", + "return": "foo-bar-baz" + }, + { + "title": "kebab-case specifying the wrong original case (noop)", + "source": "kebabcase(\"foo_bar_baz\", \"PascalCase\")", + "return": "foo_bar_baz" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/keys.cue b/website/cue/reference/remap/functions/keys.cue index be3c493fa612f..70098a2c13cb0 100644 --- a/website/cue/reference/remap/functions/keys.cue +++ b/website/cue/reference/remap/functions/keys.cue @@ -1,37 +1,41 @@ -package metadata - -remap: functions: keys: { - category: "Enumerate" - description: #""" - Returns the keys from the object passed into the function. - """# - - arguments: [ - { - name: "value" - description: "The object to extract keys from." - required: true - type: ["object"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - rules: [ - #"Returns an array of all the keys"#, - ] - } - examples: [ - { - title: "Get keys from the object" - input: log: { - "key1": "val1" - "key2": "val2" - } - source: #""" - keys({"key1": "val1", "key2": "val2"}) - """# - return: ["key1", "key2"] - }, - ] -} +{ + "remap": { + "functions": { + "keys": { + "anchor": "keys", + "name": "keys", + "category": "Enumerate", + "description": "Returns the keys from the object passed into the function.", + "arguments": [ + { + "name": "value", + "description": "The object to extract keys from.", + "required": true, + "type": [ + "object" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Returns an array of all the keys" + ] + }, + "examples": [ + { + "title": "Get keys from the object", + "source": "keys({\n \"key1\": \"val1\",\n \"key2\": \"val2\"\n})\n", + "return": [ + "key1", + "key2" + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/length.cue b/website/cue/reference/remap/functions/length.cue index 9f685e66c5697..bf8a044cd8268 100644 --- a/website/cue/reference/remap/functions/length.cue +++ b/website/cue/reference/remap/functions/length.cue @@ -1,75 +1,57 @@ -package metadata - -remap: functions: length: { - category: "Enumerate" - // the `return` rules below aren't rendered so we copy them here - description: """ - Returns the length of the `value`. - - * If `value` is an array, returns the number of elements. - * If `value` is an object, returns the number of top-level keys. - * If `value` is a string, returns the number of bytes in the string. If - you want the number of characters, see `strlen`. - """ - - arguments: [ - { - name: "value" - description: "The array or object." - required: true - type: ["array", "object", "string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer"] - rules: [ - "If `value` is an array, returns the number of elements.", - "If `value` is an object, returns the number of top-level keys.", - "If `value` is a string, returns the number of bytes in the string.", - ] - } - - examples: [ - { - title: "Length (object)" - source: """ - length({ - "portland": "Trail Blazers", - "seattle": "Supersonics" - }) - """ - return: 2 - }, - { - title: "Length (nested object)" - source: """ - length({ - "home": { - "city": "Portland", - "state": "Oregon" - }, - "name": "Trail Blazers", - "mascot": { - "name": "Blaze the Trail Cat" - } - }) - """ - return: 3 - }, - { - title: "Length (array)" - source: """ - length(["Trail Blazers", "Supersonics", "Grizzlies"]) - """ - return: 3 - }, - { - title: "Length (string)" - source: """ - length("The Planet of the Apes Musical") - """ - return: 30 - }, - ] -} +{ + "remap": { + "functions": { + "length": { + "anchor": "length", + "name": "length", + "category": "Enumerate", + "description": "Returns the length of the `value`.\n\n* If `value` is an array, returns the number of elements.\n* If `value` is an object, returns the number of top-level keys.\n* If `value` is a string, returns the number of bytes in the string. If\n you want the number of characters, see `strlen`.", + "arguments": [ + { + "name": "value", + "description": "The array or object.", + "required": true, + "type": [ + "string", + "object", + "array" + ] + } + ], + "return": { + "types": [ + "integer" + ], + "rules": [ + "If `value` is an array, returns the number of elements.", + "If `value` is an object, returns the number of top-level keys.", + "If `value` is a string, returns the number of bytes in the string." + ] + }, + "examples": [ + { + "title": "Length (object)", + "source": "length({\n \"portland\": \"Trail Blazers\",\n \"seattle\": \"Supersonics\"\n})\n", + "return": 2 + }, + { + "title": "Length (nested object)", + "source": "length({\n \"home\": {\n \"city\": \"Portland\",\n \"state\": \"Oregon\"\n },\n \"name\": \"Trail Blazers\",\n \"mascot\": {\n \"name\": \"Blaze the Trail Cat\"\n }\n})\n", + "return": 3 + }, + { + "title": "Length (array)", + "source": "length([\"Trail Blazers\", \"Supersonics\", \"Grizzlies\"])", + "return": 3 + }, + { + "title": "Length (string)", + "source": "length(\"The Planet of the Apes Musical\")", + "return": 30 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/log.cue b/website/cue/reference/remap/functions/log.cue index 26b885198bb6b..b5c75accf20f6 100644 --- a/website/cue/reference/remap/functions/log.cue +++ b/website/cue/reference/remap/functions/log.cue @@ -1,66 +1,65 @@ -package metadata - -remap: functions: log: { - category: "Debug" - description: """ - Logs the `value` to [stdout](\(urls.stdout)) at the specified `level`. - """ - - pure: false - - arguments: [ - { - name: "value" - description: "The value to log." - required: true - type: ["any"] - }, - { - name: "level" - description: "The log level." - required: false - type: ["string"] - enum: { - trace: "Log at the `trace` level." - debug: "Log at the `debug` level." - info: "Log at the `info` level." - warn: "Log at the `warn` level." - error: "Log at the `error` level." - } - default: "info" - }, - { - name: "rate_limit_secs" - description: #""" - Specifies that the log message is output no more than once per the given number of seconds. - Use a value of `0` to turn rate limiting off. - """# - type: ["integer"] - required: false - default: 1 - }, - ] - internal_failure_reasons: [] - return: types: ["null"] - - examples: [ - { - title: "Log a message" - source: #""" - log("Hello, World!", level: "info", rate_limit_secs: 60) - """# - return: null - }, - { - title: "Log an error" - input: log: field: "not an integer" - source: #""" - _, err = to_int(.field) - if err != null { - log(err, level: "error") - } - """# - return: null - }, - ] -} +{ + "remap": { + "functions": { + "log": { + "anchor": "log", + "name": "log", + "category": "Debug", + "description": "Logs the `value` to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) at the specified `level`.", + "arguments": [ + { + "name": "value", + "description": "The value to log.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "level", + "description": "The log level.", + "required": false, + "type": [ + "string" + ], + "enum": { + "error": "Log at the `error` level.", + "debug": "Log at the `debug` level.", + "info": "Log at the `info` level.", + "warn": "Log at the `warn` level.", + "trace": "Log at the `trace` level." + }, + "default": "info" + }, + { + "name": "rate_limit_secs", + "description": "Specifies that the log message is output no more than once per the given number of seconds.\nUse a value of `0` to turn rate limiting off.", + "required": false, + "type": [ + "integer" + ], + "default": "1" + } + ], + "return": { + "types": [ + "null" + ] + }, + "examples": [ + { + "title": "Log a message", + "source": "log(\"Hello, World!\", level: \"info\", rate_limit_secs: 60)", + "return": null + }, + { + "title": "Log an error", + "source": ". = { \"field\": \"not an integer\" }\n_, err = to_int(.field)\nif err != null {\n log(err, level: \"error\")\n}\n", + "return": null + } + ], + "pure": false + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/map_keys.cue b/website/cue/reference/remap/functions/map_keys.cue index b4b835f2dce18..db546a27df405 100644 --- a/website/cue/reference/remap/functions/map_keys.cue +++ b/website/cue/reference/remap/functions/map_keys.cue @@ -1,87 +1,77 @@ -package metadata - -remap: functions: map_keys: { - category: "Enumerate" - description: #""" - Map the keys within an object. - - If `recursive` is enabled, the function iterates into nested - objects, using the following rules: - - 1. Iteration starts at the root. - 2. For every nested object type: - - First return the key of the object type itself. - - Then recurse into the object, and loop back to item (1) - in this list. - - Any mutation done on a nested object *before* recursing into - it, are preserved. - 3. For every nested array type: - - First return the key of the array type itself. - - Then find all objects within the array, and apply item (2) - to each individual object. - - The above rules mean that `map_keys` with - `recursive` enabled finds *all* keys in the target, - regardless of whether nested objects are nested inside arrays. - - The function uses the function closure syntax to allow reading - the key for each item in the object. - - The same scoping rules apply to closure blocks as they do for - regular blocks. This means that any variable defined in parent scopes - is accessible, and mutations to those variables are preserved, - but any new variables instantiated in the closure block are - unavailable outside of the block. - - See the examples below to learn about the closure syntax. - """# - - arguments: [ - { - name: "value" - description: "The object to iterate." - required: true - type: ["object"] - }, - { - name: "recursive" - description: "Whether to recursively iterate the collection." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["object"] - } - examples: [ - { - title: "Upcase keys" - input: log: { - foo: "foo" - bar: "bar" - } - source: #""" - map_keys(.) -> |key| { upcase(key) } - """# - return: {"FOO": "foo", "BAR": "bar"} - }, - { - title: "De-dot keys" - input: log: { - labels: { - "app.kubernetes.io/name": "mysql" - } - } - source: #""" - map_keys(., recursive: true) -> |key| { replace(key, ".", "_") } - """# - return: { - labels: { - "app_kubernetes_io/name": "mysql" - } - } - }, - ] -} +{ + "remap": { + "functions": { + "map_keys": { + "anchor": "map_keys", + "name": "map_keys", + "category": "Enumerate", + "description": "Map the keys within an object.\n\nIf `recursive` is enabled, the function iterates into nested\nobjects, using the following rules:\n\n1. Iteration starts at the root.\n2. For every nested object type:\n - First return the key of the object type itself.\n - Then recurse into the object, and loop back to item (1)\n in this list.\n - Any mutation done on a nested object *before* recursing into\n it, are preserved.\n3. For every nested array type:\n - First return the key of the array type itself.\n - Then find all objects within the array, and apply item (2)\n to each individual object.\n\nThe above rules mean that `map_keys` with\n`recursive` enabled finds *all* keys in the target,\nregardless of whether nested objects are nested inside arrays.\n\nThe function uses the function closure syntax to allow reading\nthe key for each item in the object.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", + "arguments": [ + { + "name": "value", + "description": "The object to iterate.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "recursive", + "description": "Whether to recursively iterate the collection.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Upcase keys", + "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\",\n \"baz\": {\"nested key\": \"val\"}\n}\nmap_keys(.) -> |key| { upcase(key) }\n", + "return": { + "BAR": "bar", + "BAZ": { + "nested key": "val" + }, + "FOO": "foo" + } + }, + { + "title": "De-dot keys", + "source": ". = {\n \"labels\": {\n \"app.kubernetes.io/name\": \"mysql\"\n }\n}\nmap_keys(., recursive: true) -> |key| { replace(key, \".\", \"_\") }\n", + "return": { + "labels": { + "app_kubernetes_io/name": "mysql" + } + } + }, + { + "title": "Recursively map object keys", + "source": "val = {\n \"a\": 1,\n \"b\": [{ \"c\": 2 }, { \"d\": 3 }],\n \"e\": { \"f\": 4 }\n}\nmap_keys(val, recursive: true) -> |key| { upcase(key) }\n", + "return": { + "A": 1, + "B": [ + { + "C": 2 + }, + { + "D": 3 + } + ], + "E": { + "F": 4 + } + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/map_values.cue b/website/cue/reference/remap/functions/map_values.cue index fdfc8548dca40..4bdde517ced17 100644 --- a/website/cue/reference/remap/functions/map_values.cue +++ b/website/cue/reference/remap/functions/map_values.cue @@ -1,63 +1,67 @@ -package metadata - -remap: functions: map_values: { - category: "Enumerate" - description: #""" - Map the values within a collection. - - If `recursive` is enabled, the function iterates into nested - collections, using the following rules: - - 1. Iteration starts at the root. - 2. For every nested collection type: - - First return the collection type itself. - - Then recurse into the collection, and loop back to item (1) - in the list - - Any mutation done on a collection *before* recursing into it, - are preserved. - - The function uses the function closure syntax to allow mutating - the value for each item in the collection. - - The same scoping rules apply to closure blocks as they do for - regular blocks, meaning, any variable defined in parent scopes - are accessible, and mutations to those variables are preserved, - but any new variables instantiated in the closure block are - unavailable outside of the block. - - Check out the examples below to learn about the closure syntax. - """# - - arguments: [ - { - name: "value" - description: "The object or array to iterate." - required: true - type: ["array", "object"] - }, - { - name: "recursive" - description: "Whether to recursively iterate the collection." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array", "object"] - } - examples: [ - { - title: "Upcase values" - input: log: { - foo: "foo" - bar: "bar" - } - source: #""" - map_values(.) -> |value| { upcase!(value) } - """# - return: {"foo": "FOO", "bar": "BAR"} - }, - ] -} +{ + "remap": { + "functions": { + "map_values": { + "anchor": "map_values", + "name": "map_values", + "category": "Enumerate", + "description": "Map the values within a collection.\n\nIf `recursive` is enabled, the function iterates into nested\ncollections, using the following rules:\n\n1. Iteration starts at the root.\n2. For every nested collection type:\n - First return the collection type itself.\n - Then recurse into the collection, and loop back to item (1)\n in the list\n - Any mutation done on a collection *before* recursing into it,\n are preserved.\n\nThe function uses the function closure syntax to allow mutating\nthe value for each item in the collection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks, meaning, any variable defined in parent scopes\nare accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nCheck out the examples below to learn about the closure syntax.", + "arguments": [ + { + "name": "value", + "description": "The object or array to iterate.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "recursive", + "description": "Whether to recursively iterate the collection.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object", + "array" + ] + }, + "examples": [ + { + "title": "Upcase values", + "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\"\n}\nmap_values(.) -> |value| { upcase(value) }\n", + "return": { + "bar": "BAR", + "foo": "FOO" + } + }, + { + "title": "Recursively map object values", + "source": "val = {\n \"a\": 1,\n \"b\": [{ \"c\": 2 }, { \"d\": 3 }],\n \"e\": { \"f\": 4 }\n}\nmap_values(val, recursive: true) -> |value| {\n if is_integer(value) { int!(value) + 1 } else { value }\n}\n", + "return": { + "a": 2, + "b": [ + { + "c": 3 + }, + { + "d": 4 + } + ], + "e": { + "f": 5 + } + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/match.cue b/website/cue/reference/remap/functions/match.cue index 4ee82bdb5a574..39e592ab9548b 100644 --- a/website/cue/reference/remap/functions/match.cue +++ b/website/cue/reference/remap/functions/match.cue @@ -1,42 +1,48 @@ -package metadata - -remap: functions: match: { - category: "String" - description: """ - Determines whether the `value` matches the `pattern`. - """ - - arguments: [ - { - name: "value" - description: "The value to match." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The regular expression pattern to match against." - required: true - type: ["regex"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Regex match on a string" - source: """ - match("I'm a little teapot", r'teapot') - """ - return: true - }, - { - title: "String does not match the regular expression" - source: """ - match("I'm a little teapot", r'.*balloon') - """ - return: false - }, - ] -} +{ + "remap": { + "functions": { + "match": { + "anchor": "match", + "name": "match", + "category": "String", + "description": "Determines whether the `value` matches the `pattern`.", + "arguments": [ + { + "name": "value", + "description": "The value to match.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "The regular expression pattern to match against.", + "required": true, + "type": [ + "regex" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Regex match on a string", + "source": "match(\"I'm a little teapot\", r'teapot')", + "return": true + }, + { + "title": "String does not match the regular expression", + "source": "match(\"I'm a little teapot\", r'.*balloon')", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/match_any.cue b/website/cue/reference/remap/functions/match_any.cue index 1dc0767d9623b..7f45e83fc8332 100644 --- a/website/cue/reference/remap/functions/match_any.cue +++ b/website/cue/reference/remap/functions/match_any.cue @@ -1,38 +1,48 @@ -package metadata - -remap: functions: match_any: { - category: "String" - description: """ - Determines whether `value` matches any of the given `patterns`. All - patterns are checked in a single pass over the target string, giving this - function a potential performance advantage over the multiple calls - in the `match` function. - """ - - arguments: [ - { - name: "value" - description: "The value to match." - required: true - type: ["string"] - }, - { - name: "patterns" - description: "The array of regular expression patterns to match against." - required: true - type: ["array"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Regex match on a string" - source: """ - match_any("I'm a little teapot", [r'frying pan', r'teapot']) - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "match_any": { + "anchor": "match_any", + "name": "match_any", + "category": "String", + "description": "Determines whether `value` matches any of the given `patterns`. All patterns are checked in a single pass over the target string, giving this function a potential performance advantage over the multiple calls in the `match` function.", + "arguments": [ + { + "name": "value", + "description": "The value to match.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "patterns", + "description": "The array of regular expression patterns to match against.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Regex match on a string", + "source": "match_any(\"I'm a little teapot\", [r'frying pan', r'teapot'])", + "return": true + }, + { + "title": "No match", + "source": "match_any(\"My name is John Doe\", patterns: [r'\\d+', r'Jane'])", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/match_array.cue b/website/cue/reference/remap/functions/match_array.cue index c45d46c2654f2..7aa15c3f2c9e5 100644 --- a/website/cue/reference/remap/functions/match_array.cue +++ b/website/cue/reference/remap/functions/match_array.cue @@ -1,63 +1,67 @@ -package metadata - -remap: functions: match_array: { - category: "Enumerate" - description: """ - Determines whether the elements in the `value` array matches the `pattern`. By default, it checks that at least one element matches, but can be set to determine if all the elements match. - """ - - arguments: [ - { - name: "value" - description: "The array." - required: true - type: ["array"] - }, - { - name: "pattern" - description: "The regular expression pattern to match against." - required: true - type: ["regex"] - }, - { - name: "all" - description: "Whether to match on all elements of `value`." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Match at least one element" - source: #""" - match_array(["foobar", "bazqux"], r'foo') - """# - return: true - }, - { - title: "Match all elements" - source: #""" - match_array(["foo", "foobar", "barfoo"], r'foo', all: true) - """# - return: true - }, - { - title: "No matches" - source: #""" - match_array(["bazqux", "xyz"], r'foo') - """# - return: false - }, - { - title: "Not all elements match" - source: #""" - match_array(["foo", "foobar", "baz"], r'foo', all: true) - """# - return: false - }, - ] -} +{ + "remap": { + "functions": { + "match_array": { + "anchor": "match_array", + "name": "match_array", + "category": "Enumerate", + "description": "Determines whether the elements in the `value` array matches the `pattern`. By default, it checks that at least one element matches, but can be set to determine if all the elements match.", + "arguments": [ + { + "name": "value", + "description": "The array.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "pattern", + "description": "The regular expression pattern to match against.", + "required": true, + "type": [ + "regex" + ] + }, + { + "name": "all", + "description": "Whether to match on all elements of `value`.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Match at least one element", + "source": "match_array([\"foobar\", \"bazqux\"], r'foo')", + "return": true + }, + { + "title": "Match all elements", + "source": "match_array([\"foo\", \"foobar\", \"barfoo\"], r'foo', all: true)", + "return": true + }, + { + "title": "No matches", + "source": "match_array([\"bazqux\", \"xyz\"], r'foo')", + "return": false + }, + { + "title": "Not all elements match", + "source": "match_array([\"foo\", \"foobar\", \"baz\"], r'foo', all: true)", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/match_datadog_query.cue b/website/cue/reference/remap/functions/match_datadog_query.cue index bef981f5792e6..6f5ed6841f291 100644 --- a/website/cue/reference/remap/functions/match_datadog_query.cue +++ b/website/cue/reference/remap/functions/match_datadog_query.cue @@ -1,56 +1,58 @@ -package metadata - -remap: functions: match_datadog_query: { - category: "Object" - description: """ - Matches an object against a [Datadog Search Syntax](\(urls.datadog_search_syntax)) query. - """ - - arguments: [ - { - name: "value" - description: "The object." - required: true - type: ["object"] - }, - { - name: "query" - description: "The Datadog Search Syntax query." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "OR query" - source: #""" - match_datadog_query({"message": "contains this and that"}, "this OR that") - """# - return: true - }, - { - title: "AND query" - source: #""" - match_datadog_query({"message": "contains only this"}, "this AND that") - """# - return: false - }, - { - title: "Attribute wildcard" - source: #""" - match_datadog_query({"name": "foobar"}, "@name:foo*") - """# - return: true - }, - { - title: "Tag range" - source: #""" - match_datadog_query({"tags": ["a:x", "b:y", "c:z"]}, s'b:["x" TO "z"]') - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "match_datadog_query": { + "anchor": "match_datadog_query", + "name": "match_datadog_query", + "category": "Object", + "description": "Matches an object against a [Datadog Search Syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/) query.", + "arguments": [ + { + "name": "value", + "description": "The object.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "query", + "description": "The Datadog Search Syntax query.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "OR query", + "source": "match_datadog_query({\"message\": \"contains this and that\"}, \"this OR that\")", + "return": true + }, + { + "title": "AND query", + "source": "match_datadog_query({\"message\": \"contains only this\"}, \"this AND that\")", + "return": false + }, + { + "title": "Attribute wildcard", + "source": "match_datadog_query({\"name\": \"foobar\"}, \"@name:foo*\")", + "return": true + }, + { + "title": "Tag range", + "source": "match_datadog_query({\"tags\": [\"a:x\", \"b:y\", \"c:z\"]}, s'b:[\"x\" TO \"z\"]')", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/md5.cue b/website/cue/reference/remap/functions/md5.cue index 623b525bc3bfe..76f1727ddd559 100644 --- a/website/cue/reference/remap/functions/md5.cue +++ b/website/cue/reference/remap/functions/md5.cue @@ -1,29 +1,35 @@ -package metadata - -remap: functions: md5: { - category: "Cryptography" - description: """ - Calculates an md5 hash of the `value`. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Create md5 hash" - source: #""" - md5("foo") - """# - return: "acbd18db4cc2f85cedef654fccc4a4d8" - }, - ] -} +{ + "remap": { + "functions": { + "md5": { + "anchor": "md5", + "name": "md5", + "category": "Cryptography", + "description": "Calculates an md5 hash of the `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Create md5 hash", + "source": "md5(\"foo\")", + "return": "acbd18db4cc2f85cedef654fccc4a4d8" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/merge.cue b/website/cue/reference/remap/functions/merge.cue index 4aa33b6af856c..3e10752d29fb7 100644 --- a/website/cue/reference/remap/functions/merge.cue +++ b/website/cue/reference/remap/functions/merge.cue @@ -1,104 +1,78 @@ -package metadata - -remap: functions: merge: { - category: "Object" - description: """ - Merges the `from` object into the `to` object. - """ - - arguments: [ - { - name: "to" - description: "The object to merge into." - required: true - type: ["object"] - }, - { - name: "from" - description: "The object to merge from." - required: true - type: ["object"] - }, - { - name: "deep" - description: "A deep merge is performed if `true`, otherwise only top-level fields are merged." - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["object"] - rules: [ - #"The field from the `from` object is chosen if a key exists in both objects."#, - #""" - Objects are merged recursively if `deep` is specified, a key exists in both objects, and both of those - fields are also objects. - """#, - ] - } - - examples: [ - { - title: "Object merge (shallow)" - source: #""" - merge( - { - "parent1": { - "child1": 1, - "child2": 2 - }, - "parent2": { - "child3": 3 - } - }, - { - "parent1": { - "child2": 4, - "child5": 5 - } - } - ) - """# - return: { - parent1: { - child2: 4 - child5: 5 - } - parent2: child3: 3 - } - }, - { - title: "Object merge (deep)" - source: #""" - merge( - { - "parent1": { - "child1": 1, - "child2": 2 - }, - "parent2": { - "child3": 3 - } - }, - { - "parent1": { - "child2": 4, - "child5": 5 - } - }, - deep: true - ) - """# - return: { - parent1: { - child1: 1 - child2: 4 - child5: 5 - } - parent2: child3: 3 - } - }, - ] -} +{ + "remap": { + "functions": { + "merge": { + "anchor": "merge", + "name": "merge", + "category": "Object", + "description": "Merges the `from` object into the `to` object.", + "arguments": [ + { + "name": "to", + "description": "The object to merge into.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "from", + "description": "The object to merge from.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "deep", + "description": "A deep merge is performed if `true`, otherwise only top-level fields are merged.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ], + "rules": [ + "The field from the `from` object is chosen if a key exists in both objects.", + "Objects are merged recursively if `deep` is specified, a key exists in both objects, and both of those\nfields are also objects." + ] + }, + "examples": [ + { + "title": "Object merge (shallow)", + "source": "merge(\n {\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n },\n {\n \"parent1\": {\n \"child2\": 4,\n \"child5\": 5\n }\n }\n)\n", + "return": { + "parent1": { + "child2": 4, + "child5": 5 + }, + "parent2": { + "child3": 3 + } + } + }, + { + "title": "Object merge (deep)", + "source": "merge(\n {\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n },\n {\n \"parent1\": {\n \"child2\": 4,\n \"child5\": 5\n }\n },\n deep: true\n)\n", + "return": { + "parent1": { + "child1": 1, + "child2": 4, + "child5": 5 + }, + "parent2": { + "child3": 3 + } + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/mod.cue b/website/cue/reference/remap/functions/mod.cue index 8241f50a9b52e..71f4930d30107 100644 --- a/website/cue/reference/remap/functions/mod.cue +++ b/website/cue/reference/remap/functions/mod.cue @@ -1,39 +1,51 @@ -package metadata - -remap: functions: mod: { - category: "Number" - description: """ - Calculates the remainder of `value` divided by `modulus`. - """ - - arguments: [ - { - name: "value" - description: "The value the `modulus` is applied to." - required: true - type: ["integer", "float"] - }, - { - name: "modulus" - description: "The `modulus` value." - required: true - type: ["integer", "float"] - }, - ] - internal_failure_reasons: [ - "`value` is not an integer or float.", - "`modulus` is not an integer or float.", - "`modulus` is equal to 0.", - ] - return: types: ["integer", "float"] - - examples: [ - { - title: "Calculate the remainder of two integers" - source: #""" - mod(5, 2) - """# - return: 1 - }, - ] -} +{ + "remap": { + "functions": { + "mod": { + "anchor": "mod", + "name": "mod", + "category": "Number", + "description": "Calculates the remainder of `value` divided by `modulus`.", + "arguments": [ + { + "name": "value", + "description": "The value the `modulus` is applied to.", + "required": true, + "type": [ + "integer", + "float" + ] + }, + { + "name": "modulus", + "description": "The `modulus` value.", + "required": true, + "type": [ + "integer", + "float" + ] + } + ], + "return": { + "types": [ + "integer", + "float" + ] + }, + "internal_failure_reasons": [ + "`value` is not an integer or float.", + "`modulus` is not an integer or float.", + "`modulus` is equal to 0." + ], + "examples": [ + { + "title": "Calculate the remainder of two integers", + "source": "mod(5, 2)", + "return": 1 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/now.cue b/website/cue/reference/remap/functions/now.cue index cffe9accb726f..ae75276dd82b6 100644 --- a/website/cue/reference/remap/functions/now.cue +++ b/website/cue/reference/remap/functions/now.cue @@ -1,22 +1,26 @@ -package metadata - -remap: functions: now: { - category: "Timestamp" - description: """ - Returns the current timestamp in the UTC timezone with nanosecond precision. - """ - - arguments: [] - internal_failure_reasons: [] - return: types: ["timestamp"] - - examples: [ - { - title: "Generate a current timestamp" - source: #""" - now() - """# - return: "2021-03-04T10:51:15.928937Z" - }, - ] -} +{ + "remap": { + "functions": { + "now": { + "anchor": "now", + "name": "now", + "category": "Timestamp", + "description": "Returns the current timestamp in the UTC timezone with nanosecond precision.", + "arguments": [], + "return": { + "types": [ + "timestamp" + ] + }, + "examples": [ + { + "title": "Generate a current timestamp", + "source": "now()", + "return": "2012-03-04T12:34:56.789012345Z" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/object.cue b/website/cue/reference/remap/functions/object.cue index adfc2446538cf..e41638f69b136 100644 --- a/website/cue/reference/remap/functions/object.cue +++ b/website/cue/reference/remap/functions/object.cue @@ -1,41 +1,50 @@ -package metadata - -remap: functions: object: { - category: "Type" - description: """ - Returns `value` if it is an object, otherwise returns an error. This enables the type checker to guarantee that the - returned value is an object and can be used in any function that expects an object. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is an object." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not an object.", - ] - return: { - types: ["object"] - rules: [ - #"Returns the `value` if it's an object."#, - #"Raises an error if not an object."#, - ] - } - examples: [ - { - title: "Declare an object type" - input: log: value: { - field1: "value1" - field2: "value2" - } - source: #""" - object!(.value) - """# - return: input.log.value - }, - ] -} +{ + "remap": { + "functions": { + "object": { + "anchor": "object", + "name": "object", + "category": "Type", + "description": "Returns `value` if it is an object, otherwise returns an error. This enables the type checker to guarantee that the returned value is an object and can be used in any function that expects an object.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is an object.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "object" + ], + "rules": [ + "Returns the `value` if it's an object.", + "Raises an error if not an object." + ] + }, + "internal_failure_reasons": [ + "`value` is not an object." + ], + "examples": [ + { + "title": "Declare an object type", + "source": ". = { \"value\": { \"field1\": \"value1\", \"field2\": \"value2\" } }\nobject(.value)\n", + "return": { + "field1": "value1", + "field2": "value2" + } + }, + { + "title": "Invalid type", + "source": "object!(true)", + "raises": "function call error for \"object\" at (0:13): expected object, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/object_from_array.cue b/website/cue/reference/remap/functions/object_from_array.cue index 1bb29246375ab..6703366f71d5c 100644 --- a/website/cue/reference/remap/functions/object_from_array.cue +++ b/website/cue/reference/remap/functions/object_from_array.cue @@ -1,54 +1,70 @@ -package metadata - -remap: functions: object_from_array: { - category: "Object" - description: """ - Iterate over either one array of arrays or a pair of arrays and create an object out of all the key-value pairs contained in them. - With one array of arrays, any entries with no value use `null` instead. - Any keys that are `null` skip the corresponding value. - - If a single parameter is given, it must contain an array of all the input arrays. - """ - - arguments: [ - { - name: "values" - description: "The first array of elements, or the array of input arrays if no other parameter is present." - required: true - type: ["array"] - }, - { - name: "keys" - description: "The second array of elements. If not present, the first parameter must contain all the arrays." - required: false - type: ["array"] - }, - ] - internal_failure_reasons: [ - "`values` and `keys` must be arrays.", - "If `keys` is not present, `values` must contain only arrays.", - ] - return: { - types: ["object"] - rules: [ - "`object_from_array` is considered fallible in the following cases: if any of the parameters is not an array; if only the `value` parameter is present and it is not an array of arrays; or if any of the keys are not either a string or `null`.", - ] - } - - examples: [ - { - title: "Create an object from one array" - source: #""" - object_from_array([["one", 1], [null, 2], ["two", 3]]) - """# - return: {"one": 1, "two": 3} - }, - { - title: "Create an object from separate key and value arrays" - source: #""" - object_from_array([1, 2, 3], keys: ["one", null, "two"]) - """# - return: {"one": 1, "two": 3} - }, - ] -} +{ + "remap": { + "functions": { + "object_from_array": { + "anchor": "object_from_array", + "name": "object_from_array", + "category": "Object", + "description": "Iterate over either one array of arrays or a pair of arrays and create an object out of all the key-value pairs contained in them.\nWith one array of arrays, any entries with no value use `null` instead.\nAny keys that are `null` skip the corresponding value.\n\nIf a single parameter is given, it must contain an array of all the input arrays.", + "arguments": [ + { + "name": "values", + "description": "The first array of elements, or the array of input arrays if no other parameter is present.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "keys", + "description": "The second array of elements. If not present, the first parameter must contain all the arrays.", + "required": false, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "object" + ], + "rules": [ + "`object_from_array` is considered fallible in the following cases: if any of the parameters is not an array; if only the `value` parameter is present and it is not an array of arrays; or if any of the keys are not either a string or `null`." + ] + }, + "internal_failure_reasons": [ + "`values` and `keys` must be arrays.", + "If `keys` is not present, `values` must contain only arrays." + ], + "examples": [ + { + "title": "Create an object from one array", + "source": "object_from_array([[\"one\", 1], [null, 2], [\"two\", 3]])", + "return": { + "one": 1, + "two": 3 + } + }, + { + "title": "Create an object from separate key and value arrays", + "source": "object_from_array([1, 2, 3], keys: [\"one\", null, \"two\"])", + "return": { + "one": 1, + "two": 3 + } + }, + { + "title": "Create an object from a separate arrays of keys and values", + "source": "object_from_array(values: [1, null, true], keys: [\"a\", \"b\", \"c\"])", + "return": { + "a": 1, + "b": null, + "c": true + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_apache_log.cue b/website/cue/reference/remap/functions/parse_apache_log.cue index 8da0fbdf0c0d5..fa69d13578adc 100644 --- a/website/cue/reference/remap/functions/parse_apache_log.cue +++ b/website/cue/reference/remap/functions/parse_apache_log.cue @@ -1,114 +1,108 @@ -package metadata - -remap: functions: parse_apache_log: { - category: "Parse" - description: """ - Parses Apache access and error log lines. Lines can be in [`common`](\(urls.apache_common)), - [`combined`](\(urls.apache_combined)), or the default [`error`](\(urls.apache_error)) format. - """ - notices: [ - """ - Missing information in the log message may be indicated by `-`. These fields are omitted in the result. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "timestamp_format" - description: """ - The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for - encoding the timestamp. The time is parsed in local time if the timestamp does not specify a timezone. - """ - required: false - default: "%d/%b/%Y:%T %z" - type: ["string"] - }, - { - name: "format" - description: "The format to use for parsing the log." - required: true - enum: { - "common": "Common format" - "combined": "Apache combined format" - "error": "Default Apache error format" - } - type: ["string"] - }, - ] - - internal_failure_reasons: [ - "`value` does not match the specified format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse using Apache log format (common)" - source: #""" - parse_apache_log!("127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326", format: "common") - """# - return: { - host: "127.0.0.1" - identity: "bob" - user: "frank" - timestamp: "2000-10-10T20:55:36Z" - message: "GET /apache_pb.gif HTTP/1.0" - method: "GET" - path: "/apache_pb.gif" - protocol: "HTTP/1.0" - status: 200 - size: 2326 - } - }, - { - title: "Parse using Apache log format (combined)" - source: #""" - parse_apache_log!( - s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth" "Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0"', - "combined", - ) - """# - return: { - host: "127.0.0.1" - identity: "bob" - user: "frank" - timestamp: "2000-10-10T20:55:36Z" - message: "GET /apache_pb.gif HTTP/1.0" - method: "GET" - path: "/apache_pb.gif" - protocol: "HTTP/1.0" - status: 200 - size: 2326 - referrer: "http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth" - agent: "Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0" - } - }, - { - title: "Parse using Apache log format (error)" - source: #""" - parse_apache_log!( - s'[01/Mar/2021:12:00:19 +0000] [ab:alert] [pid 4803:tid 3814] [client 147.159.108.175:24259] I will bypass the haptic COM bandwidth, that should matrix the CSS driver!', - "error" - ) - """# - return: { - client: "147.159.108.175" - message: "I will bypass the haptic COM bandwidth, that should matrix the CSS driver!" - module: "ab" - pid: 4803 - port: 24259 - severity: "alert" - thread: "3814" - timestamp: "2021-03-01T12:00:19Z" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_apache_log": { + "anchor": "parse_apache_log", + "name": "parse_apache_log", + "category": "Parse", + "description": "Parses Apache access and error log lines. Lines can be in [`common`](https://httpd.apache.org/docs/current/logs.html#common),\n[`combined`](https://httpd.apache.org/docs/current/logs.html#combined), or the default [`error`](https://httpd.apache.org/docs/current/logs.html#errorlog) format.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "format", + "description": "The format to use for parsing the log.", + "required": true, + "type": [ + "string" + ], + "enum": { + "error": "Default Apache error format", + "combined": "Apache combined format", + "common": "Common format" + } + }, + { + "name": "timestamp_format", + "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for\nencoding the timestamp. The time is parsed in local time if the timestamp does not specify a timezone.", + "required": false, + "type": [ + "string" + ], + "default": "%d/%b/%Y:%T %z" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` does not match the specified format.", + "`timestamp_format` is not a valid format string.", + "The timestamp in `value` fails to parse using the provided `timestamp_format`." + ], + "examples": [ + { + "title": "Parse using Apache log format (common)", + "source": "parse_apache_log!(s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326', format: \"common\")", + "return": { + "host": "127.0.0.1", + "identity": "bob", + "message": "GET /apache_pb.gif HTTP/1.0", + "method": "GET", + "path": "/apache_pb.gif", + "protocol": "HTTP/1.0", + "size": 2326, + "status": 200, + "timestamp": "2000-10-10T20:55:36Z", + "user": "frank" + } + }, + { + "title": "Parse using Apache log format (combined)", + "source": "parse_apache_log!(\n s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326 \"http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth\" \"Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0\"',\n \"combined\",\n)\n", + "return": { + "agent": "Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0", + "host": "127.0.0.1", + "identity": "bob", + "message": "GET /apache_pb.gif HTTP/1.0", + "method": "GET", + "path": "/apache_pb.gif", + "protocol": "HTTP/1.0", + "referrer": "http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth", + "size": 2326, + "status": 200, + "timestamp": "2000-10-10T20:55:36Z", + "user": "frank" + } + }, + { + "title": "Parse using Apache log format (error)", + "source": "parse_apache_log!(\n s'[01/Mar/2021:12:00:19 +0000] [ab:alert] [pid 4803:tid 3814] [client 147.159.108.175:24259] I will bypass the haptic COM bandwidth, that should matrix the CSS driver!',\n \"error\"\n)\n", + "return": { + "client": "147.159.108.175", + "message": "I will bypass the haptic COM bandwidth, that should matrix the CSS driver!", + "module": "ab", + "pid": 4803, + "port": 24259, + "severity": "alert", + "thread": "3814", + "timestamp": "2021-03-01T12:00:19Z" + } + } + ], + "notices": [ + "Missing information in the log message may be indicated by `-`. These fields are omitted in the result." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_aws_alb_log.cue b/website/cue/reference/remap/functions/parse_aws_alb_log.cue index 21f87d19aa227..29f025bbff168 100644 --- a/website/cue/reference/remap/functions/parse_aws_alb_log.cue +++ b/website/cue/reference/remap/functions/parse_aws_alb_log.cue @@ -1,116 +1,118 @@ -package metadata - -remap: functions: parse_aws_alb_log: { - category: "Parse" - description: """ - Parses `value` in the [Elastic Load Balancer Access format](\(urls.aws_elb_access_format)). - """ - - arguments: [ - { - name: "value" - description: "Access log of the Application Load Balancer." - required: true - type: ["string"] - }, - { - name: "strict_mode" - description: "When set to `false`, the parser ignores any newly added or trailing fields in AWS ALB logs instead of failing. Defaults to `true` to preserve strict parsing behavior." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted AWS ALB log.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse AWS ALB log" - source: #""" - parse_aws_alb_log!( - "http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \"GET http://www.example.com:80/ HTTP/1.1\" \"curl/7.46.0\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \"Root=1-58337364-23a8c76965a2ef7629b185e3\" \"-\" \"-\" 0 2018-11-30T22:22:48.364000Z \"forward\" \"-\" \"-\" \"-\" \"-\" \"-\" \"-\"" - ) - """# - return: { - type: "http" - timestamp: "2018-11-30T22:23:00.186641Z" - elb: "app/my-loadbalancer/50dc6c495c0c9188" - client_host: "192.168.131.39:2817" - target_host: null - request_processing_time: 0.0 - target_processing_time: 0.001 - response_processing_time: 0.0 - elb_status_code: "200" - target_status_code: "200" - received_bytes: 34 - sent_bytes: 366 - request_method: "GET" - request_url: "http://www.example.com:80/" - request_protocol: "HTTP/1.1" - user_agent: "curl/7.46.0" - ssl_cipher: null - ssl_protocol: null - target_group_arn: "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" - trace_id: "Root=1-58337364-23a8c76965a2ef7629b185e3" - traceability_id: null - domain_name: null - chosen_cert_arn: null - matched_rule_priority: "0" - request_creation_time: "2018-11-30T22:22:48.364000Z" - actions_executed: "forward" - redirect_url: null - error_reason: null - target_port_list: [] - target_status_code_list: [] - classification: null - classification_reason: null - } - }, - { - title: "Parse AWS ALB log with trailing fields (non-strict mode)" - source: #""" - parse_aws_alb_log!( - "http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \"GET http://www.example.com:80/ HTTP/1.1\" \"curl/7.46.0\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \"Root=1-58337364-23a8c76965a2ef7629b185e3\" \"-\" \"-\" 0 2018-11-30T22:22:48.364000Z \"forward\" \"-\" \"-\" \"-\" \"-\" \"-\" \"-\" TID_12345 \"-\" \"-\" \"-\"", - strict_mode: false - ) - """# - return: { - type: "http" - timestamp: "2018-11-30T22:23:00.186641Z" - elb: "app/my-loadbalancer/50dc6c495c0c9188" - client_host: "192.168.131.39:2817" - target_host: null - request_processing_time: 0.0 - target_processing_time: 0.001 - response_processing_time: 0.0 - elb_status_code: "200" - target_status_code: "200" - received_bytes: 34 - sent_bytes: 366 - request_method: "GET" - request_url: "http://www.example.com:80/" - request_protocol: "HTTP/1.1" - user_agent: "curl/7.46.0" - ssl_cipher: null - ssl_protocol: null - target_group_arn: "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" - trace_id: "Root=1-58337364-23a8c76965a2ef7629b185e3" - traceability_id: "TID_12345" - domain_name: null - chosen_cert_arn: null - matched_rule_priority: "0" - request_creation_time: "2018-11-30T22:22:48.364000Z" - actions_executed: "forward" - redirect_url: null - error_reason: null - target_port_list: [] - target_status_code_list: [] - classification: null - classification_reason: null - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_aws_alb_log": { + "anchor": "parse_aws_alb_log", + "name": "parse_aws_alb_log", + "category": "Parse", + "description": "Parses `value` in the [Elastic Load Balancer Access format](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-log-entry-examples).", + "arguments": [ + { + "name": "value", + "description": "Access log of the Application Load Balancer.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "strict_mode", + "description": "When set to `false`, the parser ignores any newly added or trailing fields in AWS ALB logs instead of failing. Defaults to `true` to preserve strict parsing behavior.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted AWS ALB log." + ], + "examples": [ + { + "title": "Parse AWS ALB log", + "source": "parse_aws_alb_log!(\n \"http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \\\"GET http://www.example.com:80/ HTTP/1.1\\\" \\\"curl/7.46.0\\\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \\\"Root=1-58337364-23a8c76965a2ef7629b185e3\\\" \\\"-\\\" \\\"-\\\" 0 2018-11-30T22:22:48.364000Z \\\"forward\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\"\"\n)\n", + "return": { + "actions_executed": "forward", + "chosen_cert_arn": null, + "classification": null, + "classification_reason": null, + "client_host": "192.168.131.39:2817", + "domain_name": null, + "elb": "app/my-loadbalancer/50dc6c495c0c9188", + "elb_status_code": "200", + "error_reason": null, + "matched_rule_priority": "0", + "received_bytes": 34, + "redirect_url": null, + "request_creation_time": "2018-11-30T22:22:48.364000Z", + "request_method": "GET", + "request_processing_time": 0.0, + "request_protocol": "HTTP/1.1", + "request_url": "http://www.example.com:80/", + "response_processing_time": 0.0, + "sent_bytes": 366, + "ssl_cipher": null, + "ssl_protocol": null, + "target_group_arn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", + "target_host": null, + "target_port_list": [], + "target_processing_time": 0.001, + "target_status_code": "200", + "target_status_code_list": [], + "timestamp": "2018-11-30T22:23:00.186641Z", + "trace_id": "Root=1-58337364-23a8c76965a2ef7629b185e3", + "traceability_id": null, + "type": "http", + "user_agent": "curl/7.46.0" + } + }, + { + "title": "Parse AWS ALB log with trailing fields (non-strict mode)", + "source": "parse_aws_alb_log!(\n \"http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \\\"GET http://www.example.com:80/ HTTP/1.1\\\" \\\"curl/7.46.0\\\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \\\"Root=1-58337364-23a8c76965a2ef7629b185e3\\\" \\\"-\\\" \\\"-\\\" 0 2018-11-30T22:22:48.364000Z \\\"forward\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" TID_12345 \\\"-\\\" \\\"-\\\" \\\"-\\\"\",\n strict_mode: false\n)\n", + "return": { + "actions_executed": "forward", + "chosen_cert_arn": null, + "classification": null, + "classification_reason": null, + "client_host": "192.168.131.39:2817", + "domain_name": null, + "elb": "app/my-loadbalancer/50dc6c495c0c9188", + "elb_status_code": "200", + "error_reason": null, + "matched_rule_priority": "0", + "received_bytes": 34, + "redirect_url": null, + "request_creation_time": "2018-11-30T22:22:48.364000Z", + "request_method": "GET", + "request_processing_time": 0.0, + "request_protocol": "HTTP/1.1", + "request_url": "http://www.example.com:80/", + "response_processing_time": 0.0, + "sent_bytes": 366, + "ssl_cipher": null, + "ssl_protocol": null, + "target_group_arn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", + "target_host": null, + "target_port_list": [], + "target_processing_time": 0.001, + "target_status_code": "200", + "target_status_code_list": [], + "timestamp": "2018-11-30T22:23:00.186641Z", + "trace_id": "Root=1-58337364-23a8c76965a2ef7629b185e3", + "traceability_id": "TID_12345", + "type": "http", + "user_agent": "curl/7.46.0" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue b/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue index 4a24c2ec7cd23..0279ec878a436 100644 --- a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue +++ b/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue @@ -1,61 +1,53 @@ -package metadata - -remap: functions: parse_aws_cloudwatch_log_subscription_message: { - category: "Parse" - description: """ - Parses AWS CloudWatch Logs events (configured through AWS Cloudwatch subscriptions) from the - `aws_kinesis_firehose` source. - """ - - arguments: [ - { - name: "value" - description: "The string representation of the message to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted AWS CloudWatch Log subscription message.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse AWS Cloudwatch Log subscription message" - input: log: message: #""" - { - "messageType": "DATA_MESSAGE", - "owner": "111111111111", - "logGroup": "test", - "logStream": "test", - "subscriptionFilters": [ - "Destination" - ], - "logEvents": [ - { - "id": "35683658089614582423604394983260738922885519999578275840", - "timestamp": 1600110569039, - "message": "{\"bytes\":26780,\"datetime\":\"14/Sep/2020:11:45:41 -0400\",\"host\":\"157.130.216.193\",\"method\":\"PUT\",\"protocol\":\"HTTP/1.0\",\"referer\":\"https://www.principalcross-platform.io/markets/ubiquitous\",\"request\":\"/expedite/convergence\",\"source_type\":\"stdin\",\"status\":301,\"user-identifier\":\"-\"}" - } - ] - } - """# - source: #""" - parse_aws_cloudwatch_log_subscription_message!(.message) - """# - return: { - owner: "111111111111" - message_type: "DATA_MESSAGE" - log_group: "test" - log_stream: "test" - subscription_filters: ["Destination"] - log_events: [{ - id: "35683658089614582423604394983260738922885519999578275840" - message: "{\"bytes\":26780,\"datetime\":\"14/Sep/2020:11:45:41 -0400\",\"host\":\"157.130.216.193\",\"method\":\"PUT\",\"protocol\":\"HTTP/1.0\",\"referer\":\"https://www.principalcross-platform.io/markets/ubiquitous\",\"request\":\"/expedite/convergence\",\"source_type\":\"stdin\",\"status\":301,\"user-identifier\":\"-\"}" - timestamp: "2020-09-14T19:09:29.039Z" - }] - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_aws_cloudwatch_log_subscription_message": { + "anchor": "parse_aws_cloudwatch_log_subscription_message", + "name": "parse_aws_cloudwatch_log_subscription_message", + "category": "Parse", + "description": "Parses AWS CloudWatch Logs events (configured through AWS Cloudwatch subscriptions) from the `aws_kinesis_firehose` source.", + "arguments": [ + { + "name": "value", + "description": "The string representation of the message to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted AWS CloudWatch Log subscription message." + ], + "examples": [ + { + "title": "Parse AWS Cloudwatch Log subscription message", + "source": "parse_aws_cloudwatch_log_subscription_message!(s'{\n \"messageType\": \"DATA_MESSAGE\",\n \"owner\": \"111111111111\",\n \"logGroup\": \"test\",\n \"logStream\": \"test\",\n \"subscriptionFilters\": [\n \"Destination\"\n ],\n \"logEvents\": [\n {\n \"id\": \"35683658089614582423604394983260738922885519999578275840\",\n \"timestamp\": 1600110569039,\n \"message\": \"{\\\"bytes\\\":26780,\\\"datetime\\\":\\\"14/Sep/2020:11:45:41-0400\\\",\\\"host\\\":\\\"157.130.216.193\\\",\\\"method\\\":\\\"PUT\\\",\\\"protocol\\\":\\\"HTTP/1.0\\\",\\\"referer\\\":\\\"https://www.principalcross-platform.io/markets/ubiquitous\\\",\\\"request\\\":\\\"/expedite/convergence\\\",\\\"source_type\\\":\\\"stdin\\\",\\\"status\\\":301,\\\"user-identifier\\\":\\\"-\\\"}\"\n }\n ]\n}')\n", + "return": { + "log_events": [ + { + "id": "35683658089614582423604394983260738922885519999578275840", + "message": "{\"bytes\":26780,\"datetime\":\"14/Sep/2020:11:45:41-0400\",\"host\":\"157.130.216.193\",\"method\":\"PUT\",\"protocol\":\"HTTP/1.0\",\"referer\":\"https://www.principalcross-platform.io/markets/ubiquitous\",\"request\":\"/expedite/convergence\",\"source_type\":\"stdin\",\"status\":301,\"user-identifier\":\"-\"}", + "timestamp": "2020-09-14T19:09:29.039Z" + } + ], + "log_group": "test", + "log_stream": "test", + "message_type": "DATA_MESSAGE", + "owner": "111111111111", + "subscription_filters": [ + "Destination" + ] + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue b/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue index d64042b9905a4..289ac6b2346dd 100644 --- a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue +++ b/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue @@ -1,107 +1,108 @@ -package metadata - -remap: functions: parse_aws_vpc_flow_log: { - category: "Parse" - description: """ - Parses `value` in the [VPC Flow Logs format](\(urls.aws_vpc_flow_logs)). - """ - - arguments: [ - { - name: "value" - description: "VPC Flow Log." - required: true - type: ["string"] - }, - { - name: "format" - description: "VPC Flow Log format." - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted AWS VPC Flow log.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse AWS VPC Flow log (default format)" - source: #""" - parse_aws_vpc_flow_log!("2 123456789010 eni-1235b8ca123456789 - - - - - - - 1431280876 1431280934 - NODATA") - """# - return: { - "version": 2 - "account_id": "123456789010" - "interface_id": "eni-1235b8ca123456789" - "srcaddr": null - "dstaddr": null - "srcport": null - "dstport": null - "protocol": null - "packets": null - "bytes": null - "start": 1431280876 - "end": 1431280934 - "action": null - "log_status": "NODATA" - } - }, - { - title: "Parse AWS VPC Flow log (custom format)" - source: #""" - parse_aws_vpc_flow_log!( - "- eni-1235b8ca123456789 10.0.1.5 10.0.0.220 10.0.1.5 203.0.113.5", - "instance_id interface_id srcaddr dstaddr pkt_srcaddr pkt_dstaddr" - ) - """# - return: { - "instance_id": null - "interface_id": "eni-1235b8ca123456789" - "srcaddr": "10.0.1.5" - "dstaddr": "10.0.0.220" - "pkt_srcaddr": "10.0.1.5" - "pkt_dstaddr": "203.0.113.5" - } - }, - { - title: "Parse AWS VPC Flow log including v5 fields" - source: #""" - parse_aws_vpc_flow_log!("5 52.95.128.179 10.0.0.71 80 34210 6 1616729292 1616729349 IPv4 14 15044 123456789012 vpc-abcdefab012345678 subnet-aaaaaaaa012345678 i-0c50d5961bcb2d47b eni-1235b8ca123456789 ap-southeast-2 apse2-az3 - - ACCEPT 19 52.95.128.179 10.0.0.71 S3 - - ingress OK", - format: "version srcaddr dstaddr srcport dstport protocol start end type packets bytes account_id vpc_id subnet_id instance_id interface_id region az_id sublocation_type sublocation_id action tcp_flags pkt_srcaddr pkt_dstaddr pkt_src_aws_service pkt_dst_aws_service traffic_path flow_direction log_status") - """# - return: { - "account_id": "123456789012" - "action": "ACCEPT" - "az_id": "apse2-az3" - "bytes": 15044 - "dstaddr": "10.0.0.71" - "dstport": 34210 - "end": 1616729349 - "flow_direction": "ingress" - "instance_id": "i-0c50d5961bcb2d47b" - "interface_id": "eni-1235b8ca123456789" - "log_status": "OK" - "packets": 14 - "pkt_dst_aws_service": null - "pkt_dstaddr": "10.0.0.71" - "pkt_src_aws_service": "S3" - "pkt_srcaddr": "52.95.128.179" - "protocol": 6 - "region": "ap-southeast-2" - "srcaddr": "52.95.128.179" - "srcport": 80 - "start": 1616729292 - "sublocation_id": null - "sublocation_type": null - "subnet_id": "subnet-aaaaaaaa012345678" - "tcp_flags": 19 - "traffic_path": null - "type": "IPv4" - "version": 5 - "vpc_id": "vpc-abcdefab012345678" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_aws_vpc_flow_log": { + "anchor": "parse_aws_vpc_flow_log", + "name": "parse_aws_vpc_flow_log", + "category": "Parse", + "description": "Parses `value` in the [VPC Flow Logs format](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html).", + "arguments": [ + { + "name": "value", + "description": "VPC Flow Log.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "format", + "description": "VPC Flow Log format.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted AWS VPC Flow log." + ], + "examples": [ + { + "title": "Parse AWS VPC Flow log (default format)", + "source": "parse_aws_vpc_flow_log!(\"2 123456789010 eni-1235b8ca123456789 - - - - - - - 1431280876 1431280934 - NODATA\")", + "return": { + "account_id": "123456789010", + "action": null, + "bytes": null, + "dstaddr": null, + "dstport": null, + "end": 1431280934, + "interface_id": "eni-1235b8ca123456789", + "log_status": "NODATA", + "packets": null, + "protocol": null, + "srcaddr": null, + "srcport": null, + "start": 1431280876, + "version": 2 + } + }, + { + "title": "Parse AWS VPC Flow log (custom format)", + "source": "parse_aws_vpc_flow_log!(\n \"- eni-1235b8ca123456789 10.0.1.5 10.0.0.220 10.0.1.5 203.0.113.5\",\n \"instance_id interface_id srcaddr dstaddr pkt_srcaddr pkt_dstaddr\"\n)\n", + "return": { + "dstaddr": "10.0.0.220", + "instance_id": null, + "interface_id": "eni-1235b8ca123456789", + "pkt_dstaddr": "203.0.113.5", + "pkt_srcaddr": "10.0.1.5", + "srcaddr": "10.0.1.5" + } + }, + { + "title": "Parse AWS VPC Flow log including v5 fields", + "source": "parse_aws_vpc_flow_log!(\n \"5 52.95.128.179 10.0.0.71 80 34210 6 1616729292 1616729349 IPv4 14 15044 123456789012 vpc-abcdefab012345678 subnet-aaaaaaaa012345678 i-0c50d5961bcb2d47b eni-1235b8ca123456789 ap-southeast-2 apse2-az3 - - ACCEPT 19 52.95.128.179 10.0.0.71 S3 - - ingress OK\",\n format: \"version srcaddr dstaddr srcport dstport protocol start end type packets bytes account_id vpc_id subnet_id instance_id interface_id region az_id sublocation_type sublocation_id action tcp_flags pkt_srcaddr pkt_dstaddr pkt_src_aws_service pkt_dst_aws_service traffic_path flow_direction log_status\"\n)\n", + "return": { + "account_id": "123456789012", + "action": "ACCEPT", + "az_id": "apse2-az3", + "bytes": 15044, + "dstaddr": "10.0.0.71", + "dstport": 34210, + "end": 1616729349, + "flow_direction": "ingress", + "instance_id": "i-0c50d5961bcb2d47b", + "interface_id": "eni-1235b8ca123456789", + "log_status": "OK", + "packets": 14, + "pkt_dst_aws_service": null, + "pkt_dstaddr": "10.0.0.71", + "pkt_src_aws_service": "S3", + "pkt_srcaddr": "52.95.128.179", + "protocol": 6, + "region": "ap-southeast-2", + "srcaddr": "52.95.128.179", + "srcport": 80, + "start": 1616729292, + "sublocation_id": null, + "sublocation_type": null, + "subnet_id": "subnet-aaaaaaaa012345678", + "tcp_flags": 19, + "traffic_path": null, + "type": "IPv4", + "version": 5, + "vpc_id": "vpc-abcdefab012345678" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_bytes.cue b/website/cue/reference/remap/functions/parse_bytes.cue index 290c8e752e756..e1528c8403450 100644 --- a/website/cue/reference/remap/functions/parse_bytes.cue +++ b/website/cue/reference/remap/functions/parse_bytes.cue @@ -1,73 +1,95 @@ -package metadata - -remap: functions: parse_bytes: { - category: "Parse" - description: """ - Parses the `value` into a human-readable bytes format specified by `unit` and `base`. - """ - - arguments: [ - { - name: "value" - description: "The string of the duration with either binary or SI unit." - required: true - type: ["string"] - }, - { - name: "unit" - description: "The output units for the byte." - required: true - type: ["string"] - enum: { - B: "Bytes" - kiB: "Kilobytes (1024 bytes)" - MiB: "Megabytes (1024 ** 2 bytes)" - GiB: "Gigabytes (1024 ** 3 bytes)" - TiB: "Terabytes (1024 gigabytes)" - PiB: "Petabytes (1024 ** 2 gigabytes)" - EiB: "Exabytes (1024 ** 3 gigabytes)" - kB: "Kilobytes (1 thousand bytes in SI)" - MB: "Megabytes (1 million bytes in SI)" - GB: "Gigabytes (1 billion bytes in SI)" - TB: "Terabytes (1 thousand gigabytes in SI)" - PB: "Petabytes (1 million gigabytes in SI)" - EB: "Exabytes (1 billion gigabytes in SI)" - } - }, - { - name: "base" - description: "The base for the byte, either 2 or 10." - required: false - type: ["string"] - default: 2 - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted bytes.", - ] - return: types: ["float"] - - examples: [ - { - title: "Parse bytes (kilobytes)" - source: #""" - parse_bytes!("1024KiB", unit: "MiB") - """# - return: 1.0 - }, - { - title: "Parse bytes in SI unit (terabytes)" - source: #""" - parse_bytes!("4TB", unit: "MB", base: "10") - """# - return: 4000000.0 - }, - { - title: "Parse bytes in ambiguous unit (gigabytes)" - source: #""" - parse_bytes!("1GB", unit: "B", base: "2") - """# - return: 1073741824.0 - }, - ] -} +{ + "remap": { + "functions": { + "parse_bytes": { + "anchor": "parse_bytes", + "name": "parse_bytes", + "category": "Parse", + "description": "Parses the `value` into a human-readable bytes format specified by `unit` and `base`.", + "arguments": [ + { + "name": "value", + "description": "The string of the duration with either binary or SI unit.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "unit", + "description": "The output units for the byte.", + "required": true, + "type": [ + "string" + ], + "enum": { + "TiB": "Terabytes (1024 gigabytes)", + "EB": "Exabytes (1 billion gigabytes in SI)", + "MiB": "Megabytes (1024 ** 2 bytes)", + "PiB": "Petabytes (1024 ** 2 gigabytes)", + "GiB": "Gigabytes (1024 ** 3 bytes)", + "kB": "Kilobytes (1 thousand bytes in SI)", + "kiB": "Kilobytes (1024 bytes)", + "PB": "Petabytes (1 million gigabytes in SI)", + "MB": "Megabytes (1 million bytes in SI)", + "GB": "Gigabytes (1 billion bytes in SI)", + "TB": "Terabytes (1 thousand gigabytes in SI)", + "B": "Bytes", + "EiB": "Exabytes (1024 ** 3 gigabytes)" + } + }, + { + "name": "base", + "description": "The base for the byte, either 2 or 10.", + "required": false, + "type": [ + "string" + ], + "default": "2" + } + ], + "return": { + "types": [ + "float" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted bytes." + ], + "examples": [ + { + "title": "Parse bytes (kilobytes)", + "source": "parse_bytes!(\"1024KiB\", unit: \"MiB\")", + "return": 1.0 + }, + { + "title": "Parse kilobytes in default binary units", + "source": "parse_bytes!(\"1KiB\", unit: \"B\")", + "return": 1024.0 + }, + { + "title": "Parse bytes in SI unit (terabytes)", + "source": "parse_bytes!(\"4TB\", unit: \"MB\", base: \"10\")", + "return": 4000000.0 + }, + { + "title": "Parse gigabytes in decimal units", + "source": "parse_bytes!(\"1GB\", unit: \"B\", base: \"10\")", + "return": 1000000000.0 + }, + { + "title": "Parse bytes in ambiguous unit (gigabytes)", + "source": "parse_bytes!(\"1GB\", unit: \"B\", base: \"2\")", + "return": 1073741824.0 + }, + { + "title": "Parse gigabytes in ambiguous decimal units", + "source": "parse_bytes!(\"1GB\", unit: \"MB\", base: \"2\")", + "return": 1024.0 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_cbor.cue b/website/cue/reference/remap/functions/parse_cbor.cue index 5cf99d1ae0e58..077bf86fe34f7 100644 --- a/website/cue/reference/remap/functions/parse_cbor.cue +++ b/website/cue/reference/remap/functions/parse_cbor.cue @@ -1,36 +1,77 @@ -package metadata - -remap: functions: parse_cbor: { - category: "Parse" - description: """ - Parses the `value` as [CBOR](\(urls.cbor)). - """ - notices: [ - """ - Only CBOR types are returned. - """, - ] - - arguments: [ - { - name: "value" - description: "The CBOR payload to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid CBOR-formatted payload.", - ] - return: types: ["boolean", "integer", "float", "string", "object", "array", "null"] - - examples: [ - { - title: "Parse CBOR" - source: #""" - parse_cbor!(decode_base64!("oWVmaWVsZGV2YWx1ZQ==")) - """# - return: field: "value" - }, - ] -} +{ + "remap": { + "functions": { + "parse_cbor": { + "anchor": "parse_cbor", + "name": "parse_cbor", + "category": "Parse", + "description": "Parses the `value` as [CBOR](https://cbor.io).", + "arguments": [ + { + "name": "value", + "description": "The CBOR payload to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string", + "integer", + "float", + "boolean", + "object", + "array", + "null" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid CBOR-formatted payload." + ], + "examples": [ + { + "title": "Parse CBOR", + "source": "parse_cbor!(decode_base64!(\"oWVmaWVsZGV2YWx1ZQ==\"))", + "return": { + "field": "value" + } + }, + { + "title": "array", + "source": "parse_cbor!(decode_base64!(\"gvUA\"))", + "return": [ + true, + 0 + ] + }, + { + "title": "string", + "source": "parse_cbor!(decode_base64!(\"ZWhlbGxv\"))", + "return": "hello" + }, + { + "title": "integer", + "source": "parse_cbor!(decode_base64!(\"GCo=\"))", + "return": 42 + }, + { + "title": "float", + "source": "parse_cbor!(decode_base64!(\"+0BFEKPXCj1x\"))", + "return": 42.13 + }, + { + "title": "boolean", + "source": "parse_cbor!(decode_base64!(\"9A==\"))", + "return": false + } + ], + "notices": [ + "Only CBOR types are returned." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_cef.cue b/website/cue/reference/remap/functions/parse_cef.cue index 5c1d7a415692e..8ca5e1e9ddfa5 100644 --- a/website/cue/reference/remap/functions/parse_cef.cue +++ b/website/cue/reference/remap/functions/parse_cef.cue @@ -1,107 +1,150 @@ -package metadata - -remap: functions: parse_cef: { - category: "Parse" - description: """ - Parses the `value` in CEF (Common Event Format) format. Ignores everything up to CEF header. Empty values are returned as empty strings. Surrounding quotes are removed from values. - """ - notices: [ - """ - All values are returned as strings. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "translate_custom_fields" - description: "Toggles translation of custom field pairs to `key:value`." - required: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted CEF string.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse output generated by PTA" - source: #""" - parse_cef!( - "CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft|8|suser=mike2@prod1.domain.com shost=prod1.domain.com src=1.1.1.1 duser=andy@dev1.domain.com dhost=dev1.domain.com dst=2.2.2.2 cs1Label=ExtraData cs1=None cs2Label=EventID cs2=52b06812ec3500ed864c461e deviceCustomDate1Label=detectionDate deviceCustomDate1=1388577900000 cs3Label=PTAlink cs3=https://1.1.1.1/incidents/52b06812ec3500ed864c461e cs4Label=ExternalLink cs4=None" - ) - """# - return: { - "cefVersion": "0" - "deviceVendor": "CyberArk" - "deviceProduct": "PTA" - "deviceVersion": "12.6" - "deviceEventClassId": "1" - "name": "Suspected credentials theft" - "severity": "8" - "suser": "mike2@prod1.domain.com" - "shost": "prod1.domain.com" - "src": "1.1.1.1" - "duser": "andy@dev1.domain.com" - "dhost": "dev1.domain.com" - "dst": "2.2.2.2" - "cs1Label": "ExtraData" - "cs1": "None" - "cs2Label": "EventID" - "cs2": "52b06812ec3500ed864c461e" - "deviceCustomDate1Label": "detectionDate" - "deviceCustomDate1": "1388577900000" - "cs3Label": "PTAlink" - "cs3": "https://1.1.1.1/incidents/52b06812ec3500ed864c461e" - "cs4Label": "ExternalLink" - "cs4": "None" - } - }, - { - title: "Ignore syslog header" - source: #""" - parse_cef!( - "Sep 29 08:26:10 host CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2 spt=1232" - ) - """# - return: { - "cefVersion": "1" - "deviceVendor": "Security" - "deviceProduct": "threatmanager" - "deviceVersion": "1.0" - "deviceEventClassId": "100" - "name": "worm successfully stopped" - "severity": "10" - "src": "10.0.0.1" - "dst": "2.1.2.2" - "spt": "1232" - } - }, - { - title: "Translate custom fields" - source: #""" - parse_cef!( - "CEF:0|Dev|firewall|2.2|1|Connection denied|5|c6a1=2345:0425:2CA1:0000:0000:0567:5673:23b5 c6a1Label=Device IPv6 Address", - translate_custom_fields: true - ) - """# - return: { - "cefVersion": "0" - "deviceVendor": "Dev" - "deviceProduct": "firewall" - "deviceVersion": "2.2" - "deviceEventClassId": "1" - "name": "Connection denied" - "severity": "5" - "Device IPv6 Address": "2345:0425:2CA1:0000:0000:0567:5673:23b5" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_cef": { + "anchor": "parse_cef", + "name": "parse_cef", + "category": "Parse", + "description": "Parses the `value` in CEF (Common Event Format) format. Ignores everything up to CEF header. Empty values are returned as empty strings. Surrounding quotes are removed from values.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "translate_custom_fields", + "description": "Toggles translation of custom field pairs to `key:value`.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted CEF string." + ], + "examples": [ + { + "title": "Parse output generated by PTA", + "source": "parse_cef!(\n \"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft|8|suser=mike2@prod1.domain.com shost=prod1.domain.com src=1.1.1.1 duser=andy@dev1.domain.com dhost=dev1.domain.com dst=2.2.2.2 cs1Label=ExtraData cs1=None cs2Label=EventID cs2=52b06812ec3500ed864c461e deviceCustomDate1Label=detectionDate deviceCustomDate1=1388577900000 cs3Label=PTAlink cs3=https://1.1.1.1/incidents/52b06812ec3500ed864c461e cs4Label=ExternalLink cs4=None\"\n)\n", + "return": { + "cefVersion": "0", + "cs1": "None", + "cs1Label": "ExtraData", + "cs2": "52b06812ec3500ed864c461e", + "cs2Label": "EventID", + "cs3": "https://1.1.1.1/incidents/52b06812ec3500ed864c461e", + "cs3Label": "PTAlink", + "cs4": "None", + "cs4Label": "ExternalLink", + "deviceCustomDate1": "1388577900000", + "deviceCustomDate1Label": "detectionDate", + "deviceEventClassId": "1", + "deviceProduct": "PTA", + "deviceVendor": "CyberArk", + "deviceVersion": "12.6", + "dhost": "dev1.domain.com", + "dst": "2.2.2.2", + "duser": "andy@dev1.domain.com", + "name": "Suspected credentials theft", + "severity": "8", + "shost": "prod1.domain.com", + "src": "1.1.1.1", + "suser": "mike2@prod1.domain.com" + } + }, + { + "title": "Ignore syslog header", + "source": "parse_cef!(\n \"Sep 29 08:26:10 host CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2 spt=1232\"\n)\n", + "return": { + "cefVersion": "1", + "deviceEventClassId": "100", + "deviceProduct": "threatmanager", + "deviceVendor": "Security", + "deviceVersion": "1.0", + "dst": "2.1.2.2", + "name": "worm successfully stopped", + "severity": "10", + "spt": "1232", + "src": "10.0.0.1" + } + }, + { + "title": "Translate custom fields", + "source": "parse_cef!(\n \"CEF:0|Dev|firewall|2.2|1|Connection denied|5|c6a1=2345:0425:2CA1:0000:0000:0567:5673:23b5 c6a1Label=Device IPv6 Address\",\n translate_custom_fields: true\n)\n", + "return": { + "Device IPv6 Address": "2345:0425:2CA1:0000:0000:0567:5673:23b5", + "cefVersion": "0", + "deviceEventClassId": "1", + "deviceProduct": "firewall", + "deviceVendor": "Dev", + "deviceVersion": "2.2", + "name": "Connection denied", + "severity": "5" + } + }, + { + "title": "Parse CEF with only header", + "source": "parse_cef!(\"CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|\")", + "return": { + "cefVersion": "1", + "deviceEventClassId": "100", + "deviceProduct": "threatmanager", + "deviceVendor": "Security", + "deviceVersion": "1.0", + "name": "worm successfully stopped", + "severity": "10" + } + }, + { + "title": "Parse CEF with empty value", + "source": "parse_cef!(\"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft||suser=mike2@prod1.domain.com shost= src=1.1.1.1\")", + "return": { + "cefVersion": "0", + "deviceEventClassId": "1", + "deviceProduct": "PTA", + "deviceVendor": "CyberArk", + "deviceVersion": "12.6", + "name": "Suspected credentials theft", + "severity": "", + "shost": "", + "src": "1.1.1.1", + "suser": "mike2@prod1.domain.com" + } + }, + { + "title": "Parse CEF with escapes", + "source": "parse_cef!(s'CEF:0|security|threatmanager|1.0|100|Detected a \\| in message. No action needed.|10|src=10.0.0.1 msg=Detected a threat.\\n No action needed act=blocked a \\= dst=1.1.1.1')", + "return": { + "act": "blocked a =", + "cefVersion": "0", + "deviceEventClassId": "100", + "deviceProduct": "threatmanager", + "deviceVendor": "security", + "deviceVersion": "1.0", + "dst": "1.1.1.1", + "msg": "Detected a threat.\n No action needed", + "name": "Detected a | in message. No action needed.", + "severity": "10", + "src": "10.0.0.1" + } + } + ], + "notices": [ + "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_common_log.cue b/website/cue/reference/remap/functions/parse_common_log.cue index 29acc391c2a78..d03d8476a19c1 100644 --- a/website/cue/reference/remap/functions/parse_common_log.cue +++ b/website/cue/reference/remap/functions/parse_common_log.cue @@ -1,80 +1,79 @@ -package metadata - -remap: functions: parse_common_log: { - category: "Parse" - description: """ - Parses the `value` using the [Common Log Format](\(urls.apache_common)) (CLF). - """ - notices: [ - """ - Missing information in the log message may be indicated by `-`. These fields are omitted in the result. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "timestamp_format" - description: """ - The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for - encoding the timestamp. - """ - required: false - default: "%d/%b/%Y:%T %z" - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` does not match the Common Log Format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse using Common Log Format (with default timestamp format)" - source: #""" - parse_common_log!("127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326") - """# - return: { - host: "127.0.0.1" - identity: "bob" - user: "frank" - timestamp: "2000-10-10T20:55:36Z" - message: "GET /apache_pb.gif HTTP/1.0" - method: "GET" - path: "/apache_pb.gif" - protocol: "HTTP/1.0" - status: 200 - size: 2326 - } - }, - { - title: "Parse using Common Log Format (with custom timestamp format)" - source: #""" - parse_common_log!( - "127.0.0.1 bob frank [2000-10-10T20:55:36Z] \"GET /apache_pb.gif HTTP/1.0\" 200 2326", - "%+" - ) - """# - return: { - host: "127.0.0.1" - identity: "bob" - user: "frank" - timestamp: "2000-10-10T20:55:36Z" - message: "GET /apache_pb.gif HTTP/1.0" - method: "GET" - path: "/apache_pb.gif" - protocol: "HTTP/1.0" - status: 200 - size: 2326 - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_common_log": { + "anchor": "parse_common_log", + "name": "parse_common_log", + "category": "Parse", + "description": "Parses the `value` using the [Common Log Format](https://httpd.apache.org/docs/current/logs.html#common) (CLF).", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "timestamp_format", + "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for\nencoding the timestamp.", + "required": false, + "type": [ + "string" + ], + "default": "%d/%b/%Y:%T %z" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` does not match the Common Log Format.", + "`timestamp_format` is not a valid format string.", + "The timestamp in `value` fails to parse using the provided `timestamp_format`." + ], + "examples": [ + { + "title": "Parse using Common Log Format (with default timestamp format)", + "source": "parse_common_log!(s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326')", + "return": { + "host": "127.0.0.1", + "identity": "bob", + "message": "GET /apache_pb.gif HTTP/1.0", + "method": "GET", + "path": "/apache_pb.gif", + "protocol": "HTTP/1.0", + "size": 2326, + "status": 200, + "timestamp": "2000-10-10T20:55:36Z", + "user": "frank" + } + }, + { + "title": "Parse using Common Log Format (with custom timestamp format)", + "source": "parse_common_log!(\n s'127.0.0.1 bob frank [2000-10-10T20:55:36Z] \"GET /apache_pb.gif HTTP/1.0\" 200 2326',\n \"%+\"\n)\n", + "return": { + "host": "127.0.0.1", + "identity": "bob", + "message": "GET /apache_pb.gif HTTP/1.0", + "method": "GET", + "path": "/apache_pb.gif", + "protocol": "HTTP/1.0", + "size": 2326, + "status": 200, + "timestamp": "2000-10-10T20:55:36Z", + "user": "frank" + } + } + ], + "notices": [ + "Missing information in the log message may be indicated by `-`. These fields are omitted in the result." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_csv.cue b/website/cue/reference/remap/functions/parse_csv.cue index fc1f01f2517c1..b5b2b1ad8fc45 100644 --- a/website/cue/reference/remap/functions/parse_csv.cue +++ b/website/cue/reference/remap/functions/parse_csv.cue @@ -1,51 +1,63 @@ -package metadata - -remap: functions: parse_csv: { - category: "Parse" - description: #""" - Parses a single CSV formatted row. Only the first row is parsed in case of multiline input value. - """# - notices: [ - """ - All values are returned as strings. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "delimiter" - description: "The field delimiter to use when parsing. Must be a single-byte utf8 character." - required: false - default: "," - type: ["string"] - }, - ] - internal_failure_reasons: [ - "The delimiter must be a single-byte UTF-8 character.", - "`value` is not a valid CSV string.", - ] - return: types: ["array"] - - examples: [ - { - title: "Parse a single CSV formatted row" - source: #""" - parse_csv!("foo,bar,\"foo \"\", bar\"") - """# - return: ["foo", "bar", #"foo ", bar"#] - }, - { - title: "Parse a single CSV formatted row with custom delimiter" - source: #""" - parse_csv!("foo bar", delimiter: " ") - """# - return: ["foo", "bar"] - }, - ] -} +{ + "remap": { + "functions": { + "parse_csv": { + "anchor": "parse_csv", + "name": "parse_csv", + "category": "Parse", + "description": "Parses a single CSV formatted row. Only the first row is parsed in case of multiline input value.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "delimiter", + "description": "The field delimiter to use when parsing. Must be a single-byte utf8 character.", + "required": false, + "type": [ + "string" + ], + "default": "," + } + ], + "return": { + "types": [ + "array" + ] + }, + "internal_failure_reasons": [ + "The delimiter must be a single-byte UTF-8 character.", + "`value` is not a valid CSV string." + ], + "examples": [ + { + "title": "Parse a single CSV formatted row", + "source": "parse_csv!(s'foo,bar,\"foo \"\", bar\"')", + "return": [ + "foo", + "bar", + "foo \", bar" + ] + }, + { + "title": "Parse a single CSV formatted row with custom delimiter", + "source": "parse_csv!(\"foo bar\", delimiter: \" \")", + "return": [ + "foo", + "bar" + ] + } + ], + "notices": [ + "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_dnstap.cue b/website/cue/reference/remap/functions/parse_dnstap.cue index de91822af17d7..b30edc7cc3f14 100644 --- a/website/cue/reference/remap/functions/parse_dnstap.cue +++ b/website/cue/reference/remap/functions/parse_dnstap.cue @@ -1,142 +1,148 @@ -package metadata - -remap: functions: parse_dnstap: { - category: "Parse" - description: """ - Parses the `value` as base64 encoded DNSTAP data. - """ - notices: [] - - arguments: [ - { - name: "value" - description: "The base64 encoded representation of the DNSTAP data to parse." - required: true - type: ["string"] - }, - { - name: "lowercase_hostnames" - description: """ - Whether to turn all hostnames found in resulting data lowercase, for consistency. - """ - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid base64 encoded string.", - "dnstap parsing failed for `value`", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse dnstap query message" - source: #""" - parse_dnstap!("ChVqYW1lcy1WaXJ0dWFsLU1hY2hpbmUSC0JJTkQgOS4xNi4zGgBy5wEIAxACGAEiEAAAAAAAAAAAAAAAAAAAAAAqECABBQJwlAAAAAAAAAAAADAw8+0CODVA7+zq9wVNMU3WNlI2kwIAAAABAAAAAAABCWZhY2Vib29rMQNjb20AAAEAAQAAKQIAAACAAAAMAAoACOxjCAG9zVgzWgUDY29tAGAAbQAAAAByZLM4AAAAAQAAAAAAAQJoNQdleGFtcGxlA2NvbQAABgABAAApBNABAUAAADkADwA1AAlubyBTRVAgbWF0Y2hpbmcgdGhlIERTIGZvdW5kIGZvciBkbnNzZWMtZmFpbGVkLm9yZy54AQ==") - """# - return: { - "dataType": "Message" - "dataTypeId": 1 - "extraInfo": "" - "messageType": "ResolverQuery" - "messageTypeId": 3 - "queryZone": "com." - "requestData": { - "fullRcode": 0 - "header": { - "aa": false - "ad": false - "anCount": 0 - "arCount": 1 - "cd": false - "id": 37634 - "nsCount": 0 - "opcode": 0 - "qdCount": 1 - "qr": 0 - "ra": false - "rcode": 0 - "rd": false - "tc": false - } - "opt": { - "do": true - "ednsVersion": 0 - "extendedRcode": 0 - "options": [ - { - "optCode": 10 - "optName": "Cookie" - "optValue": "7GMIAb3NWDM=" - }, - ] - "udpPayloadSize": 512 - } - "question": [ - { - "class": "IN" - "domainName": "facebook1.com." - "questionType": "A" - "questionTypeId": 1 - }, - ] - "rcodeName": "NoError" - } - "responseData": { - "fullRcode": 16 - "header": { - "aa": false - "ad": false - "anCount": 0 - "arCount": 1 - "cd": false - "id": 45880 - "nsCount": 0 - "opcode": 0 - "qdCount": 1 - "qr": 0 - "ra": false - "rcode": 16 - "rd": false - "tc": false - } - "opt": { - "do": false - "ednsVersion": 1 - "extendedRcode": 1 - "ede": [ - { - "extraText": "no SEP matching the DS found for dnssec-failed.org." - "infoCode": 9 - "purpose": "DNSKEY Missing" - }, - ] - "udpPayloadSize": 1232 - } - "question": [ - { - "class": "IN" - "domainName": "h5.example.com." - "questionType": "SOA" - "questionTypeId": 6 - }, - ] - "rcodeName": "BADVERS" - } - "responseAddress": "2001:502:7094::30" - "responsePort": 53 - "serverId": "james-Virtual-Machine" - "serverVersion": "BIND 9.16.3" - "socketFamily": "INET6" - "socketProtocol": "UDP" - "sourceAddress": "::" - "sourcePort": 46835 - "time": 1_593_489_007_920_014_129 - "timePrecision": "ns" - "timestamp": "2020-06-30T03:50:07.920014129Z" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_dnstap": { + "anchor": "parse_dnstap", + "name": "parse_dnstap", + "category": "Parse", + "description": "Parses the `value` as base64 encoded DNSTAP data.", + "arguments": [ + { + "name": "value", + "description": "The base64 encoded representation of the DNSTAP data to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "lowercase_hostnames", + "description": "Whether to turn all hostnames found in resulting data lowercase, for consistency.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid base64 encoded string.", + "dnstap parsing failed for `value`" + ], + "examples": [ + { + "title": "Parse dnstap query message", + "source": "parse_dnstap!(\"ChVqYW1lcy1WaXJ0dWFsLU1hY2hpbmUSC0JJTkQgOS4xNi4zGgBy5wEIAxACGAEiEAAAAAAAAAAAAAAAAAAAAAAqECABBQJwlAAAAAAAAAAAADAw8+0CODVA7+zq9wVNMU3WNlI2kwIAAAABAAAAAAABCWZhY2Vib29rMQNjb20AAAEAAQAAKQIAAACAAAAMAAoACOxjCAG9zVgzWgUDY29tAGAAbQAAAAByZLM4AAAAAQAAAAAAAQJoNQdleGFtcGxlA2NvbQAABgABAAApBNABAUAAADkADwA1AAlubyBTRVAgbWF0Y2hpbmcgdGhlIERTIGZvdW5kIGZvciBkbnNzZWMtZmFpbGVkLm9yZy54AQ==\")", + "return": { + "dataType": "Message", + "dataTypeId": 1, + "extraInfo": "", + "messageType": "ResolverQuery", + "messageTypeId": 3, + "queryZone": "com.", + "requestData": { + "fullRcode": 0, + "header": { + "aa": false, + "ad": false, + "anCount": 0, + "arCount": 1, + "cd": false, + "id": 37634, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": 0, + "ra": false, + "rcode": 0, + "rd": false, + "tc": false + }, + "opt": { + "do": true, + "ednsVersion": 0, + "extendedRcode": 0, + "options": [ + { + "optCode": 10, + "optName": "Cookie", + "optValue": "7GMIAb3NWDM=" + } + ], + "udpPayloadSize": 512 + }, + "question": [ + { + "class": "IN", + "domainName": "facebook1.com.", + "questionType": "A", + "questionTypeId": 1 + } + ], + "rcodeName": "NoError" + }, + "responseAddress": "2001:502:7094::30", + "responseData": { + "fullRcode": 16, + "header": { + "aa": false, + "ad": false, + "anCount": 0, + "arCount": 1, + "cd": false, + "id": 45880, + "nsCount": 0, + "opcode": 0, + "qdCount": 1, + "qr": 0, + "ra": false, + "rcode": 16, + "rd": false, + "tc": false + }, + "opt": { + "do": false, + "ede": [ + { + "extraText": "no SEP matching the DS found for dnssec-failed.org.", + "infoCode": 9, + "purpose": "DNSKEY Missing" + } + ], + "ednsVersion": 1, + "extendedRcode": 1, + "udpPayloadSize": 1232 + }, + "question": [ + { + "class": "IN", + "domainName": "h5.example.com.", + "questionType": "SOA", + "questionTypeId": 6 + } + ], + "rcodeName": "BADVERS" + }, + "responsePort": 53, + "serverId": "james-Virtual-Machine", + "serverVersion": "BIND 9.16.3", + "socketFamily": "INET6", + "socketProtocol": "UDP", + "sourceAddress": "::", + "sourcePort": 46835, + "time": 1593489007920014129, + "timePrecision": "ns", + "timestamp": "2020-06-30T03:50:07.920014129Z" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_duration.cue b/website/cue/reference/remap/functions/parse_duration.cue index 9eb82dacc97ae..3c730f1195389 100644 --- a/website/cue/reference/remap/functions/parse_duration.cue +++ b/website/cue/reference/remap/functions/parse_duration.cue @@ -1,56 +1,63 @@ -package metadata - -remap: functions: parse_duration: { - category: "Parse" - description: """ - Parses the `value` into a human-readable duration format specified by `unit`. - """ - - arguments: [ - { - name: "value" - description: "The string of the duration." - required: true - type: ["string"] - }, - { - name: "unit" - description: "The output units for the duration." - required: true - type: ["string"] - enum: { - ns: "Nanoseconds (1 billion nanoseconds in a second)" - us: "Microseconds (1 million microseconds in a second)" - µs: "Microseconds (1 million microseconds in a second)" - ms: "Milliseconds (1 thousand microseconds in a second)" - cs: "Centiseconds (100 centiseconds in a second)" - ds: "Deciseconds (10 deciseconds in a second)" - s: "Seconds" - m: "Minutes (60 seconds in a minute)" - h: "Hours (60 minutes in an hour)" - d: "Days (24 hours in a day)" - } - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted duration.", - ] - return: types: ["float"] - - examples: [ - { - title: "Parse duration (milliseconds)" - source: #""" - parse_duration!("1005ms", unit: "s") - """# - return: 1.005 - }, - { - title: "Parse multiple durations (seconds & milliseconds)" - source: #""" - parse_duration!("1s 1ms", unit: "ms") - """# - return: 1001.0 - }, - ] -} +{ + "remap": { + "functions": { + "parse_duration": { + "anchor": "parse_duration", + "name": "parse_duration", + "category": "Parse", + "description": "Parses the `value` into a human-readable duration format specified by `unit`.", + "arguments": [ + { + "name": "value", + "description": "The string of the duration.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "unit", + "description": "The output units for the duration.", + "required": true, + "type": [ + "string" + ], + "enum": { + "ms": "Milliseconds (1 thousand microseconds in a second)", + "ds": "Deciseconds (10 deciseconds in a second)", + "d": "Days (24 hours in a day)", + "m": "Minutes (60 seconds in a minute)", + "h": "Hours (60 minutes in an hour)", + "cs": "Centiseconds (100 centiseconds in a second)", + "s": "Seconds", + "ns": "Nanoseconds (1 billion nanoseconds in a second)", + "us": "Microseconds (1 million microseconds in a second)", + "µs": "Microseconds (1 million microseconds in a second)" + } + } + ], + "return": { + "types": [ + "float" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted duration." + ], + "examples": [ + { + "title": "Parse duration (milliseconds)", + "source": "parse_duration!(\"1005ms\", unit: \"s\")", + "return": 1.005 + }, + { + "title": "Parse multiple durations (seconds & milliseconds)", + "source": "parse_duration!(\"1s 1ms\", unit: \"ms\")", + "return": 1001.0 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_etld.cue b/website/cue/reference/remap/functions/parse_etld.cue index 781a1e845ab67..ddc7fb55b47c4 100644 --- a/website/cue/reference/remap/functions/parse_etld.cue +++ b/website/cue/reference/remap/functions/parse_etld.cue @@ -1,90 +1,86 @@ -package metadata - -remap: functions: parse_etld: { - category: "Parse" - description: """ - Parses the [eTLD](\(urls.etld)) from `value` representing domain name. - """ - - arguments: [ - { - name: "value" - description: "The domain string." - required: true - type: ["string"] - }, - { - name: "plus_parts" - description: """ - Can be provided to get additional parts of the domain name. When 1 is passed, - eTLD+1 will be returned, which represents a domain registrable by a single - organization. Higher numbers will return subdomains. - """ - required: false - type: ["integer"] - default: false - }, - { - name: "psl" - description: """ - Can be provided to use a different public suffix list. - - By default, https://publicsuffix.org/list/public_suffix_list.dat is used. - """ - required: false - type: ["string"] - default: false - }, - ] - internal_failure_reasons: [ - "unable to determine eTLD for `value`", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse eTLD" - source: #""" - parse_etld!("sub.sussex.ac.uk") - """# - return: { - etld: "ac.uk" - etld_plus: "ac.uk" - known_suffix: true - } - }, - { - title: "Parse eTLD+1" - source: #""" - parse_etld!("sub.sussex.ac.uk", plus_parts: 1) - """# - return: { - etld: "ac.uk" - etld_plus: "sussex.ac.uk" - known_suffix: true - } - }, - { - title: "Parse eTLD with unknown suffix" - source: #""" - parse_etld!("vector.acmecorp") - """# - return: { - etld: "acmecorp" - etld_plus: "acmecorp" - known_suffix: false - } - }, - { - title: "Parse eTLD with custom PSL" - source: #""" - parse_etld!("vector.acmecorp", psl: "resources/public_suffix_list.dat") - """# - return: { - etld: "acmecorp" - etld_plus: "acmecorp" - known_suffix: false - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_etld": { + "anchor": "parse_etld", + "name": "parse_etld", + "category": "Parse", + "description": "Parses the [eTLD](https://developer.mozilla.org/en-US/docs/Glossary/eTLD) from `value` representing domain name.", + "arguments": [ + { + "name": "value", + "description": "The domain string.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "plus_parts", + "description": "Can be provided to get additional parts of the domain name. When 1 is passed,\neTLD+1 will be returned, which represents a domain registrable by a single\norganization. Higher numbers will return subdomains.", + "required": false, + "type": [ + "integer" + ], + "default": "0" + }, + { + "name": "psl", + "description": "Can be provided to use a different public suffix list.\n\nBy default, https://publicsuffix.org/list/public_suffix_list.dat is used.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "unable to determine eTLD for `value`" + ], + "examples": [ + { + "title": "Parse eTLD", + "source": "parse_etld!(\"sub.sussex.ac.uk\")", + "return": { + "etld": "ac.uk", + "etld_plus": "ac.uk", + "known_suffix": true + } + }, + { + "title": "Parse eTLD+1", + "source": "parse_etld!(\"sub.sussex.ac.uk\", plus_parts: 1)", + "return": { + "etld": "ac.uk", + "etld_plus": "sussex.ac.uk", + "known_suffix": true + } + }, + { + "title": "Parse eTLD with unknown suffix", + "source": "parse_etld!(\"vector.acmecorp\")", + "return": { + "etld": "acmecorp", + "etld_plus": "acmecorp", + "known_suffix": false + } + }, + { + "title": "Parse eTLD with custom PSL", + "source": "parse_etld!(\"vector.acmecorp\", psl: \"lib/tests/tests/functions/custom_public_suffix_list.dat\")", + "return": { + "etld": "acmecorp", + "etld_plus": "acmecorp", + "known_suffix": false + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_float.cue b/website/cue/reference/remap/functions/parse_float.cue index ebf6b9394b9c1..4bc2196b2ed38 100644 --- a/website/cue/reference/remap/functions/parse_float.cue +++ b/website/cue/reference/remap/functions/parse_float.cue @@ -1,40 +1,48 @@ -package metadata - -remap: functions: parse_float: { - category: "String" - description: """ - Parses the string `value` representing a floating point number in base 10 to a float. - """ - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a string.", - ] - return: types: ["float"] - - examples: [ - { - title: "Parse negative integer" - source: #"parse_float!("-42")"# - return: -42.0 - }, - { - title: "Parse negative integer" - source: #"parse_float!("42.38")"# - return: 42.38 - }, - { - title: "Scientific notation" - source: #"parse_float!("2.5e3")"# - return: 2500.0 - }, - ] - -} +{ + "remap": { + "functions": { + "parse_float": { + "anchor": "parse_float", + "name": "parse_float", + "category": "String", + "description": "Parses the string `value` representing a floating point number in base 10 to a float.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "float" + ] + }, + "internal_failure_reasons": [ + "`value` is not a string." + ], + "examples": [ + { + "title": "Parse negative integer", + "source": "parse_float!(\"-42\")", + "return": -42.0 + }, + { + "title": "Parse float", + "source": "parse_float!(\"42.38\")", + "return": 42.38 + }, + { + "title": "Scientific notation", + "source": "parse_float!(\"2.5e3\")", + "return": 2500.0 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_glog.cue b/website/cue/reference/remap/functions/parse_glog.cue index 3fc76b44ca2b5..05ffc12651e6f 100644 --- a/website/cue/reference/remap/functions/parse_glog.cue +++ b/website/cue/reference/remap/functions/parse_glog.cue @@ -1,36 +1,45 @@ -package metadata - -remap: functions: parse_glog: { - category: "Parse" - description: """ - Parses the `value` using the [glog (Google Logging Library)](\(urls.glog)) format. - """ - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` does not match the `glog` format.", - ] - return: types: ["object"] - examples: [ - { - title: "Parse using glog" - source: #""" - parse_glog!("I20210131 14:48:54.411655 15520 main.c++:9] Hello world!") - """# - return: { - level: "info" - timestamp: "2021-01-31T14:48:54.411655Z" - id: 15520 - file: "main.c++" - line: 9 - message: "Hello world!" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_glog": { + "anchor": "parse_glog", + "name": "parse_glog", + "category": "Parse", + "description": "Parses the `value` using the [glog (Google Logging Library)](https://github.com/google/glog) format.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` does not match the `glog` format." + ], + "examples": [ + { + "title": "Parse using glog", + "source": "parse_glog!(\"I20210131 14:48:54.411655 15520 main.c++:9] Hello world!\")", + "return": { + "file": "main.c++", + "id": 15520, + "level": "info", + "line": 9, + "message": "Hello world!", + "timestamp": "2021-01-31T14:48:54.411655Z" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_grok.cue b/website/cue/reference/remap/functions/parse_grok.cue index c207ae4f829b2..9281c8acc1f65 100644 --- a/website/cue/reference/remap/functions/parse_grok.cue +++ b/website/cue/reference/remap/functions/parse_grok.cue @@ -1,51 +1,53 @@ -package metadata - -remap: functions: parse_grok: { - category: "Parse" - description: """ - Parses the `value` using the [`grok`](\(urls.grok)) format. All patterns [listed here](\(urls.grok_patterns)) - are supported. - """ - notices: [ - """ - We recommend using community-maintained Grok patterns when possible, as they're more likely to be properly - vetted and improved over time than bespoke patterns. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The [Grok pattern](https://github.com/daschl/grok/tree/master/patterns)." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` fails to parse using the provided `pattern`.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse using Grok" - source: #""" - parse_grok!( - "2020-10-02T23:22:12.223222Z info Hello world", - "%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:message}" - ) - """# - return: { - timestamp: "2020-10-02T23:22:12.223222Z" - level: "info" - message: "Hello world" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_grok": { + "anchor": "parse_grok", + "name": "parse_grok", + "category": "Parse", + "description": "Parses the `value` using the [`grok`](https://github.com/daschl/grok/tree/master/patterns) format. All patterns [listed here](https://github.com/daschl/grok/tree/master/patterns) are supported.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "The [Grok pattern](https://github.com/daschl/grok/tree/master/patterns).", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` fails to parse using the provided `pattern`." + ], + "examples": [ + { + "title": "Parse using Grok", + "source": "value = \"2020-10-02T23:22:12.223222Z info Hello world\"\npattern = \"%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:message}\"\n\nparse_grok!(value, pattern)\n", + "return": { + "level": "info", + "message": "Hello world", + "timestamp": "2020-10-02T23:22:12.223222Z" + } + } + ], + "notices": [ + "We recommend using community-maintained Grok patterns when possible, as they're more\nlikely to be properly vetted and improved over time than bespoke patterns." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_groks.cue b/website/cue/reference/remap/functions/parse_groks.cue index b3ca8625a7679..4a09e4480e8bf 100644 --- a/website/cue/reference/remap/functions/parse_groks.cue +++ b/website/cue/reference/remap/functions/parse_groks.cue @@ -1,93 +1,81 @@ -package metadata - -remap: functions: parse_groks: { - category: "Parse" - description: """ - Parses the `value` using multiple [`grok`](\(urls.grok)) patterns. All patterns [listed here](\(urls.grok_patterns)) - are supported. - """ - notices: [ - """ - We recommend using community-maintained Grok patterns when possible, as they're more likely to be properly - vetted and improved over time than bespoke patterns. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "patterns" - description: "The [Grok patterns](https://github.com/daschl/grok/tree/master/patterns), which are tried in order until the first match." - required: true - type: ["array"] - }, - { - name: "aliases" - description: "The shared set of grok aliases that can be referenced in the patterns to simplify them." - required: false - default: true - type: ["object"] - }, - { - name: "alias_sources" - description: "Path to the file containing aliases in a JSON format." - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` fails to parse using the provided `pattern`.", - "`patterns` is not an array.", - "`aliases` is not an object.", - "`alias_sources` is not a string or doesn't point to a valid file.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse using multiple Grok patterns" - source: #""" - parse_groks!( - "2020-10-02T23:22:12.223222Z info Hello world", - patterns: [ - "%{common_prefix} %{_status} %{_message}", - "%{common_prefix} %{_message}", - ], - aliases: { - "common_prefix": "%{_timestamp} %{_loglevel}", - "_timestamp": "%{TIMESTAMP_ISO8601:timestamp}", - "_loglevel": "%{LOGLEVEL:level}", - "_status": "%{POSINT:status}", - "_message": "%{GREEDYDATA:message}" - } - ) - """# - return: { - timestamp: "2020-10-02T23:22:12.223222Z" - level: "info" - message: "Hello world" - } - }, - { - title: "Parse using aliases from file" - source: #""" - parse_groks!( - "username=foo", - patterns: [ "%{PATTERN_A}" ], - alias_sources: [ "path/to/aliases.json" ] - ) - # aliases.json contents: - # { - # "PATTERN_A": "%{PATTERN_B}", - # "PATTERN_B": "username=%{USERNAME:username}" - # } - """# - skip_test: true - }, - ] -} +{ + "remap": { + "functions": { + "parse_groks": { + "anchor": "parse_groks", + "name": "parse_groks", + "category": "Parse", + "description": "Parses the `value` using multiple [`grok`](https://github.com/daschl/grok/tree/master/patterns) patterns. All patterns [listed here](https://github.com/daschl/grok/tree/master/patterns) are supported.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "patterns", + "description": "The [Grok patterns](https://github.com/daschl/grok/tree/master/patterns), which are tried in order until the first match.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "aliases", + "description": "The shared set of grok aliases that can be referenced in the patterns to simplify them.", + "required": false, + "type": [ + "object" + ], + "default": "{ }" + }, + { + "name": "alias_sources", + "description": "Path to the file containing aliases in a JSON format.", + "required": false, + "type": [ + "array" + ], + "default": "[]" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` fails to parse using the provided `pattern`.", + "`patterns` is not an array.", + "`aliases` is not an object.", + "`alias_sources` is not a string array or doesn't point to a valid file." + ], + "examples": [ + { + "title": "Parse using multiple Grok patterns", + "source": "parse_groks!(\n \"2020-10-02T23:22:12.223222Z info Hello world\",\n patterns: [\n \"%{common_prefix} %{_status} %{_message}\",\n \"%{common_prefix} %{_message}\",\n ],\n aliases: {\n \"common_prefix\": \"%{_timestamp} %{_loglevel}\",\n \"_timestamp\": \"%{TIMESTAMP_ISO8601:timestamp}\",\n \"_loglevel\": \"%{LOGLEVEL:level}\",\n \"_status\": \"%{POSINT:status}\",\n \"_message\": \"%{GREEDYDATA:message}\"\n }\n)\n", + "return": { + "level": "info", + "message": "Hello world", + "timestamp": "2020-10-02T23:22:12.223222Z" + } + }, + { + "title": "Parse using aliases from file", + "source": "parse_groks!(\n \"username=foo\",\n patterns: [ \"%{PATTERN_A}\" ],\n alias_sources: [ \"tests/data/grok/aliases.json\" ]\n)\n# aliases.json contents:\n# {\n# \"PATTERN_A\": \"%{PATTERN_B}\",\n# \"PATTERN_B\": \"username=%{USERNAME:username}\"\n# }\n", + "return": { + "username": "foo" + } + } + ], + "notices": [ + "We recommend using community-maintained Grok patterns when possible, as they're more\nlikely to be properly vetted and improved over time than bespoke patterns." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_influxdb.cue b/website/cue/reference/remap/functions/parse_influxdb.cue index b220fa0180c5e..862076383fa8b 100644 --- a/website/cue/reference/remap/functions/parse_influxdb.cue +++ b/website/cue/reference/remap/functions/parse_influxdb.cue @@ -1,109 +1,106 @@ -package metadata - -remap: functions: parse_influxdb: { - category: "Parse" - description: """ - Parses the `value` as an [InfluxDB line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) - string, producing a list of Vector-compatible metrics. - """ - notices: [ - """ - This function will return a log event with the shape of a Vector-compatible metric, but not a metric event itself. - You will likely want to pipe the output of this function through a `log_to_metric` transform with the option `all_metrics` - set to `true` to convert the metric-shaped log events to metric events so _real_ metrics are produced. - """, - """ - The only metric type that is produced is a `gauge`. Each metric name is prefixed with the `measurement` field, followed - by an underscore (`_`), and then the `field key` field. - """, - """ - `string` is the only type that is not supported as a field value, - due to limitations of Vector's metric model. - """, - ] - arguments: [ - { - name: "value" - description: "The string representation of the InfluxDB line protocol to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid InfluxDB line protocol string.", - "field set contains a field value of type `string`.", - "field set contains a `NaN` field value.", - ] - return: types: ["array"] - - examples: [ - { - title: "Parse InfluxDB line protocol" - source: #""" - parse_influxdb!("cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000") - """# - return: [ - { - "name": "cpu_usage_system" - "tags": { - "host": "A" - "region": "us-west" - } - "timestamp": "2020-05-26T10:26:13.254420Z" - "kind": "absolute" - "gauge": { - "value": 64.0 - } - }, - { - "name": "cpu_usage_user" - "tags": { - "host": "A" - "region": "us-west" - } - "timestamp": "2020-05-26T10:26:13.254420Z" - "kind": "absolute" - "gauge": { - "value": 10.0 - } - }, - { - "name": "cpu_temperature" - "tags": { - "host": "A" - "region": "us-west" - } - "timestamp": "2020-05-26T10:26:13.254420Z" - "kind": "absolute" - "gauge": { - "value": 50.5 - } - }, - { - "name": "cpu_on" - "tags": { - "host": "A" - "region": "us-west" - } - "timestamp": "2020-05-26T10:26:13.254420Z" - "kind": "absolute" - "gauge": { - "value": 1.0 - } - }, - { - "name": "cpu_sleep" - "tags": { - "host": "A" - "region": "us-west" - } - "timestamp": "2020-05-26T10:26:13.254420Z" - "kind": "absolute" - "gauge": { - "value": 0.0 - } - }, - ] - }, - ] -} +{ + "remap": { + "functions": { + "parse_influxdb": { + "anchor": "parse_influxdb", + "name": "parse_influxdb", + "category": "Parse", + "description": "Parses the `value` as an [InfluxDB line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) string, producing a list of Vector-compatible metrics.", + "arguments": [ + { + "name": "value", + "description": "The string representation of the InfluxDB line protocol to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid InfluxDB line protocol string.", + "field set contains a field value of type `string`.", + "field set contains a `NaN` field value." + ], + "examples": [ + { + "title": "Parse InfluxDB line protocol", + "source": "parse_influxdb!(\"cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000\")", + "return": [ + { + "gauge": { + "value": 64.0 + }, + "kind": "absolute", + "name": "cpu_usage_system", + "tags": { + "host": "A", + "region": "us-west" + }, + "timestamp": "2020-05-26T10:26:13.254420Z" + }, + { + "gauge": { + "value": 10.0 + }, + "kind": "absolute", + "name": "cpu_usage_user", + "tags": { + "host": "A", + "region": "us-west" + }, + "timestamp": "2020-05-26T10:26:13.254420Z" + }, + { + "gauge": { + "value": 50.5 + }, + "kind": "absolute", + "name": "cpu_temperature", + "tags": { + "host": "A", + "region": "us-west" + }, + "timestamp": "2020-05-26T10:26:13.254420Z" + }, + { + "gauge": { + "value": 1.0 + }, + "kind": "absolute", + "name": "cpu_on", + "tags": { + "host": "A", + "region": "us-west" + }, + "timestamp": "2020-05-26T10:26:13.254420Z" + }, + { + "gauge": { + "value": 0.0 + }, + "kind": "absolute", + "name": "cpu_sleep", + "tags": { + "host": "A", + "region": "us-west" + }, + "timestamp": "2020-05-26T10:26:13.254420Z" + } + ] + } + ], + "notices": [ + "This function will return a log event with the shape of a Vector-compatible metric,\nbut not a metric event itself. You will likely want to pipe the output of this\nfunction through a `log_to_metric` transform with the option `all_metrics` set to\n`true` to convert the metric-shaped log events to metric events so _real_ metrics\nare produced.", + "The only metric type that is produced is a `gauge`. Each metric name is prefixed\nwith the `measurement` field, followed by an underscore (`_`), and then the\n`field key` field.", + "`string` is the only type that is not supported as a field value, due to limitations\nof Vector's metric model." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_int.cue b/website/cue/reference/remap/functions/parse_int.cue index 6c03784ba0117..e01bfa37c9cde 100644 --- a/website/cue/reference/remap/functions/parse_int.cue +++ b/website/cue/reference/remap/functions/parse_int.cue @@ -1,72 +1,67 @@ -package metadata - -remap: functions: parse_int: { - category: "Parse" - description: #""" - Parses the string `value` representing a number in an optional base/radix to an integer. - """# - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "base" - description: """ - The base the number is in. Must be between 2 and 36 (inclusive). - - If unspecified, the string prefix is used to - determine the base: "0b", 8 for "0" or "0o", 16 for "0x", - and 10 otherwise. - """ - required: false - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "The base is not between 2 and 36.", - "The number cannot be parsed in the base.", - ] - return: types: ["integer"] - - examples: [ - { - title: "Parse decimal" - source: #""" - parse_int!("-42") - """# - return: -42 - }, - { - title: "Parse binary" - source: #""" - parse_int!("0b1001") - """# - return: 9 - }, - { - title: "Parse octal" - source: #""" - parse_int!("0o42") - """# - return: 34 - }, - { - title: "Parse hexadecimal" - source: #""" - parse_int!("0x2a") - """# - return: 42 - }, - { - title: "Parse explicit base" - source: #""" - parse_int!("2a", 17) - """# - return: 44 - }, - ] -} +{ + "remap": { + "functions": { + "parse_int": { + "anchor": "parse_int", + "name": "parse_int", + "category": "Parse", + "description": "Parses the string `value` representing a number in an optional base/radix to an integer.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "base", + "description": "The base the number is in. Must be between 2 and 36 (inclusive).\n\nIf unspecified, the string prefix is used to\ndetermine the base: \"0b\", 8 for \"0\" or \"0o\", 16 for \"0x\",\nand 10 otherwise.", + "required": false, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "internal_failure_reasons": [ + "The base is not between 2 and 36.", + "The number cannot be parsed in the base." + ], + "examples": [ + { + "title": "Parse decimal", + "source": "parse_int!(\"-42\")", + "return": -42 + }, + { + "title": "Parse binary", + "source": "parse_int!(\"0b1001\")", + "return": 9 + }, + { + "title": "Parse octal", + "source": "parse_int!(\"0o42\")", + "return": 34 + }, + { + "title": "Parse hexadecimal", + "source": "parse_int!(\"0x2a\")", + "return": 42 + }, + { + "title": "Parse explicit base", + "source": "parse_int!(\"2a\", 17)", + "return": 44 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_json.cue b/website/cue/reference/remap/functions/parse_json.cue index bc7b561b93af3..e19029f24789c 100644 --- a/website/cue/reference/remap/functions/parse_json.cue +++ b/website/cue/reference/remap/functions/parse_json.cue @@ -1,64 +1,106 @@ -package metadata - -remap: functions: parse_json: { - category: "Parse" - description: """ - Parses the `value` as JSON. - """ - notices: [ - """ - Only JSON types are returned. If you need to convert a `string` into a `timestamp`, consider the - [`parse_timestamp`](#parse_timestamp) function. - """, - ] - - arguments: [ - { - name: "value" - description: "The string representation of the JSON to parse." - required: true - type: ["string"] - }, - { - name: "max_depth" - description: """ - Number of layers to parse for nested JSON-formatted documents. - The value must be in the range of 1 to 128. - """ - required: false - type: ["integer"] - }, - { - name: "lossy" - description: """ - Whether to parse the JSON in a lossy manner. Replaces invalid UTF-8 characters - with the Unicode character `�` (U+FFFD) if set to true, otherwise returns an error - if there are any invalid UTF-8 characters present. - """ - required: false - default: true - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid JSON-formatted payload.", - ] - return: types: ["boolean", "integer", "float", "string", "object", "array", "null"] - - examples: [ - { - title: "Parse JSON" - source: #""" - parse_json!("{\"key\": \"val\"}") - """# - return: key: "val" - }, - { - title: "Parse JSON with max_depth" - source: #""" - parse_json!("{\"top_level\":{\"key\": \"val\"}}", max_depth: 1) - """# - return: top_level: "{\"key\": \"val\"}" - }, - ] -} +{ + "remap": { + "functions": { + "parse_json": { + "anchor": "parse_json", + "name": "parse_json", + "category": "Parse", + "description": "Parses the provided `value` as JSON.\n\nOnly JSON types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the `parse_timestamp` function.", + "arguments": [ + { + "name": "value", + "description": "The string representation of the JSON to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "max_depth", + "description": "Number of layers to parse for nested JSON-formatted documents.\nThe value must be in the range of 1 to 128.", + "required": false, + "type": [ + "integer" + ] + }, + { + "name": "lossy", + "description": "Whether to parse the JSON in a lossy manner. Replaces invalid UTF-8 characters\nwith the Unicode character `�` (U+FFFD) if set to true, otherwise returns an error\nif there are any invalid UTF-8 characters present.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "string", + "integer", + "float", + "boolean", + "object", + "array", + "null" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid JSON-formatted payload." + ], + "examples": [ + { + "title": "Parse JSON", + "source": "parse_json!(s'{\"key\": \"val\"}')", + "return": { + "key": "val" + } + }, + { + "title": "Parse JSON array", + "source": "parse_json!(\"[true, 0]\")", + "return": [ + true, + 0 + ] + }, + { + "title": "Parse JSON string", + "source": "parse_json!(s'\"hello\"')", + "return": "hello" + }, + { + "title": "Parse JSON integer", + "source": "parse_json!(\"42\")", + "return": 42 + }, + { + "title": "Parse JSON float", + "source": "parse_json!(\"42.13\")", + "return": 42.13 + }, + { + "title": "Parse JSON boolean", + "source": "parse_json!(\"false\")", + "return": false + }, + { + "title": "Invalid JSON value", + "source": "parse_json!(\"{ INVALID }\")", + "raises": "function call error for \"parse_json\" at (0:26): unable to parse json: key must be a string at line 1 column 3" + }, + { + "title": "Parse JSON with max_depth", + "source": "parse_json!(s'{\"first_level\":{\"second_level\":\"finish\"}}', max_depth: 1)", + "return": { + "first_level": "{\"second_level\":\"finish\"}" + } + } + ], + "notices": [ + "Only JSON types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the [`parse_timestamp`](#parse_timestamp) function." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_key_value.cue b/website/cue/reference/remap/functions/parse_key_value.cue index e2e28211eec3b..ac047e5587fdf 100644 --- a/website/cue/reference/remap/functions/parse_key_value.cue +++ b/website/cue/reference/remap/functions/parse_key_value.cue @@ -1,134 +1,145 @@ -package metadata - -remap: functions: parse_key_value: { - category: "Parse" - description: """ - Parses the `value` in key-value format. Also known as [logfmt](\(urls.logfmt)). - - * Keys and values can be wrapped with `"`. - * `"` characters can be escaped using `\\`. - """ - notices: [ - """ - All values are returned as strings or as an array of strings for duplicate keys. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "key_value_delimiter" - description: "The string that separates the key from the value." - required: false - default: "=" - type: ["string"] - }, - { - name: "field_delimiter" - description: "The string that separates each key-value pair." - required: false - default: " " - type: ["string"] - }, - { - name: "whitespace" - description: "Defines the acceptance of unnecessary whitespace surrounding the configured `key_value_delimiter`." - required: false - enum: { - lenient: "Ignore whitespace." - strict: "Parse whitespace as normal character." - } - default: "lenient" - type: ["string"] - }, - { - name: "accept_standalone_key" - description: "Whether a standalone key should be accepted, the resulting object associates such keys with the boolean value `true`." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted key-value string.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse logfmt log" - source: #""" - parse_key_value!( - "@timestamp=\"Sun Jan 10 16:47:39 EST 2021\" level=info msg=\"Stopping all fetchers\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager" - ) - """# - return: { - "@timestamp": "Sun Jan 10 16:47:39 EST 2021" - level: "info" - msg: "Stopping all fetchers" - "tag#production": "stopping_fetchers" - id: "ConsumerFetcherManager-1382721708341" - module: "kafka.consumer.ConsumerFetcherManager" - } - }, - { - title: "Parse comma delimited log" - source: #""" - parse_key_value!( - "path:\"/cart_link\", host:store.app.com, fwd: \"102.30.171.16\", dyno: web.1, connect:0ms, service:87ms, status:304, bytes:632, protocol:https", - field_delimiter: ",", - key_value_delimiter: ":" - ) - """# - return: { - path: "/cart_link" - host: "store.app.com" - fwd: "102.30.171.16" - dyno: "web.1" - connect: "0ms" - service: "87ms" - status: "304" - bytes: "632" - protocol: "https" - } - }, - { - title: "Parse comma delimited log with standalone keys" - source: #""" - parse_key_value!( - "env:prod,service:backend,region:eu-east1,beta", - field_delimiter: ",", - key_value_delimiter: ":", - ) - """# - return: { - env: "prod" - service: "backend" - region: "eu-east1" - beta: true - } - }, - { - title: "Parse duplicate keys" - source: #""" - parse_key_value!( - "at=info,method=GET,path=\"/index\",status=200,tags=dev,tags=dummy", - field_delimiter: ",", - key_value_delimiter: "=", - ) - """# - return: { - at: "info" - method: "GET" - path: "/index" - status: "200" - tags: ["dev", "dummy"] - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_key_value": { + "anchor": "parse_key_value", + "name": "parse_key_value", + "category": "Parse", + "description": "Parses the `value` in key-value format. Also known as [logfmt](https://brandur.org/logfmt).\n\n* Keys and values can be wrapped with `\"`.\n* `\"` characters can be escaped using `\\`.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "key_value_delimiter", + "description": "The string that separates the key from the value.", + "required": false, + "type": [ + "string" + ], + "default": "=" + }, + { + "name": "field_delimiter", + "description": "The string that separates each key-value pair.", + "required": false, + "type": [ + "string" + ], + "default": " " + }, + { + "name": "whitespace", + "description": "Defines the acceptance of unnecessary whitespace surrounding the configured `key_value_delimiter`.", + "required": false, + "type": [ + "string" + ], + "enum": { + "lenient": "Ignore whitespace.", + "strict": "Parse whitespace as normal character." + }, + "default": "lenient" + }, + { + "name": "accept_standalone_key", + "description": "Whether a standalone key should be accepted, the resulting object associates such keys with the boolean value `true`.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted key-value string." + ], + "examples": [ + { + "title": "Parse simple key value pairs", + "source": "parse_key_value!(\"zork=zook zonk=nork\")", + "return": { + "zonk": "nork", + "zork": "zook" + } + }, + { + "title": "Parse logfmt log", + "source": "parse_key_value!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", + "return": { + "@timestamp": "Sun Jan 10 16:47:39 EST 2021", + "id": "ConsumerFetcherManager-1382721708341", + "level": "info", + "module": "kafka.consumer.ConsumerFetcherManager", + "msg": "Stopping all fetchers", + "tag#production": "stopping_fetchers" + } + }, + { + "title": "Parse comma delimited log", + "source": "parse_key_value!(\n \"path:\\\"/cart_link\\\", host:store.app.com, fwd: \\\"102.30.171.16\\\", dyno: web.1, connect:0ms, service:87ms, status:304, bytes:632, protocol:https\",\n field_delimiter: \",\",\n key_value_delimiter: \":\"\n)\n", + "return": { + "bytes": "632", + "connect": "0ms", + "dyno": "web.1", + "fwd": "102.30.171.16", + "host": "store.app.com", + "path": "/cart_link", + "protocol": "https", + "service": "87ms", + "status": "304" + } + }, + { + "title": "Parse comma delimited log with standalone keys", + "source": "parse_key_value!(\n \"env:prod,service:backend,region:eu-east1,beta\",\n field_delimiter: \",\",\n key_value_delimiter: \":\",\n)\n", + "return": { + "beta": true, + "env": "prod", + "region": "eu-east1", + "service": "backend" + } + }, + { + "title": "Parse duplicate keys", + "source": "parse_key_value!(\n \"at=info,method=GET,path=\\\"/index\\\",status=200,tags=dev,tags=dummy\",\n field_delimiter: \",\",\n key_value_delimiter: \"=\",\n)\n", + "return": { + "at": "info", + "method": "GET", + "path": "/index", + "status": "200", + "tags": [ + "dev", + "dummy" + ] + } + }, + { + "title": "Parse with strict whitespace", + "source": "parse_key_value!(s'app=my-app ip=1.2.3.4 user= msg=hello-world', whitespace: \"strict\")", + "return": { + "app": "my-app", + "ip": "1.2.3.4", + "msg": "hello-world", + "user": "" + } + } + ], + "notices": [ + "All values are returned as strings or as an array of strings for duplicate keys. We\nrecommend manually coercing values to desired types as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_klog.cue b/website/cue/reference/remap/functions/parse_klog.cue index 7d6cfb0464e5a..2ae9a9ce944f0 100644 --- a/website/cue/reference/remap/functions/parse_klog.cue +++ b/website/cue/reference/remap/functions/parse_klog.cue @@ -1,41 +1,48 @@ -package metadata - -remap: functions: parse_klog: { - category: "Parse" - description: """ - Parses the `value` using the [klog](\(urls.klog)) format used by Kubernetes components. - """ - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` does not match the `klog` format.", - ] - return: types: ["object"] - notices: [ - """ - This function resolves the year for messages. If the current month is January and the provided month is December, it sets the year to the previous year. Otherwise, it sets the year to the current year. - """, - ] - examples: [ - { - title: "Parse using klog" - source: #""" - parse_klog!("I0505 17:59:40.692994 28133 klog.go:70] hello from klog") - """# - return: { - file: "klog.go" - id: 28133 - level: "info" - line: 70 - message: "hello from klog" - timestamp: "2026-05-05T17:59:40.692994Z" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_klog": { + "anchor": "parse_klog", + "name": "parse_klog", + "category": "Parse", + "description": "Parses the `value` using the [klog](https://github.com/kubernetes/klog) format used by Kubernetes components.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` does not match the `klog` format." + ], + "examples": [ + { + "title": "Parse using klog", + "source": "parse_klog!(\"I0505 17:59:40.692994 28133 klog.go:70] hello from klog\")", + "return": { + "file": "klog.go", + "id": 28133, + "level": "info", + "line": 70, + "message": "hello from klog", + "timestamp": "2026-05-05T17:59:40.692994Z" + } + } + ], + "notices": [ + "This function resolves the year for messages. If the current month is January and the\nprovided month is December, it sets the year to the previous year. Otherwise, it sets\nthe year to the current year." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_linux_authorization.cue b/website/cue/reference/remap/functions/parse_linux_authorization.cue index 216898569da0d..5492b2f8e37f7 100644 --- a/website/cue/reference/remap/functions/parse_linux_authorization.cue +++ b/website/cue/reference/remap/functions/parse_linux_authorization.cue @@ -1,46 +1,47 @@ -package metadata - -remap: functions: parse_linux_authorization: { - category: "Parse" - description: """ - Parses Linux authorization logs usually found under either `/var/log/auth.log` (for Debian-based systems) or - `/var/log/secure` (for RedHat-based systems) according to [Syslog](\(urls.syslog)) format. - """ - notices: [ - """ - The function resolves the year for messages that don't include it. If the current month is January, and the message is for - December, it will take the previous year. Otherwise, take the current year. - """, - ] - - arguments: [ - { - name: "value" - description: "The text containing the message to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted Syslog message.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse Linux authorization event" - source: """ - parse_linux_authorization!( - s'Mar 23 01:49:58 localhost sshd[1111]: Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar' - ) - """ - return: { - appname: "sshd" - hostname: "localhost" - message: "Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar" - procid: 1111 - timestamp: "2026-03-23T01:49:58Z" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_linux_authorization": { + "anchor": "parse_linux_authorization", + "name": "parse_linux_authorization", + "category": "Parse", + "description": "Parses Linux authorization logs usually found under either `/var/log/auth.log` (for Debian-based systems) or `/var/log/secure` (for RedHat-based systems) according to [Syslog](https://en.wikipedia.org/wiki/Syslog) format.", + "arguments": [ + { + "name": "value", + "description": "The text containing the message to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted Syslog message." + ], + "examples": [ + { + "title": "Parse Linux authorization event", + "source": "parse_linux_authorization!(\n s'Mar 23 01:49:58 localhost sshd[1111]: Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar'\n)\n", + "return": { + "appname": "sshd", + "hostname": "localhost", + "message": "Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar", + "procid": 1111, + "timestamp": "2026-03-23T01:49:58Z" + } + } + ], + "notices": [ + "The function resolves the year for messages that don't include it. If the current month\nis January, and the message is for December, it will take the previous year. Otherwise,\ntake the current year." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_logfmt.cue b/website/cue/reference/remap/functions/parse_logfmt.cue index 74332c1cd7fc7..7c77bba7ad370 100644 --- a/website/cue/reference/remap/functions/parse_logfmt.cue +++ b/website/cue/reference/remap/functions/parse_logfmt.cue @@ -1,45 +1,62 @@ -package metadata - -remap: functions: parse_logfmt: { - category: "Parse" - description: """ - Parses the `value` in [logfmt](\(urls.logfmt)). - - * Keys and values can be wrapped using the `\"` character. - * `\"` characters can be escaped by the `\\` character. - * As per this [logfmt specification](\(urls.logfmt_specs)), the `parse_logfmt` function - accepts standalone keys and assigns them a Boolean value of `true`. - """ - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted key-value string", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse logfmt log" - source: #""" - parse_logfmt!( - "@timestamp=\"Sun Jan 10 16:47:39 EST 2021\" level=info msg=\"Stopping all fetchers\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager" - ) - """# - return: { - "@timestamp": "Sun Jan 10 16:47:39 EST 2021" - level: "info" - msg: "Stopping all fetchers" - "tag#production": "stopping_fetchers" - id: "ConsumerFetcherManager-1382721708341" - module: "kafka.consumer.ConsumerFetcherManager" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_logfmt": { + "anchor": "parse_logfmt", + "name": "parse_logfmt", + "category": "Parse", + "description": "Parses the `value` in [logfmt](https://brandur.org/logfmt).\n\n* Keys and values can be wrapped using the `\"` character.\n* `\"` characters can be escaped by the `\\` character.\n* As per this [logfmt specification](https://pkg.go.dev/github.com/kr/logfmt#section-documentation), the `parse_logfmt` function accepts standalone keys and assigns them a Boolean value of `true`.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted key-value string" + ], + "examples": [ + { + "title": "Parse simple logfmt log", + "source": "parse_logfmt!(\"zork=zook zonk=nork\")", + "return": { + "zonk": "nork", + "zork": "zook" + } + }, + { + "title": "Parse logfmt log", + "source": "parse_logfmt!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", + "return": { + "@timestamp": "Sun Jan 10 16:47:39 EST 2021", + "id": "ConsumerFetcherManager-1382721708341", + "level": "info", + "module": "kafka.consumer.ConsumerFetcherManager", + "msg": "Stopping all fetchers", + "tag#production": "stopping_fetchers" + } + }, + { + "title": "Parse logfmt log with standalone key", + "source": "parse_logfmt!(\"zork=zook plonk zonk=nork\")", + "return": { + "plonk": true, + "zonk": "nork", + "zork": "zook" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_nginx_log.cue b/website/cue/reference/remap/functions/parse_nginx_log.cue index 4e2ab088b7d82..c8a19e2ac8092 100644 --- a/website/cue/reference/remap/functions/parse_nginx_log.cue +++ b/website/cue/reference/remap/functions/parse_nginx_log.cue @@ -1,149 +1,131 @@ -package metadata - -remap: functions: parse_nginx_log: { - category: "Parse" - description: """ - Parses Nginx access and error log lines. Lines can be in [`combined`](\(urls.nginx_combined)), - [`ingress_upstreaminfo`](\(urls.nginx_ingress_upstreaminfo)), [`main`](\(urls.nginx_main)) or [`error`](\(urls.nginx_error)) format. - """ - notices: [ - """ - Missing information in the log message may be indicated by `-`. These fields are omitted in the result. - """, - """ - In case of `ingress_upstreaminfo` format the following fields may be safely omitted in the log message: `remote_addr`, `remote_user`, `http_referer`, `http_user_agent`, `proxy_alternative_upstream_name`, `upstream_addr`, `upstream_response_length`, `upstream_response_time`, `upstream_status`. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "timestamp_format" - description: """ - - The [date/time format](\(urls.chrono_time_formats)) to use for encoding the timestamp. The time is parsed - in local time if the timestamp doesn't specify a timezone. The default format is `%d/%b/%Y:%T %z` for - combined logs and `%Y/%m/%d %H:%M:%S` for error logs. - """ - required: false - default: "%d/%b/%Y:%T %z" - type: ["string"] - }, - { - name: "format" - description: "The format to use for parsing the log." - required: true - enum: { - "combined": "Nginx combined format" - "error": "Default Nginx error format" - "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)" - "main": "Nginx main format used by Docker images" - } - type: ["string"] - }, - ] - - internal_failure_reasons: [ - "`value` does not match the specified format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse via Nginx log format (combined)" - source: #""" - parse_nginx_log!( - s'172.17.0.1 - alice [01/Apr/2021:12:02:31 +0000] "POST /not-found HTTP/1.1" 404 153 "http://localhost/somewhere" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36" "2.75"', - "combined", - ) - """# - return: { - agent: "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36" - client: "172.17.0.1" - compression: "2.75" - referer: "http://localhost/somewhere" - request: "POST /not-found HTTP/1.1" - size: 153 - status: 404 - timestamp: "2021-04-01T12:02:31Z" - user: "alice" - } - }, - { - title: "Parse via Nginx log format (error)" - source: #""" - parse_nginx_log!( - s'2021/04/01 13:02:31 [error] 31#31: *1 open() "/usr/share/nginx/html/not-found" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "POST /not-found HTTP/1.1", host: "localhost:8081"', - "error" - ) - """# - return: { - timestamp: "2021-04-01T13:02:31Z" - severity: "error" - pid: 31 - tid: 31 - cid: 1 - message: "open() \"/usr/share/nginx/html/not-found\" failed (2: No such file or directory)" - client: "172.17.0.1" - server: "localhost" - request: "POST /not-found HTTP/1.1" - host: "localhost:8081" - } - }, - { - title: "Parse via Nginx log format (ingress_upstreaminfo)" - source: #""" - parse_nginx_log!( - s'0.0.0.0 - bob [18/Mar/2023:15:00:00 +0000] "GET /some/path HTTP/2.0" 200 12312 "https://10.0.0.1/some/referer" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" 462 0.050 [some-upstream-service-9000] [some-other-upstream-5000] 10.0.50.80:9000 19437 0.049 200 752178adb17130b291aefd8c386279e7', - "ingress_upstreaminfo" - ) - """# - return: { - body_bytes_size: 12312 - http_referer: "https://10.0.0.1/some/referer" - http_user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" - proxy_alternative_upstream_name: "some-other-upstream-5000" - proxy_upstream_name: "some-upstream-service-9000" - remote_addr: "0.0.0.0" - remote_user: "bob" - req_id: "752178adb17130b291aefd8c386279e7" - request: "GET /some/path HTTP/2.0" - request_length: 462 - request_time: 0.050 - status: 200 - timestamp: "2023-03-18T15:00:00Z" - upstream_addr: "10.0.50.80:9000" - upstream_response_length: 19437 - upstream_response_time: 0.049 - upstream_status: 200 - } - }, - { - title: "Parse via Nginx log format (main)" - source: #""" - parse_nginx_log!( - s'172.24.0.3 - alice [31/Dec/2024:17:32:06 +0000] "GET / HTTP/1.1" 200 615 "https://domain.tld/path" "curl/8.11.1" "1.2.3.4, 10.10.1.1"', - "main" - ) - """# - return: { - body_bytes_size: 615 - http_referer: "https://domain.tld/path" - http_user_agent: "curl/8.11.1" - http_x_forwarded_for: "1.2.3.4, 10.10.1.1" - remote_addr: "172.24.0.3" - remote_user: "alice" - request: "GET / HTTP/1.1" - status: 200 - timestamp: "2024-12-31T17:32:06Z" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_nginx_log": { + "anchor": "parse_nginx_log", + "name": "parse_nginx_log", + "category": "Parse", + "description": "Parses Nginx access and error log lines. Lines can be in [`combined`](https://nginx.org/en/docs/http/ngx_http_log_module.html), [`ingress_upstreaminfo`](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/log-format/), [`main`](https://hg.nginx.org/pkg-oss/file/tip/debian/debian/nginx.conf) or [`error`](https://github.com/nginx/nginx/blob/branches/stable-1.18/src/core/ngx_log.c#L102) format.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "format", + "description": "The format to use for parsing the log.", + "required": true, + "type": [ + "string" + ], + "enum": { + "combined": "Nginx combined format", + "error": "Default Nginx error format", + "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)", + "main": "Nginx main format used by Docker images" + } + }, + { + "name": "timestamp_format", + "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) to use for encoding the timestamp. The time is parsed\nin local time if the timestamp doesn't specify a timezone. The default format is `%d/%b/%Y:%T %z` for\ncombined logs and `%Y/%m/%d %H:%M:%S` for error logs.", + "required": false, + "type": [ + "string" + ], + "default": "%d/%b/%Y:%T %z" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` does not match the specified format.", + "`timestamp_format` is not a valid format string.", + "The timestamp in `value` fails to parse using the provided `timestamp_format`." + ], + "examples": [ + { + "title": "Parse via Nginx log format (combined)", + "source": "parse_nginx_log!(\n s'172.17.0.1 - alice [01/Apr/2021:12:02:31 +0000] \"POST /not-found HTTP/1.1\" 404 153 \"http://localhost/somewhere\" \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36\" \"2.75\"',\n \"combined\",\n)\n", + "return": { + "agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36", + "client": "172.17.0.1", + "compression": "2.75", + "referer": "http://localhost/somewhere", + "request": "POST /not-found HTTP/1.1", + "size": 153, + "status": 404, + "timestamp": "2021-04-01T12:02:31Z", + "user": "alice" + } + }, + { + "title": "Parse via Nginx log format (error)", + "source": "parse_nginx_log!(\n s'2021/04/01 13:02:31 [error] 31#31: *1 open() \"/usr/share/nginx/html/not-found\" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: \"POST /not-found HTTP/1.1\", host: \"localhost:8081\"',\n \"error\"\n)\n", + "return": { + "cid": 1, + "client": "172.17.0.1", + "host": "localhost:8081", + "message": "open() \"/usr/share/nginx/html/not-found\" failed (2: No such file or directory)", + "pid": 31, + "request": "POST /not-found HTTP/1.1", + "server": "localhost", + "severity": "error", + "tid": 31, + "timestamp": "2021-04-01T13:02:31Z" + } + }, + { + "title": "Parse via Nginx log format (ingress_upstreaminfo)", + "source": "parse_nginx_log!(\n s'0.0.0.0 - bob [18/Mar/2023:15:00:00 +0000] \"GET /some/path HTTP/2.0\" 200 12312 \"https://10.0.0.1/some/referer\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36\" 462 0.050 [some-upstream-service-9000] [some-other-upstream-5000] 10.0.50.80:9000 19437 0.049 200 752178adb17130b291aefd8c386279e7',\n \"ingress_upstreaminfo\"\n)\n", + "return": { + "body_bytes_size": 12312, + "http_referer": "https://10.0.0.1/some/referer", + "http_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36", + "proxy_alternative_upstream_name": "some-other-upstream-5000", + "proxy_upstream_name": "some-upstream-service-9000", + "remote_addr": "0.0.0.0", + "remote_user": "bob", + "req_id": "752178adb17130b291aefd8c386279e7", + "request": "GET /some/path HTTP/2.0", + "request_length": 462, + "request_time": 0.05, + "status": 200, + "timestamp": "2023-03-18T15:00:00Z", + "upstream_addr": "10.0.50.80:9000", + "upstream_response_length": 19437, + "upstream_response_time": 0.049, + "upstream_status": 200 + } + }, + { + "title": "Parse via Nginx log format (main)", + "source": "parse_nginx_log!(\n s'172.24.0.3 - alice [31/Dec/2024:17:32:06 +0000] \"GET / HTTP/1.1\" 200 615 \"https://domain.tld/path\" \"curl/8.11.1\" \"1.2.3.4, 10.10.1.1\"',\n \"main\"\n)\n", + "return": { + "body_bytes_size": 615, + "http_referer": "https://domain.tld/path", + "http_user_agent": "curl/8.11.1", + "http_x_forwarded_for": "1.2.3.4, 10.10.1.1", + "remote_addr": "172.24.0.3", + "remote_user": "alice", + "request": "GET / HTTP/1.1", + "status": 200, + "timestamp": "2024-12-31T17:32:06Z" + } + } + ], + "notices": [ + "Missing information in the log message may be indicated by `-`. These fields are\nomitted in the result.", + "In case of `ingress_upstreaminfo` format the following fields may be safely omitted\nin the log message: `remote_addr`, `remote_user`, `http_referer`, `http_user_agent`,\n`proxy_alternative_upstream_name`, `upstream_addr`, `upstream_response_length`,\n`upstream_response_time`, `upstream_status`." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_proto.cue b/website/cue/reference/remap/functions/parse_proto.cue index 29557895e0df3..de13960774632 100644 --- a/website/cue/reference/remap/functions/parse_proto.cue +++ b/website/cue/reference/remap/functions/parse_proto.cue @@ -1,65 +1,66 @@ -package metadata - -remap: functions: parse_proto: { - category: "Parse" - description: """ - Parses the `value` as a protocol buffer payload. - """ - notices: [ - """ - Only proto messages are parsed and returned. - """, - ] - - arguments: [ - { - name: "value" - description: "The protocol buffer payload to parse." - required: true - type: ["string"] - }, - { - name: "desc_file" - description: """ - The path to the protobuf descriptor set file. Must be a literal string. - - This file is the output of protoc -o ... - """ - required: true - type: ["string"] - }, - { - name: "message_type" - description: """ - The name of the message type to use for serializing. - - Must be a literal string. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid proto payload.", - "`desc_file` file does not exist.", - "`message_type` message type does not exist in the descriptor file.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse proto" - source: #""" - parse_proto!(decode_base64!("Cgdzb21lb25lIggKBjEyMzQ1Ng=="), "resources/protobuf_descriptor_set.desc", "test_protobuf.Person") - """# - return: { - name: "someone" - phones: [ - { - number: "123456" - }, - ] - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_proto": { + "anchor": "parse_proto", + "name": "parse_proto", + "category": "Parse", + "description": "Parses the `value` as a protocol buffer payload.", + "arguments": [ + { + "name": "value", + "description": "The protocol buffer payload to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "desc_file", + "description": "The path to the protobuf descriptor set file. Must be a literal string.\n\nThis file is the output of protoc -o ...", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "message_type", + "description": "The name of the message type to use for serializing.\n\nMust be a literal string.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid proto payload.", + "`desc_file` file does not exist.", + "`message_type` message type does not exist in the descriptor file." + ], + "examples": [ + { + "title": "Parse proto", + "source": "parse_proto!(decode_base64!(\"Cgdzb21lb25lIggKBjEyMzQ1Ng==\"), \"test_protobuf.desc\", \"test_protobuf.v1.Person\")", + "return": { + "name": "someone", + "phones": [ + { + "number": "123456" + } + ] + } + } + ], + "notices": [ + "Only proto messages are parsed and returned." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_query_string.cue b/website/cue/reference/remap/functions/parse_query_string.cue index a5bc4308db839..80cffe2491d6c 100644 --- a/website/cue/reference/remap/functions/parse_query_string.cue +++ b/website/cue/reference/remap/functions/parse_query_string.cue @@ -1,47 +1,63 @@ -package metadata - -remap: functions: parse_query_string: { - category: "Parse" - description: #""" - Parses the `value` as a query string. - """# - notices: [ - """ - All values are returned as strings. We recommend manually coercing values to desired types as you see fit. Empty keys and values are allowed. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["object"] - - examples: [ - { - title: "Parse query string" - source: #""" - parse_query_string("foo=%2B1&bar=2&bar=3&xyz") - """# - return: { - foo: "+1" - bar: ["2", "3"] - xyz: "" - } - }, - { - title: "Parse Ruby on Rails' query string" - source: #""" - parse_query_string("?foo%5b%5d=1&foo%5b%5d=2") - """# - return: { - "foo[]": ["1", "2"] - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_query_string": { + "anchor": "parse_query_string", + "name": "parse_query_string", + "category": "Parse", + "description": "Parses the `value` as a query string.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Parse simple query string", + "source": "parse_query_string(\"foo=1&bar=2\")", + "return": { + "bar": "2", + "foo": "1" + } + }, + { + "title": "Parse query string", + "source": "parse_query_string(\"foo=%2B1&bar=2&bar=3&xyz\")", + "return": { + "bar": [ + "2", + "3" + ], + "foo": "+1", + "xyz": "" + } + }, + { + "title": "Parse Ruby on Rails' query string", + "source": "parse_query_string(\"?foo%5b%5d=1&foo%5b%5d=2\")", + "return": { + "foo[]": [ + "1", + "2" + ] + } + } + ], + "notices": [ + "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit. Empty keys and values are allowed." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_regex.cue b/website/cue/reference/remap/functions/parse_regex.cue index fc95669169749..02de82c715a8d 100644 --- a/website/cue/reference/remap/functions/parse_regex.cue +++ b/website/cue/reference/remap/functions/parse_regex.cue @@ -1,78 +1,100 @@ -package metadata - -remap: functions: parse_regex: { - category: "Parse" - description: """ - Parses the `value` using the provided [Regex](\(urls.regex)) `pattern`. - - This function differs from the `parse_regex_all` function in that it returns only the first match. - """ - notices: [ - """ - VRL aims to provide purpose-specific [parsing functions](\(urls.vrl_parsing_functions)) for common log formats. - Before reaching for the `parse_regex` function, see if a VRL [`parse_*` function](\(urls.vrl_parsing_functions)) - already exists for your format. If not, we recommend [opening an issue](\(urls.new_feature_request)) to request - support for the desired format. - """, - """ - All values are returned as strings. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to search." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The regular expression pattern to search against." - required: true - type: ["regex"] - }, - { - name: "numeric_groups" - description: """ - If true, the index of each group in the regular expression is also captured. Index `0` - contains the whole match. - """ - required: false - default: false - type: ["regex"] - }, - ] - internal_failure_reasons: [ - "`value` fails to parse using the provided `pattern`.", - ] - return: { - types: ["object"] - rules: [ - "Matches return all capture groups corresponding to the leftmost matches in the text.", - "Raises an error if no match is found.", - ] - } - - examples: [ - { - title: "Parse using Regex (with capture groups)" - source: """ - parse_regex!("first group and second group.", r'(?P.*?) group') - """ - return: { - number: "first" - } - }, - { - title: "Parse using Regex (without capture groups)" - source: """ - parse_regex!("first group and second group.", r'(\\w+) group', numeric_groups: true) - """ - return: { - "0": "first group" - "1": "first" - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_regex": { + "anchor": "parse_regex", + "name": "parse_regex", + "category": "Parse", + "description": "Parses the `value` using the provided [Regex](https://en.wikipedia.org/wiki/Regular_expression) `pattern`.\n\nThis function differs from the `parse_regex_all` function in that it returns only the first match.", + "arguments": [ + { + "name": "value", + "description": "The string to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "The regular expression pattern to search against.", + "required": true, + "type": [ + "regex" + ] + }, + { + "name": "numeric_groups", + "description": "If true, the index of each group in the regular expression is also captured. Index `0`\ncontains the whole match.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ], + "rules": [ + "Matches return all capture groups corresponding to the leftmost matches in the text.", + "Raises an error if no match is found." + ] + }, + "internal_failure_reasons": [ + "`value` fails to parse using the provided `pattern`." + ], + "examples": [ + { + "title": "Parse using Regex (with capture groups)", + "source": "parse_regex!(\"first group and second group.\", r'(?P.*?) group')", + "return": { + "number": "first" + } + }, + { + "title": "Parse using Regex (without capture groups)", + "source": "parse_regex!(\"first group and second group.\", r'(\\w+) group', numeric_groups: true)", + "return": { + "0": "first group", + "1": "first" + } + }, + { + "title": "Parse using Regex with simple match", + "source": "parse_regex!(\"8.7.6.5 - zorp\", r'^(?P[\\w\\.]+) - (?P[\\w]+)')", + "return": { + "host": "8.7.6.5", + "user": "zorp" + } + }, + { + "title": "Parse using Regex with all numeric groups", + "source": "parse_regex!(\"8.7.6.5 - zorp\", r'^(?P[\\w\\.]+) - (?P[\\w]+)', numeric_groups: true)", + "return": { + "0": "8.7.6.5 - zorp", + "1": "8.7.6.5", + "2": "zorp", + "host": "8.7.6.5", + "user": "zorp" + } + }, + { + "title": "Parse using Regex with variables", + "source": "variable = r'^(?P[\\w\\.]+) - (?P[\\w]+)';\nparse_regex!(\"8.7.6.5 - zorp\", variable)\n", + "return": { + "host": "8.7.6.5", + "user": "zorp" + } + } + ], + "notices": [ + "VRL aims to provide purpose-specific [parsing functions](/docs/reference/vrl/functions/#parse-functions)\nfor common log formats. Before reaching for the `parse_regex` function, see if a VRL\n[`parse_*` function](/docs/reference/vrl/functions/#parse-functions) already exists\nfor your format. If not, we recommend\n[opening an issue](https://github.com/vectordotdev/vector/issues/new?labels=type%3A+new+feature)\nto request support for the desired format.", + "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_regex_all.cue b/website/cue/reference/remap/functions/parse_regex_all.cue index 0607a3fec176d..9cd255bc66463 100644 --- a/website/cue/reference/remap/functions/parse_regex_all.cue +++ b/website/cue/reference/remap/functions/parse_regex_all.cue @@ -1,68 +1,123 @@ -package metadata - -remap: functions: parse_regex_all: { - category: "Parse" - description: """ - Parses the `value` using the provided [Regex](\(urls.regex)) `pattern`. - - This function differs from the `parse_regex` function in that it returns _all_ matches, not just the first. - """ - notices: remap.functions.parse_regex.notices - - arguments: [ - { - name: "value" - description: "The string to search." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The regular expression pattern to search against." - required: true - type: ["regex"] - }, - { - name: "numeric_groups" - description: """ - If `true`, the index of each group in the regular expression is also captured. Index `0` - contains the whole match. - """ - required: false - default: false - type: ["regex"] - }, - ] - internal_failure_reasons: [ - "`value` is not a string.", - "`pattern` is not a regex.", - ] - return: { - types: ["array"] - rules: [ - "Matches return all capture groups corresponding to the leftmost matches in the text.", - "Raises an error if no match is found.", - ] - } - - examples: [ - { - title: "Parse using Regex (all matches)" - source: """ - parse_regex_all!("first group and second group.", r'(?P\\w+) group', numeric_groups: true) - """ - return: [ - { - number: "first" - "0": "first group" - "1": "first" - }, - { - number: "second" - "0": "second group" - "1": "second" - }, - ] - }, - ] -} +{ + "remap": { + "functions": { + "parse_regex_all": { + "anchor": "parse_regex_all", + "name": "parse_regex_all", + "category": "Parse", + "description": "Parses the `value` using the provided [Regex](https://en.wikipedia.org/wiki/Regular_expression) `pattern`.\n\nThis function differs from the `parse_regex` function in that it returns _all_ matches, not just the first.", + "arguments": [ + { + "name": "value", + "description": "The string to search.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "pattern", + "description": "The regular expression pattern to search against.", + "required": true, + "type": [ + "regex" + ] + }, + { + "name": "numeric_groups", + "description": "If `true`, the index of each group in the regular expression is also captured. Index `0`\ncontains the whole match.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Matches return all capture groups corresponding to the leftmost matches in the text.", + "Raises an error if no match is found." + ] + }, + "internal_failure_reasons": [ + "`value` is not a string.", + "`pattern` is not a regex." + ], + "examples": [ + { + "title": "Parse using Regex (all matches)", + "source": "parse_regex_all!(\"first group and second group.\", r'(?P\\w+) group', numeric_groups: true)", + "return": [ + { + "0": "first group", + "1": "first", + "number": "first" + }, + { + "0": "second group", + "1": "second", + "number": "second" + } + ] + }, + { + "title": "Parse using Regex (simple match)", + "source": "parse_regex_all!(\"apples and carrots, peaches and peas\", r'(?P[\\w\\.]+) and (?P[\\w]+)')", + "return": [ + { + "fruit": "apples", + "veg": "carrots" + }, + { + "fruit": "peaches", + "veg": "peas" + } + ] + }, + { + "title": "Parse using Regex (all numeric groups)", + "source": "parse_regex_all!(\"apples and carrots, peaches and peas\", r'(?P[\\w\\.]+) and (?P[\\w]+)', numeric_groups: true)", + "return": [ + { + "0": "apples and carrots", + "1": "apples", + "2": "carrots", + "fruit": "apples", + "veg": "carrots" + }, + { + "0": "peaches and peas", + "1": "peaches", + "2": "peas", + "fruit": "peaches", + "veg": "peas" + } + ] + }, + { + "title": "Parse using Regex with variables", + "source": "variable = r'(?P[\\w\\.]+) and (?P[\\w]+)';\nparse_regex_all!(\"apples and carrots, peaches and peas\", variable)\n", + "return": [ + { + "fruit": "apples", + "veg": "carrots" + }, + { + "fruit": "peaches", + "veg": "peas" + } + ] + } + ], + "notices": [ + "VRL aims to provide purpose-specific [parsing functions](/docs/reference/vrl/functions/#parse-functions)\nfor common log formats. Before reaching for the `parse_regex` function, see if a VRL\n[`parse_*` function](/docs/reference/vrl/functions/#parse-functions) already exists\nfor your format. If not, we recommend\n[opening an issue](https://github.com/vectordotdev/vector/issues/new?labels=type%3A+new+feature)\nto request support for the desired format.", + "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_ruby_hash.cue b/website/cue/reference/remap/functions/parse_ruby_hash.cue index 9d733c6ea2c5c..b4e0132aa7275 100644 --- a/website/cue/reference/remap/functions/parse_ruby_hash.cue +++ b/website/cue/reference/remap/functions/parse_ruby_hash.cue @@ -1,45 +1,48 @@ -package metadata - -remap: functions: parse_ruby_hash: { - category: "Parse" - description: """ - Parses the `value` as ruby hash. - """ - - notices: [ - """ - Only ruby types are returned. If you need to convert a `string` into a `timestamp`, consider the - [`parse_timestamp`](#parse_timestamp) function. - """, - ] - arguments: [ - { - name: "value" - description: "The string representation of the ruby hash to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid ruby hash formatted payload.", - ] - - return: types: ["object"] - - examples: [ - { - title: "Parse ruby hash" - source: """ - parse_ruby_hash!(s'{ "test" => "value", "testNum" => 0.2, "testObj" => { "testBool" => true, "testNull" => nil } }') - """ - return: { - test: "value" - testNum: 0.2 - testObj: { - testBool: true - testNull: null - } - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_ruby_hash": { + "anchor": "parse_ruby_hash", + "name": "parse_ruby_hash", + "category": "Parse", + "description": "Parses the `value` as ruby hash.", + "arguments": [ + { + "name": "value", + "description": "The string representation of the ruby hash to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid ruby hash formatted payload." + ], + "examples": [ + { + "title": "Parse ruby hash", + "source": "parse_ruby_hash!(s'{ \"test\" => \"value\", \"testNum\" => 0.2, \"testObj\" => { \"testBool\" => true, \"testNull\" => nil } }')", + "return": { + "test": "value", + "testNum": 0.2, + "testObj": { + "testBool": true, + "testNull": null + } + } + } + ], + "notices": [ + "Only ruby types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the [`parse_timestamp`](#parse_timestamp) function." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_syslog.cue b/website/cue/reference/remap/functions/parse_syslog.cue index cb17be2b04146..8bc1d307b6a1a 100644 --- a/website/cue/reference/remap/functions/parse_syslog.cue +++ b/website/cue/reference/remap/functions/parse_syslog.cue @@ -1,58 +1,57 @@ -package metadata - -remap: functions: parse_syslog: { - category: "Parse" - description: """ - Parses the `value` in [Syslog](\(urls.syslog)) format. - """ - notices: [ - """ - The function makes a best effort to parse the various Syslog formats that exists out in the wild. This includes - [RFC 6587](\(urls.syslog_6587)), [RFC 5424](\(urls.syslog_5424)), [RFC 3164](\(urls.syslog_3164)), and other - common variations (such as the Nginx Syslog style). - """, - """ - All values are returned as strings. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The text containing the Syslog message to parse." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted Syslog message.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse Syslog log (5424)" - source: """ - parse_syslog!( - s'<13>1 2020-03-13T20:45:38.119Z dynamicwireless.name non 2426 ID931 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"] Try to override the THX port, maybe it will reboot the neural interface!' - ) - """ - return: { - severity: "notice" - facility: "user" - timestamp: "2020-03-13T20:45:38.119Z" - hostname: "dynamicwireless.name" - appname: "non" - procid: 2426 - msgid: "ID931" - message: "Try to override the THX port, maybe it will reboot the neural interface!" - "exampleSDID@32473": { - eventID: "1011" - eventSource: "Application" - iut: "3" - } - version: 1 - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_syslog": { + "anchor": "parse_syslog", + "name": "parse_syslog", + "category": "Parse", + "description": "Parses the `value` in [Syslog](https://en.wikipedia.org/wiki/Syslog) format.", + "arguments": [ + { + "name": "value", + "description": "The text containing the Syslog message to parse.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted Syslog message." + ], + "examples": [ + { + "title": "Parse Syslog log (5424)", + "source": "parse_syslog!(s'<13>1 2020-03-13T20:45:38.119Z dynamicwireless.name non 2426 ID931 [exampleSDID@32473 iut=\"3\" eventSource= \"Application\" eventID=\"1011\"] Try to override the THX port, maybe it will reboot the neural interface!')", + "return": { + "appname": "non", + "exampleSDID@32473": { + "eventID": "1011", + "eventSource": "Application", + "iut": "3" + }, + "facility": "user", + "hostname": "dynamicwireless.name", + "message": "Try to override the THX port, maybe it will reboot the neural interface!", + "msgid": "ID931", + "procid": 2426, + "severity": "notice", + "timestamp": "2020-03-13T20:45:38.119Z", + "version": 1 + } + } + ], + "notices": [ + "The function makes a best effort to parse the various Syslog formats that exists out\nin the wild. This includes [RFC 6587](https://tools.ietf.org/html/rfc6587),\n[RFC 5424](https://tools.ietf.org/html/rfc5424),\n[RFC 3164](https://tools.ietf.org/html/rfc3164), and other common variations (such\nas the Nginx Syslog style).", + "All values are returned as strings. We recommend manually coercing values to desired types as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_timestamp.cue b/website/cue/reference/remap/functions/parse_timestamp.cue index a47aaa2aa6133..846f17b9c15b6 100644 --- a/website/cue/reference/remap/functions/parse_timestamp.cue +++ b/website/cue/reference/remap/functions/parse_timestamp.cue @@ -1,54 +1,61 @@ -package metadata - -remap: functions: parse_timestamp: { - category: "Parse" - description: """ - Parses the `value` in [strptime](\(urls.strptime_specifiers)) `format`. - """ - - arguments: [ - { - name: "value" - description: "The text of the timestamp." - required: true - type: ["string"] - }, - { - name: "format" - description: "The [strptime](\(urls.strptime_specifiers)) format." - required: true - type: ["string"] - }, - { - name: "timezone" - description: """ - The [TZ database](\(urls.tz_time_zones)) format. By default, this function parses the timestamp by global [`timezone` option](\(urls.vector_configuration)/global-options#timezone). - This argument overwrites the setting and is useful for parsing timestamps without a specified timezone, such as `16/10/2019 12:00:00`. - """ - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` fails to parse using the provided `format`.", - "`value` fails to parse using the provided `timezone`.", - ] - return: types: ["timestamp"] - - examples: [ - { - title: "Parse timestamp" - source: #""" - parse_timestamp!("10-Oct-2020 16:00+00:00", format: "%v %R %:z") - """# - return: "2020-10-10T16:00:00Z" - }, - { - title: "Parse timestamp with timezone" - source: #""" - parse_timestamp!("16/10/2019 12:00:00", format: "%d/%m/%Y %H:%M:%S", timezone: "Asia/Taipei") - """# - return: "2019-10-16T04:00:00Z" - }, - ] -} +{ + "remap": { + "functions": { + "parse_timestamp": { + "anchor": "parse_timestamp", + "name": "parse_timestamp", + "category": "Parse", + "description": "Parses the `value` in [strptime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) `format`.", + "arguments": [ + { + "name": "value", + "description": "The text of the timestamp.", + "required": true, + "type": [ + "string", + "timestamp" + ] + }, + { + "name": "format", + "description": "The [strptime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) format.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "timezone", + "description": "The [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format. By default, this function parses the timestamp by global [`timezone` option](/docs/reference/configuration//global-options#timezone).\nThis argument overwrites the setting and is useful for parsing timestamps without a specified timezone, such as `16/10/2019 12:00:00`.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "timestamp" + ] + }, + "internal_failure_reasons": [ + "`value` fails to parse using the provided `format`.", + "`value` fails to parse using the provided `timezone`." + ], + "examples": [ + { + "title": "Parse timestamp", + "source": "parse_timestamp!(\"10-Oct-2020 16:00+00:00\", format: \"%v %R %:z\")", + "return": "t'2020-10-10T16:00:00Z'" + }, + { + "title": "Parse timestamp with timezone", + "source": "parse_timestamp!(\"16/10/2019 12:00:00\", format: \"%d/%m/%Y %H:%M:%S\", timezone: \"Asia/Taipei\")", + "return": "t'2019-10-16T04:00:00Z'" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_tokens.cue b/website/cue/reference/remap/functions/parse_tokens.cue index c76fb6e2f6ef2..25c34796dd21d 100644 --- a/website/cue/reference/remap/functions/parse_tokens.cue +++ b/website/cue/reference/remap/functions/parse_tokens.cue @@ -1,42 +1,47 @@ -package metadata - -remap: functions: parse_tokens: { - category: "Parse" - description: #""" - Parses the `value` in token format. A token is considered to be one of the following: - - * A word surrounded by whitespace. - * Text delimited by double quotes: `".."`. Quotes can be included in the token if they are escaped by a backslash (`\`). - * Text delimited by square brackets: `[..]`. Closing square brackets can be included in the token if they are escaped by a backslash (`\`). - """# - notices: [ - """ - All token values are returned as strings. We recommend manually coercing values to desired types as you see fit. - """, - ] - - arguments: [ - { - name: "value" - description: "The string to tokenize." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted tokenized string.", - ] - return: types: ["array"] - - examples: [ - { - title: "Parse tokens" - source: #""" - parse_tokens( - "A sentence \"with \\\"a\\\" sentence inside\" and [some brackets]" - ) - """# - return: ["A", "sentence", #"with \"a\" sentence inside"#, "and", "some brackets"] - }, - ] -} +{ + "remap": { + "functions": { + "parse_tokens": { + "anchor": "parse_tokens", + "name": "parse_tokens", + "category": "Parse", + "description": "Parses the `value` in token format. A token is considered to be one of the following:\n\n* A word surrounded by whitespace.\n* Text delimited by double quotes: `\"..\"`. Quotes can be included in the token if they are escaped by a backslash (`\\`).\n* Text delimited by square brackets: `[..]`. Closing square brackets can be included in the token if they are escaped by a backslash (`\\`).", + "arguments": [ + { + "name": "value", + "description": "The string to tokenize.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted tokenized string." + ], + "examples": [ + { + "title": "Parse tokens", + "source": "parse_tokens(s'A sentence \"with \\\"a\\\" sentence inside\" and [some brackets]')", + "return": [ + "A", + "sentence", + "with \\\"a\\\" sentence inside", + "and", + "some brackets" + ] + } + ], + "notices": [ + "All token values are returned as strings. We recommend manually coercing values to\ndesired types as you see fit." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_url.cue b/website/cue/reference/remap/functions/parse_url.cue index 0d69d7842dde9..eb4c6a2152dba 100644 --- a/website/cue/reference/remap/functions/parse_url.cue +++ b/website/cue/reference/remap/functions/parse_url.cue @@ -1,100 +1,72 @@ -package metadata - -remap: functions: parse_url: { - category: "Parse" - description: """ - Parses the `value` in [URL](\(urls.url)) format. - """ - - arguments: [ - { - name: "value" - description: "The text of the URL." - required: true - type: ["string"] - }, - { - name: "default_known_ports" - description: """ - If true and the port number is not specified in the input URL - string (or matches the default port for the scheme), it is - populated from well-known ports for the following schemes: - `http`, `https`, `ws`, `wss`, and `ftp`. - """ - required: false - type: ["boolean"] - default: false - }, - ] - internal_failure_reasons: [ - "`value` is not a properly formatted URL.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse URL" - source: #""" - parse_url!("ftp://foo:bar@example.com:4343/foobar?hello=world#123") - """# - return: { - scheme: "ftp" - username: "foo" - password: "bar" - host: "example.com" - port: 4343 - path: "/foobar" - query: hello: "world" - fragment: "123" - } - }, - { - title: "Parse URL with default port" - source: #""" - parse_url!("https://example.com", default_known_ports: true) - """# - return: { - scheme: "https" - username: "" - password: "" - host: "example.com" - port: 443 - path: "/" - query: {} - fragment: null - } - }, - { - title: "Parse URL with internationalized domain name" - source: #""" - parse_url!("https://www.café.com") - """# - return: { - scheme: "https" - username: "" - password: "" - host: "www.xn--caf-dma.com" - port: null - path: "/" - query: {} - fragment: null - } - }, - { - title: "Parse URL with mixed case internationalized domain name" - source: #""" - parse_url!("https://www.CAFé.com") - """# - return: { - scheme: "https" - username: "" - password: "" - host: "www.xn--caf-dma.com" - port: null - path: "/" - query: {} - fragment: null - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_url": { + "anchor": "parse_url", + "name": "parse_url", + "category": "Parse", + "description": "Parses the `value` in [URL](https://en.wikipedia.org/wiki/URL) format.", + "arguments": [ + { + "name": "value", + "description": "The text of the URL.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "default_known_ports", + "description": "If true and the port number is not specified in the input URL\nstring (or matches the default port for the scheme), it is\npopulated from well-known ports for the following schemes:\n`http`, `https`, `ws`, `wss`, and `ftp`.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a properly formatted URL." + ], + "examples": [ + { + "title": "Parse URL", + "source": "parse_url!(\"ftp://foo:bar@example.com:4343/foobar?hello=world#123\")", + "return": { + "fragment": "123", + "host": "example.com", + "password": "bar", + "path": "/foobar", + "port": 4343, + "query": { + "hello": "world" + }, + "scheme": "ftp", + "username": "foo" + } + }, + { + "title": "Parse URL with default port", + "source": "parse_url!(\"https://example.com\", default_known_ports: true)", + "return": { + "fragment": null, + "host": "example.com", + "password": "", + "path": "/", + "port": 443, + "query": {}, + "scheme": "https", + "username": "" + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_user_agent.cue b/website/cue/reference/remap/functions/parse_user_agent.cue index 3f0717ff5a292..c13ba770546d4 100644 --- a/website/cue/reference/remap/functions/parse_user_agent.cue +++ b/website/cue/reference/remap/functions/parse_user_agent.cue @@ -1,123 +1,110 @@ -package metadata - -remap: functions: parse_user_agent: { - category: "Parse" - description: """ - Parses the `value` as a user agent string, which has [a loosely defined format](\(urls.user_agent)) - so this parser only provides best effort guarantee. - """ - notices: [ - "All values are returned as strings or as null. We recommend manually coercing values to desired types as you see fit.", - "Different modes return different schema.", - "Field which were not parsed out are set as `null`.", - ] - - arguments: [ - { - name: "value" - description: "The string to parse." - required: true - type: ["string"] - }, - { - name: "mode" - description: "Determines performance and reliability characteristics." - required: false - enum: { - fast: "Fastest mode but most unreliable. Uses parser from project [Woothee](\(urls.woothee))." - reliable: """ - Provides greater reliability than `fast` and retains it's speed in common cases. - Parses with [Woothee](\(urls.woothee)) parser and with parser from [uap project](\(urls.uap)) if - there are some missing fields that the first parser wasn't able to parse out - but the second one maybe can. - """ - enriched: """ - Parses with both parser from [Woothee](\(urls.woothee)) and parser from [uap project](\(urls.uap)) - and combines results. Result has the full schema. - """ - } - default: "fast" - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["object"] - - examples: [ - { - title: "Fast mode" - source: #""" - parse_user_agent( - "Mozilla Firefox 1.0.1 Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.6) Gecko/20050223 Firefox/1.0.1" - ) - """# - return: { - browser: { - family: "Firefox" - version: "1.0.1" - } - device: { - category: "pc" - } - os: { - family: "Linux" - version: null - } - } - }, - { - title: "Reliable mode" - source: #""" - parse_user_agent( - "Mozilla/4.0 (compatible; MSIE 7.66; Windows NT 5.1; SV1; .NET CLR 1.1.4322)", - mode: "reliable" - ) - """# - return: { - browser: { - family: "Internet Explorer" - version: "7.66" - } - device: { - category: "pc" - } - os: { - family: "Windows XP" - version: "NT 5.1" - } - } - }, - { - title: "Enriched mode" - source: #""" - parse_user_agent( - "Opera/9.80 (J2ME/MIDP; Opera Mini/4.3.24214; iPhone; CPU iPhone OS 4_2_1 like Mac OS X; AppleWebKit/24.783; U; en) Presto/2.5.25 Version/10.54", - mode: "enriched" - ) - """# - return: { - browser: { - family: "Opera Mini" - major: "4" - minor: "3" - patch: "24214" - version: "10.54" - } - device: { - brand: "Apple" - category: "smartphone" - family: "iPhone" - model: "iPhone" - } - os: { - family: "iOS" - major: "4" - minor: "2" - patch: "1" - patch_minor: null - version: "4.2.1" - } - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_user_agent": { + "anchor": "parse_user_agent", + "name": "parse_user_agent", + "category": "Parse", + "description": "Parses the provided `value` as a user agent, which has\n[a loosely defined format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).\n\nParses on the basis of best effort. Returned schema depends only on the configured `mode`,\nso if the function fails to parse a field it will set it to `null`.", + "arguments": [ + { + "name": "value", + "description": "The string to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "mode", + "description": "Determines performance and reliability characteristics.", + "required": false, + "type": [ + "string" + ], + "enum": { + "fast": "Fastest mode but most unreliable. Uses parser from project [Woothee](https://github.com/woothee/woothee).", + "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n", + "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n" + }, + "default": "fast" + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Fast mode", + "source": "parse_user_agent(\n \"Mozilla Firefox 1.0.1 Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.6) Gecko/20050223 Firefox/1.0.1\"\n)\n", + "return": { + "browser": { + "family": "Firefox", + "version": "1.0.1" + }, + "device": { + "category": "pc" + }, + "os": { + "family": "Linux", + "version": null + } + } + }, + { + "title": "Reliable mode", + "source": "parse_user_agent(\n \"Mozilla/4.0 (compatible; MSIE 7.66; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\",\n mode: \"reliable\")\n", + "return": { + "browser": { + "family": "Internet Explorer", + "version": "7.66" + }, + "device": { + "category": "pc" + }, + "os": { + "family": "Windows XP", + "version": "NT 5.1" + } + } + }, + { + "title": "Enriched mode", + "source": "parse_user_agent(\n \"Opera/9.80 (J2ME/MIDP; Opera Mini/4.3.24214; iPhone; CPU iPhone OS 4_2_1 like Mac OS X; AppleWebKit/24.783; U; en) Presto/2.5.25 Version/10.54\",\n mode: \"enriched\"\n)\n", + "return": { + "browser": { + "family": "Opera Mini", + "major": "4", + "minor": "3", + "patch": "24214", + "version": "10.54" + }, + "device": { + "brand": "Apple", + "category": "smartphone", + "family": "iPhone", + "model": "iPhone" + }, + "os": { + "family": "iOS", + "major": "4", + "minor": "2", + "patch": "1", + "patch_minor": null, + "version": "4.2.1" + } + } + } + ], + "notices": [ + "All values are returned as strings or as null. We recommend manually coercing values\nto desired types as you see fit.", + "Different modes return different schema.", + "Field which were not parsed out are set as `null`." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/parse_xml.cue b/website/cue/reference/remap/functions/parse_xml.cue index ffe2ed4348e54..00f6d6c0fc0f9 100644 --- a/website/cue/reference/remap/functions/parse_xml.cue +++ b/website/cue/reference/remap/functions/parse_xml.cue @@ -1,97 +1,123 @@ -package metadata - -remap: functions: parse_xml: { - category: "Parse" - description: """ - Parses the `value` as XML. - """ - notices: [ - """ - Valid XML must contain exactly one root node. Always returns an object. - """, - ] - - arguments: [ - { - name: "value" - description: "The string representation of the XML document to parse." - required: true - type: ["string"] - }, - { - name: "include_attr" - description: "Include XML tag attributes in the returned object." - required: false - default: true - type: ["boolean"] - }, - { - name: "attr_prefix" - description: "String prefix to use for XML tag attribute keys." - required: false - default: "@" - type: ["string"] - }, - { - name: "text_key" - description: "Key name to use for expanded text nodes." - required: false - default: "text" - type: ["string"] - }, - { - name: "always_use_text_key" - description: "Always return text nodes as `{\"\": \"value\"}.`" - required: false - default: false - type: ["boolean"] - }, - { - name: "parse_bool" - description: "Parse \"true\" and \"false\" as boolean." - required: false - default: true - type: ["boolean"] - }, - { - name: "parse_null" - description: "Parse \"null\" as null." - required: false - default: true - type: ["boolean"] - }, - { - name: "parse_number" - description: "Parse numbers as integers/floats." - required: false - default: true - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid XML document.", - ] - return: types: ["object"] - - examples: [ - { - title: "Parse XML" - source: #""" - value = s'Harry PotterJ K. Rowling2005'; - - parse_xml!(value, text_key: "value", parse_number: false) - """# - return: { - "book": { - "@category": "CHILDREN" - "author": "J K. Rowling" - "title": { - "@lang": "en" - "value": "Harry Potter" - } - "year": "2005" - } - } - }, - ] -} +{ + "remap": { + "functions": { + "parse_xml": { + "anchor": "parse_xml", + "name": "parse_xml", + "category": "Parse", + "description": "Parses the `value` as XML.", + "arguments": [ + { + "name": "value", + "description": "The string representation of the XML document to parse.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "trim", + "description": "Remove excess whitespace between XML elements.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "include_attr", + "description": "Include XML tag attributes in the returned object.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "attr_prefix", + "description": "String prefix to use for XML tag attribute keys.", + "required": false, + "type": [ + "string" + ], + "default": "@" + }, + { + "name": "text_key", + "description": "Key name to use for expanded text nodes.", + "required": false, + "type": [ + "string" + ], + "default": "text" + }, + { + "name": "always_use_text_key", + "description": "Always return text nodes as `{\"\": \"value\"}.`", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + }, + { + "name": "parse_bool", + "description": "Parse \"true\" and \"false\" as boolean.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "parse_null", + "description": "Parse \"null\" as null.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + }, + { + "name": "parse_number", + "description": "Parse numbers as integers/floats.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "object" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid XML document." + ], + "examples": [ + { + "title": "Parse XML", + "source": "value = s'Harry PotterJ K. Rowling2005';\n\nparse_xml!(value, text_key: \"value\", parse_number: false)\n", + "return": { + "book": { + "@category": "CHILDREN", + "author": "J K. Rowling", + "title": { + "@lang": "en", + "value": "Harry Potter" + }, + "year": "2005" + } + } + } + ], + "notices": [ + "Valid XML must contain exactly one root node. Always returns an object." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/pascalcase.cue b/website/cue/reference/remap/functions/pascalcase.cue index cf0cc89dd7c4d..35ac7d989f803 100644 --- a/website/cue/reference/remap/functions/pascalcase.cue +++ b/website/cue/reference/remap/functions/pascalcase.cue @@ -1,43 +1,60 @@ -package metadata - -remap: functions: pascalcase: { - category: "String" - description: """ - Takes the `value` string, and turns it into PascalCase. Optionally, you can - pass in the existing case of the function, or else we will try to figure out the case automatically. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to PascalCase." - required: true - type: ["string"] - }, - { - name: "original_case" - description: "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case" - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "PascalCase a string" - source: #""" - pascalcase("input-string") - """# - return: "InputString" - }, - { - title: "PascalCase a string" - source: #""" - pascalcase("input-string", "kebab-case") - """# - return: "InputString" - }, - ] -} +{ + "remap": { + "functions": { + "pascalcase": { + "anchor": "pascalcase", + "name": "pascalcase", + "category": "String", + "description": "Takes the `value` string, and turns it into PascalCase. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to PascalCase.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "original_case", + "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", + "required": false, + "type": [ + "string" + ], + "enum": { + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + } + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "PascalCase a string without specifying original case", + "source": "pascalcase(\"input-string\")", + "return": "InputString" + }, + { + "title": "PascalCase a snake_case string", + "source": "pascalcase(\"foo_bar_baz\", \"snake_case\")", + "return": "FooBarBaz" + }, + { + "title": "PascalCase specifying the wrong original case (only capitalizes)", + "source": "pascalcase(\"foo_bar_baz\", \"kebab-case\")", + "return": "Foo_bar_baz" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/pop.cue b/website/cue/reference/remap/functions/pop.cue index 4f55b23b92539..48e3ca5a5d4ee 100644 --- a/website/cue/reference/remap/functions/pop.cue +++ b/website/cue/reference/remap/functions/pop.cue @@ -1,34 +1,41 @@ -package metadata - -remap: functions: pop: { - category: "Array" - description: """ - Removes the last item from the `value` array. - """ - - arguments: [ - { - name: "value" - description: "The target array." - required: true - type: ["array"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - rules: [ - "The original `value` is not modified.", - ] - } - - examples: [ - { - title: "Pop an item from an array" - source: """ - pop([1, 2, 3]) - """ - return: [1, 2] - }, - ] -} +{ + "remap": { + "functions": { + "pop": { + "anchor": "pop", + "name": "pop", + "category": "Array", + "description": "Removes the last item from the `value` array.", + "arguments": [ + { + "name": "value", + "description": "The target array.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "The original `value` is not modified." + ] + }, + "examples": [ + { + "title": "Pop an item from an array", + "source": "pop([1, 2, 3])", + "return": [ + 1, + 2 + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/push.cue b/website/cue/reference/remap/functions/push.cue index 3bde2dda7ddf6..1c2da7fbe5a04 100644 --- a/website/cue/reference/remap/functions/push.cue +++ b/website/cue/reference/remap/functions/push.cue @@ -1,40 +1,57 @@ -package metadata - -remap: functions: push: { - category: "Array" - description: """ - Adds the `item` to the end of the `value` array. - """ - - arguments: [ - { - name: "value" - description: "The target array." - required: true - type: ["array"] - }, - { - name: "item" - description: "The item to push." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - rules: [ - "Returns a new array. The `value` is _not_ modified in place.", - ] - } - - examples: [ - { - title: "Push an item onto an array" - source: """ - push([1, 2], 3) - """ - return: [1, 2, 3] - }, - ] -} +{ + "remap": { + "functions": { + "push": { + "anchor": "push", + "name": "push", + "category": "Array", + "description": "Adds the `item` to the end of the `value` array.", + "arguments": [ + { + "name": "value", + "description": "The target array.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "item", + "description": "The item to push.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Returns a new array. The `value` is _not_ modified in place." + ] + }, + "examples": [ + { + "title": "Push an item onto an array", + "source": "push([1, 2], 3)", + "return": [ + 1, + 2, + 3 + ] + }, + { + "title": "Empty array", + "source": "push([], \"bar\")", + "return": [ + "bar" + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/random_bool.cue b/website/cue/reference/remap/functions/random_bool.cue index 9d1a784388eda..b815a9fa98b98 100644 --- a/website/cue/reference/remap/functions/random_bool.cue +++ b/website/cue/reference/remap/functions/random_bool.cue @@ -1,22 +1,26 @@ -package metadata - -remap: functions: random_bool: { - category: "Random" - description: """ - Returns a random boolean. - """ - - arguments: [] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "Random boolean" - source: """ - is_boolean(random_bool()) - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "random_bool": { + "anchor": "random_bool", + "name": "random_bool", + "category": "Random", + "description": "Returns a random boolean.", + "arguments": [], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "Random boolean", + "source": "is_boolean(random_bool())", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/random_bytes.cue b/website/cue/reference/remap/functions/random_bytes.cue index d8e4c4339f6a7..ecbcd7bcdbd44 100644 --- a/website/cue/reference/remap/functions/random_bytes.cue +++ b/website/cue/reference/remap/functions/random_bytes.cue @@ -1,33 +1,44 @@ -package metadata - -remap: functions: random_bytes: { - category: "Random" - description: """ - A cryptographically secure random number generator. Returns a string value containing the number of - random bytes requested. - """ - - arguments: [ - { - name: "length" - description: "The number of bytes to generate. Must not be larger than 64k." - required: true - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "`length` is negative.", - "`length` is larger than the maximum value (64k).", - ] - return: types: ["string"] - - examples: [ - { - title: "Generate random base 64 encoded bytes" - source: #""" - encode_base64(random_bytes(16)) - """# - return: "LNu0BBgUbh7XAlXbjSOomQ==" - }, - ] -} +{ + "remap": { + "functions": { + "random_bytes": { + "anchor": "random_bytes", + "name": "random_bytes", + "category": "Random", + "description": "A cryptographically secure random number generator. Returns a string value containing the number of random bytes requested.", + "arguments": [ + { + "name": "length", + "description": "The number of bytes to generate. Must not be larger than 64k.", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`length` is negative.", + "`length` is larger than the maximum value (64k)." + ], + "examples": [ + { + "title": "Generate random base 64 encoded bytes", + "source": "encode_base64(random_bytes(16))", + "return": "LNu0BBgUbh7XAlXbjSOomQ==" + }, + { + "title": "Generate 16 random bytes", + "source": "length(random_bytes(16))", + "return": 16 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/random_float.cue b/website/cue/reference/remap/functions/random_float.cue index 442d5c0809568..9ccca67dc089c 100644 --- a/website/cue/reference/remap/functions/random_float.cue +++ b/website/cue/reference/remap/functions/random_float.cue @@ -1,38 +1,46 @@ -package metadata - -remap: functions: random_float: { - category: "Random" - description: """ - Returns a random float between [min, max). - """ - - arguments: [ - { - name: "min" - description: "Minimum value (inclusive)." - required: true - type: ["float"] - }, - { - name: "max" - description: "Maximum value (exclusive)." - required: true - type: ["float"] - }, - ] - internal_failure_reasons: [ - "`max` is not greater than `min`.", - ] - return: types: ["float"] - - examples: [ - { - title: "Random float from 0.0 to 10.0, not including 10.0" - source: """ - f = random_float(0.0, 10.0) - f >= 0 && f < 10 - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "random_float": { + "anchor": "random_float", + "name": "random_float", + "category": "Random", + "description": "Returns a random float between [min, max).", + "arguments": [ + { + "name": "min", + "description": "Minimum value (inclusive).", + "required": true, + "type": [ + "float" + ] + }, + { + "name": "max", + "description": "Maximum value (exclusive).", + "required": true, + "type": [ + "float" + ] + } + ], + "return": { + "types": [ + "float" + ] + }, + "internal_failure_reasons": [ + "`max` is not greater than `min`." + ], + "examples": [ + { + "title": "Random float from 0.0 to 10.0, not including 10.0", + "source": "f = random_float(0.0, 10.0)\nf >= 0 && f < 10\n", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/random_int.cue b/website/cue/reference/remap/functions/random_int.cue index 42af5ba2a467f..3d950b5b56b4b 100644 --- a/website/cue/reference/remap/functions/random_int.cue +++ b/website/cue/reference/remap/functions/random_int.cue @@ -1,38 +1,46 @@ -package metadata - -remap: functions: random_int: { - category: "Random" - description: """ - Returns a random integer between [min, max). - """ - - arguments: [ - { - name: "min" - description: "Minimum value (inclusive)." - required: true - type: ["integer"] - }, - { - name: "max" - description: "Maximum value (exclusive)." - required: true - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "`max` is not greater than `min`.", - ] - return: types: ["integer"] - - examples: [ - { - title: "Random integer from 0 to 10, not including 10" - source: """ - i = random_int(0, 10) - i >= 0 && i < 10 - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "random_int": { + "anchor": "random_int", + "name": "random_int", + "category": "Random", + "description": "Returns a random integer between [min, max).", + "arguments": [ + { + "name": "min", + "description": "Minimum value (inclusive).", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "max", + "description": "Maximum value (exclusive).", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "internal_failure_reasons": [ + "`max` is not greater than `min`." + ], + "examples": [ + { + "title": "Random integer from 0 to 10, not including 10", + "source": "i = random_int(0, 10)\ni >= 0 && i < 10\n", + "return": true + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/redact.cue b/website/cue/reference/remap/functions/redact.cue index 0e278d62d1dd0..3df3ac6a03f02 100644 --- a/website/cue/reference/remap/functions/redact.cue +++ b/website/cue/reference/remap/functions/redact.cue @@ -1,143 +1,84 @@ -package metadata - -remap: functions: redact: { - category: "String" - description: """ - Redact sensitive data in `value` such as: - - - [US social security card numbers](\(urls.us_social_security_number)) - - Other forms of personally identifiable information with custom patterns - - This can help achieve compliance by ensuring sensitive data does not leave your network. - """ - - arguments: [ - { - name: "value" - description: #""" - The value to redact sensitive data from. - - The function's behavior depends on `value`'s type: - - - For strings, the sensitive data is redacted and a new string is returned. - - For arrays, the sensitive data is redacted in each string element. - - For objects, the sensitive data in each string value is masked, but the keys are not masked. - - For arrays and objects, the function recurses into any nested arrays or objects. Any non-string elements are - skipped. - - Redacted text is replaced with `[REDACTED]`. - """# - required: true - type: ["string", "object", "array"] - }, - { - name: "filters" - description: #""" - List of filters applied to `value`. - - Each filter can be specified in the following ways: - - - As a regular expression, which is used to redact text that match it. - - As an object with a `type` key that corresponds to a named filter and additional keys for customizing that filter. - - As a named filter, if it has no required parameters. - - Named filters can be a: - - - `pattern`: Redacts text matching any regular expressions specified in the `patterns` - key, which is required. This is the expanded version of just passing a regular expression as a filter. - - `us_social_security_number`: Redacts US social security card numbers. - - See examples for more details. - - This parameter must be a static expression so that the argument can be validated at compile-time - to avoid runtime errors. You cannot use variables or other dynamic expressions with it. - """# - required: true - type: ["array"] - }, - { - name: "redactor" - description: """ - Specifies what to replace the redacted strings with. - - It is given as an object with a "type" key specifying the type of redactor to use - and additional keys depending on the type. The following types are supported: - - - `full`: The default. Replace with the string "[REDACTED]". - - `text`: Replace with a custom string. The `replacement` key is required, and must - contain the string that is used as a replacement. - - `sha2`: Hash the redacted text with SHA-2 as with [`sha2`](\(urls.sha2)). Supports two optional parameters: - - `variant`: The variant of the algorithm to use. Defaults to SHA-512/256. - - `encoding`: How to encode the hash as text. Can be base16 or base64. - Defaults to base64. - - `sha3`: Hash the redacted text with SHA-3 as with [`sha3`](\(urls.sha3)). Supports two optional parameters: - - `variant`: The variant of the algorithm to use. Defaults to SHA3-512. - - `encoding`: How to encode the hash as text. Can be base16 or base64. - Defaults to base64. - - - As a convenience you can use a string as a shorthand for common redactor patterns: - - - `"full"` is equivalent to `{"type": "full"}` - - `"sha2"` is equivalent to `{"type": "sha2", "variant": "SHA-512/256", "encoding": "base64"}` - - `"sha3"` is equivalent to `{"type": "sha3", "variant": "SHA3-512", "encoding": "base64"}` - - This parameter must be a static expression so that the argument can be validated at compile-time - to avoid runtime errors. You cannot use variables or other dynamic expressions with it. - """ - required: false - type: ["string", "object"] - }, - ] - internal_failure_reasons: [] - return: types: ["string", "object", "array"] - - examples: [ - { - title: "Replace text using a regex" - source: #""" - redact("my id is 123456", filters: [r'\d+']) - """# - return: "my id is [REDACTED]" - }, - { - title: "Replace us social security numbers in any field" - source: #""" - redact({ "name": "John Doe", "ssn": "123-12-1234"}, filters: ["us_social_security_number"]) - """# - return: { - name: "John Doe" - ssn: "[REDACTED]" - } - }, - { - title: "Replace with custom text" - source: #""" - redact("my id is 123456", filters: [r'\d+'], redactor: {"type": "text", "replacement": "***"}) - """# - return: "my id is ***" - }, - { - title: "Replace with SHA-2 hash" - source: #""" - redact("my id is 123456", filters: [r'\d+'], redactor: "sha2") - """# - return: "my id is GEtTedW1p6tC094dDKH+3B8P+xSnZz69AmpjaXRd63I=" - }, - { - title: "Replace with SHA-3 hash" - source: #""" - redact("my id is 123456", filters: [r'\d+'], redactor: "sha3") - """# - return: "my id is ZNCdmTDI7PeeUTFnpYjLdUObdizo+bIupZdl8yqnTKGdLx6X3JIqPUlUWUoFBikX+yTR+OcvLtAqWO11NPlNJw==" - }, - { - title: "Replace with SHA-256 hash using hex encoding" - source: #""" - redact("my id is 123456", filters: [r'\d+'], redactor: {"type": "sha2", "variant": "SHA-256", "encoding": "base16"}) - """# - return: "my id is 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92" - }, - ] -} +{ + "remap": { + "functions": { + "redact": { + "anchor": "redact", + "name": "redact", + "category": "String", + "description": "Redact sensitive data in `value` such as:\n\n- [US social security card numbers](https://www.ssa.gov/history/ssn/geocard.html)\n- Other forms of personally identifiable information with custom patterns\n\nThis can help achieve compliance by ensuring sensitive data does not leave your network.", + "arguments": [ + { + "name": "value", + "description": "The value to redact sensitive data from.\n\nThe function's behavior depends on `value`'s type:\n\n- For strings, the sensitive data is redacted and a new string is returned.\n- For arrays, the sensitive data is redacted in each string element.\n- For objects, the sensitive data in each string value is masked, but the keys are not masked.\n\nFor arrays and objects, the function recurses into any nested arrays or objects. Any non-string elements are\nskipped.\n\nRedacted text is replaced with `[REDACTED]`.", + "required": true, + "type": [ + "string", + "object", + "array" + ] + }, + { + "name": "filters", + "description": "List of filters applied to `value`.\n\nEach filter can be specified in the following ways:\n\n- As a regular expression, which is used to redact text that match it.\n- As an object with a `type` key that corresponds to a named filter and additional keys for customizing that filter.\n- As a named filter, if it has no required parameters.\n\nNamed filters can be a:\n\n- `pattern`: Redacts text matching any regular expressions specified in the `patterns`\n\tkey, which is required. This is the expanded version of just passing a regular expression as a filter.\n- `us_social_security_number`: Redacts US social security card numbers.\n\nSee examples for more details.\n\nThis parameter must be a static expression so that the argument can be validated at compile-time\nto avoid runtime errors. You cannot use variables or other dynamic expressions with it.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "redactor", + "description": "Specifies what to replace the redacted strings with.\n\nIt is given as an object with a \"type\" key specifying the type of redactor to use\nand additional keys depending on the type. The following types are supported:\n\n- `full`: The default. Replace with the string \"[REDACTED]\".\n- `text`: Replace with a custom string. The `replacement` key is required, and must\n contain the string that is used as a replacement.\n- `sha2`: Hash the redacted text with SHA-2 as with [`sha2`](https://en.wikipedia.org/wiki/SHA-2). Supports two optional parameters:\n\t- `variant`: The variant of the algorithm to use. Defaults to SHA-512/256.\n\t- `encoding`: How to encode the hash as text. Can be base16 or base64.\n\t\tDefaults to base64.\n- `sha3`: Hash the redacted text with SHA-3 as with [`sha3`](https://en.wikipedia.org/wiki/SHA-3). Supports two optional parameters:\n\t- `variant`: The variant of the algorithm to use. Defaults to SHA3-512.\n\t- `encoding`: How to encode the hash as text. Can be base16 or base64.\n\t\tDefaults to base64.\n\n\nAs a convenience you can use a string as a shorthand for common redactor patterns:\n\n- `\"full\"` is equivalent to `{\"type\": \"full\"}`\n- `\"sha2\"` is equivalent to `{\"type\": \"sha2\", \"variant\": \"SHA-512/256\", \"encoding\": \"base64\"}`\n- `\"sha3\"` is equivalent to `{\"type\": \"sha3\", \"variant\": \"SHA3-512\", \"encoding\": \"base64\"}`\n\nThis parameter must be a static expression so that the argument can be validated at compile-time\nto avoid runtime errors. You cannot use variables or other dynamic expressions with it.", + "required": false, + "type": [ + "string", + "object" + ] + } + ], + "return": { + "types": [ + "string", + "object", + "array" + ] + }, + "examples": [ + { + "title": "Replace text using a regex", + "source": "redact(\"my id is 123456\", filters: [r'\\d+'])", + "return": "my id is [REDACTED]" + }, + { + "title": "Replace us social security numbers in any field", + "source": "redact({ \"name\": \"John Doe\", \"ssn\": \"123-12-1234\"}, filters: [\"us_social_security_number\"])", + "return": { + "name": "John Doe", + "ssn": "[REDACTED]" + } + }, + { + "title": "Replace with custom text", + "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: {\"type\": \"text\", \"replacement\": \"***\"})", + "return": "my id is ***" + }, + { + "title": "Replace with SHA-2 hash", + "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: \"sha2\")", + "return": "my id is GEtTedW1p6tC094dDKH+3B8P+xSnZz69AmpjaXRd63I=" + }, + { + "title": "Replace with SHA-3 hash", + "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: \"sha3\")", + "return": "my id is ZNCdmTDI7PeeUTFnpYjLdUObdizo+bIupZdl8yqnTKGdLx6X3JIqPUlUWUoFBikX+yTR+OcvLtAqWO11NPlNJw==" + }, + { + "title": "Replace with SHA-256 hash using hex encoding", + "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: {\"type\": \"sha2\", \"variant\": \"SHA-256\", \"encoding\": \"base16\"})", + "return": "my id is 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/remove.cue b/website/cue/reference/remap/functions/remove.cue index 4754035dfa5dc..b98e0199a87ec 100644 --- a/website/cue/reference/remap/functions/remove.cue +++ b/website/cue/reference/remap/functions/remove.cue @@ -1,75 +1,134 @@ -package metadata - -remap: functions: remove: { - category: "Path" - description: """ - Dynamically remove the value for a given path. - - If you know the path you want to remove, use - the `del` function and static paths such as `del(.foo.bar[1])` - to remove the value at that path. The `del` function returns the - deleted value, and is more performant than `remove`. - However, if you do not know the path names, use the dynamic - `remove` function to remove the value at the provided path. - """ - - arguments: [ - { - name: "value" - description: "The object or array to remove data from." - required: true - type: ["object", "array"] - }, - { - name: "path" - description: "An array of path segments to remove the value from." - required: true - type: ["array"] - }, - { - name: "compact" - description: """ - After deletion, if `compact` is `true`, any empty objects or - arrays left are also removed. - """ - required: false - default: false - type: ["boolean"] - }, - ] - internal_failure_reasons: [ - #"The `path` segment must be a string or an integer."#, - ] - return: types: ["object", "array"] - - examples: [ - { - title: "single-segment top-level field" - source: #""" - remove!(value: { "foo": "bar" }, path: ["foo"]) - """# - return: {} - }, - { - title: "multi-segment nested field" - source: #""" - remove!(value: { "foo": { "bar": "baz" } }, path: ["foo", "bar"]) - """# - return: foo: {} - }, - { - title: "array indexing" - source: #""" - remove!(value: ["foo", "bar", "baz"], path: [-2]) - """# - return: ["foo", "baz"] - }, - { - title: "compaction" - source: #""" - remove!(value: { "foo": { "bar": [42], "baz": true } }, path: ["foo", "bar", 0], compact: true) - """# - return: foo: baz: true - }, - ] -} +{ + "remap": { + "functions": { + "remove": { + "anchor": "remove", + "name": "remove", + "category": "Path", + "description": "Dynamically remove the value for a given path.\n\nIf you know the path you want to remove, use\nthe `del` function and static paths such as `del(.foo.bar[1])`\nto remove the value at that path. The `del` function returns the\ndeleted value, and is more performant than `remove`.\nHowever, if you do not know the path names, use the dynamic\n`remove` function to remove the value at the provided path.", + "arguments": [ + { + "name": "value", + "description": "The object or array to remove data from.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "path", + "description": "An array of path segments to remove the value from.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "compact", + "description": "After deletion, if `compact` is `true`, any empty objects or\narrays left are also removed.", + "required": false, + "type": [ + "boolean" + ], + "default": "false" + } + ], + "return": { + "types": [ + "object", + "array" + ] + }, + "internal_failure_reasons": [ + "The `path` segment must be a string or an integer." + ], + "examples": [ + { + "title": "Single-segment top-level field", + "source": "remove!(value: { \"foo\": \"bar\" }, path: [\"foo\"])", + "return": {} + }, + { + "title": "Remove unknown field", + "source": "remove!(value: {\"foo\": \"bar\"}, path: [\"baz\"])", + "return": { + "foo": "bar" + } + }, + { + "title": "Multi-segment nested field", + "source": "remove!(value: { \"foo\": { \"bar\": \"baz\" } }, path: [\"foo\", \"bar\"])", + "return": { + "foo": {} + } + }, + { + "title": "Array indexing", + "source": "remove!(value: [\"foo\", \"bar\", \"baz\"], path: [-2])", + "return": [ + "foo", + "baz" + ] + }, + { + "title": "Compaction", + "source": "remove!(value: { \"foo\": { \"bar\": [42], \"baz\": true } }, path: [\"foo\", \"bar\", 0], compact: true)", + "return": { + "foo": { + "baz": true + } + } + }, + { + "title": "Compact object", + "source": "remove!(value: {\"foo\": { \"bar\": true }}, path: [\"foo\", \"bar\"], compact: true)", + "return": {} + }, + { + "title": "Compact array", + "source": "remove!(value: {\"foo\": [42], \"bar\": true }, path: [\"foo\", 0], compact: true)", + "return": { + "bar": true + } + }, + { + "title": "External target", + "source": ". = { \"foo\": true }\nremove!(value: ., path: [\"foo\"])\n", + "return": {} + }, + { + "title": "Variable", + "source": "var = { \"foo\": true }\nremove!(value: var, path: [\"foo\"])\n", + "return": {} + }, + { + "title": "Missing index", + "source": "remove!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1, -1])", + "return": { + "foo": { + "bar": [ + 92, + 42 + ] + } + } + }, + { + "title": "Invalid indexing", + "source": "remove!(value: [42], path: [\"foo\"])", + "return": [ + 42 + ] + }, + { + "title": "Invalid segment type", + "source": "remove!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", true])", + "raises": "function call error for \"remove\" at (0:65): path segment must be either string or integer, not boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/remove_secret.cue b/website/cue/reference/remap/functions/remove_secret.cue index bb3f3a198430e..028071847adcc 100644 --- a/website/cue/reference/remap/functions/remove_secret.cue +++ b/website/cue/reference/remap/functions/remove_secret.cue @@ -1,31 +1,35 @@ -package metadata - -remap: functions: remove_secret: { - category: "Event" - description: """ - Removes a secret from an event. - """ - - arguments: [ - { - name: "key" - description: """ - The name of the secret to remove. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["null"] - - examples: [ - { - title: "Removes the Datadog API key from the event" - source: #""" - remove_secret("datadog_api_key") - """# - return: null - }, - ] -} +{ + "remap": { + "functions": { + "remove_secret": { + "anchor": "remove_secret", + "name": "remove_secret", + "category": "Event", + "description": "Removes a secret from an event.", + "arguments": [ + { + "name": "key", + "description": "The name of the secret to remove.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "null" + ] + }, + "examples": [ + { + "title": "Remove the datadog api key", + "source": "remove_secret(\"datadog_api_key\")", + "return": null + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/replace.cue b/website/cue/reference/remap/functions/replace.cue index d66218c6ea33e..85f559bd881f6 100644 --- a/website/cue/reference/remap/functions/replace.cue +++ b/website/cue/reference/remap/functions/replace.cue @@ -1,81 +1,81 @@ -package metadata - -remap: functions: replace: { - category: "String" - description: """ - Replaces all matching instances of `pattern` in `value`. - - The `pattern` argument accepts regular expression capture groups. - - **Note when using capture groups**: - - You will need to escape the `$` by using `$$` to avoid Vector interpreting it as an - [environment variable when loading configuration](/docs/reference/environment_variables/#escaping) - - If you want a literal `$` in the replacement pattern, you will also need to escape this - with `$$`. When combined with environment variable interpolation in config files this - means you will need to use `$$$$` to have a literal `$` in the replacement pattern. - """ - - arguments: [ - { - name: "value" - description: "The original string." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "Replace all matches of this pattern. Can be a static string or a regular expression." - required: true - type: ["regex", "string"] - }, - { - name: "with" - description: "The string that the matches are replaced with." - required: true - type: ["string"] - }, - { - name: "count" - description: "The maximum number of replacements to perform. `-1` means replace all matches." - required: false - default: -1 - type: ["integer"] - - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Replace literal text" - source: #""" - replace("Apples and Bananas", "and", "not") - """# - return: "Apples not Bananas" - }, - { - title: "Replace using regular expression" - source: #""" - replace("Apples and Bananas", r'(?i)bananas', "Pineapples") - """# - return: "Apples and Pineapples" - }, - { - title: "Replace first instance" - source: #""" - replace("Bananas and Bananas", "Bananas", "Pineapples", count: 1) - """# - return: "Pineapples and Bananas" - }, - { - title: "Replace with capture groups when not set in the configuration file (use `$$num` in config files)" - source: #""" - # Note that in the context of Vector configuration files, an extra `$` escape character is required - # (i.e. `$$num`) to avoid interpreting `num` as an environment variable. - replace("foo123bar", r'foo(?P\d+)bar', "$num") - """# - return: "123" - }, - ] -} +{ + "remap": { + "functions": { + "replace": { + "anchor": "replace", + "name": "replace", + "category": "String", + "description": "Replaces all matching instances of `pattern` in `value`.\n\nThe `pattern` argument accepts regular expression capture groups.\n\n**Note when using capture groups**:\n- You will need to escape the `$` by using `$$` to avoid Vector interpreting it as an\n [environment variable when loading configuration](/docs/reference/environment_variables/#escaping)\n- If you want a literal `$` in the replacement pattern, you will also need to escape this\n with `$$`. When combined with environment variable interpolation in config files this\n means you will need to use `$$$$` to have a literal `$` in the replacement pattern.", + "arguments": [ + { + "name": "value", + "description": "The original string.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "Replace all matches of this pattern. Can be a static string or a regular expression.", + "required": true, + "type": [ + "string", + "regex" + ] + }, + { + "name": "with", + "description": "The string that the matches are replaced with.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "count", + "description": "The maximum number of replacements to perform. `-1` means replace all matches.", + "required": false, + "type": [ + "integer" + ], + "default": "-1" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Replace literal text", + "source": "replace(\"Apples and Bananas\", \"and\", \"not\")", + "return": "Apples not Bananas" + }, + { + "title": "Replace using regular expression", + "source": "replace(\"Apples and Bananas\", r'(?i)bananas', \"Pineapples\")", + "return": "Apples and Pineapples" + }, + { + "title": "Replace first instance", + "source": "replace(\"Bananas and Bananas\", \"Bananas\", \"Pineapples\", count: 1)", + "return": "Pineapples and Bananas" + }, + { + "title": "Replace with capture groups", + "source": "# Note that in the context of Vector configuration files, an extra `$` escape character is required\n# (i.e. `$$num`) to avoid interpreting `num` as an environment variable.\nreplace(\"foo123bar\", r'foo(?P\\d+)bar', \"$num\")\n", + "return": "123" + }, + { + "title": "Replace all", + "source": "replace(\"foobar\", \"o\", \"i\")", + "return": "fiibar" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/replace_with.cue b/website/cue/reference/remap/functions/replace_with.cue index 131f1e3e9d7f7..027622ba031c1 100644 --- a/website/cue/reference/remap/functions/replace_with.cue +++ b/website/cue/reference/remap/functions/replace_with.cue @@ -1,85 +1,77 @@ -package metadata - -remap: functions: replace_with: { - category: "String" - description: """ - Replaces all matching instances of `pattern` using a closure. - - The `pattern` argument accepts a regular expression that can use capture groups. - - The function uses the function closure syntax to compute the replacement values. - - The closure takes a single parameter, which is an array, where the first item is always - present and contains the entire string that matched `pattern`. The items from index one on - contain the capture groups of the corresponding index. If a capture group is optional, the - value may be null if it didn't match. - - The value returned by the closure must be a string and will replace the section of - the input that was matched. - - This returns a new string with the replacements, the original string is not mutated. - """ - - arguments: [ - { - name: "value" - description: "The original string." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "Replace all matches of this pattern. Must be a regular expression." - required: true - type: ["regex"] - }, - { - name: "count" - description: "The maximum number of replacements to perform. `-1` means replace all matches." - required: false - default: -1 - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - examples: [ - { - title: "Capitalize words" - source: #""" - replace_with("apples and bananas", r'\b(\w)(\w*)') -> |match| { - upcase!(match.captures[0]) + string!(match.captures[1]) - } - """# - return: "Apples And Bananas" - }, - { - title: "Replace with hash" - source: #""" - replace_with("email from test@example.com", r'\w+@example.com') -> |match| { - sha2(match.string, variant: "SHA-512/224") - } - """# - return: "email from adf6e1bc4415d24912bd93072ad34ef825a7b6eb3bf53f68def1fc17" - }, - { - title: "Replace first instance" - source: #""" - replace_with("Apples and Apples", r'(?i)apples|cones', count: 1) -> |match| { - "Pine" + downcase(match.string) - } - """# - return: "Pineapples and Apples" - }, - { - title: "Named capture group" - source: #""" - replace_with("level=error A message", r'level=(?P\w+)') -> |match| { - lvl = upcase!(match.level) - "[{{lvl}}]" - } - """# - return: "[ERROR] A message" - }, - ] -} +{ + "remap": { + "functions": { + "replace_with": { + "anchor": "replace_with", + "name": "replace_with", + "category": "String", + "description": "Replaces all matching instances of `pattern` using a closure.\n\nThe `pattern` argument accepts a regular expression that can use capture groups.\n\nThe function uses the function closure syntax to compute the replacement values.\n\nThe closure takes a single parameter, which is an array, where the first item is always\npresent and contains the entire string that matched `pattern`. The items from index one on\ncontain the capture groups of the corresponding index. If a capture group is optional, the\nvalue may be null if it didn't match.\n\nThe value returned by the closure must be a string and will replace the section of\nthe input that was matched.\n\nThis returns a new string with the replacements, the original string is not mutated.", + "arguments": [ + { + "name": "value", + "description": "The original string.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "Replace all matches of this pattern. Must be a regular expression.", + "required": true, + "type": [ + "regex" + ] + }, + { + "name": "count", + "description": "The maximum number of replacements to perform. `-1` means replace all matches.", + "required": false, + "type": [ + "integer" + ], + "default": "-1" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Capitalize words", + "source": "replace_with(\"apples and bananas\", r'\\b(\\w)(\\w*)') -> |match| {\n upcase!(match.captures[0]) + string!(match.captures[1])\n}\n", + "return": "Apples And Bananas" + }, + { + "title": "Replace with hash", + "source": "replace_with(\"email from test@example.com\", r'\\w+@example.com') -> |match| {\n sha2(match.string, variant: \"SHA-512/224\")\n}\n", + "return": "email from adf6e1bc4415d24912bd93072ad34ef825a7b6eb3bf53f68def1fc17" + }, + { + "title": "Replace first instance", + "source": "replace_with(\"Apples and Apples\", r'(?i)apples|cones', count: 1) -> |match| {\n \"Pine\" + downcase(match.string)\n}\n", + "return": "Pineapples and Apples" + }, + { + "title": "Named capture group", + "source": "replace_with(\"level=error A message\", r'level=(?P\\w+)') -> |match| {\n lvl = upcase!(match.level)\n \"[{{lvl}}]\"\n}\n", + "return": "[ERROR] A message" + }, + { + "title": "Replace with processed capture group", + "source": "replace_with(s'Got message: {\"msg\": \"b\"}', r'message: (\\{.*\\})') -> |m| {\n to_string!(parse_json!(m.captures[0]).msg)\n}\n", + "return": "Got b" + }, + { + "title": "Replace with optional capture group", + "source": "replace_with(\"bar of chocolate and bar of gold\", r'bar( of gold)?') -> |m| {\n if m.captures[0] == null { \"pile\" } else { \"money\" }\n}\n", + "return": "pile of chocolate and money" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/reverse_dns.cue b/website/cue/reference/remap/functions/reverse_dns.cue new file mode 100644 index 0000000000000..81a356c9dbfa6 --- /dev/null +++ b/website/cue/reference/remap/functions/reverse_dns.cue @@ -0,0 +1,35 @@ +{ + "remap": { + "functions": { + "reverse_dns": { + "anchor": "reverse_dns", + "name": "reverse_dns", + "category": "System", + "description": "Performs a reverse DNS lookup on the provided IP address to retrieve the associated hostname.", + "arguments": [ + { + "name": "value", + "description": "The IP address (IPv4 or IPv6) to perform the reverse DNS lookup on.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Example", + "source": "reverse_dns!(\"127.0.0.1\")", + "return": "localhost" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/round.cue b/website/cue/reference/remap/functions/round.cue index d44327a441af4..45c730ab2bd1b 100644 --- a/website/cue/reference/remap/functions/round.cue +++ b/website/cue/reference/remap/functions/round.cue @@ -1,48 +1,64 @@ -package metadata - -remap: functions: round: { - category: "Number" - description: """ - Rounds the `value` to the specified `precision`. - """ - - arguments: [ - { - name: "value" - description: "The number to round." - required: true - type: ["integer", "float"] - }, - { - name: "precision" - description: "The number of decimal places to round to." - required: false - default: 0 - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer", "float"] - rules: [ - "If `precision` is `0`, then an integer is returned, otherwise a float is returned.", - ] - } - - examples: [ - { - title: "Round a number (without precision)" - source: #""" - round(4.345) - """# - return: 4.0 - }, - { - title: "Round a number (with precision)" - source: #""" - round(4.345, precision: 2) - """# - return: 4.35 - }, - ] -} +{ + "remap": { + "functions": { + "round": { + "anchor": "round", + "name": "round", + "category": "Number", + "description": "Rounds the `value` to the specified `precision`.", + "arguments": [ + { + "name": "value", + "description": "The number to round.", + "required": true, + "type": [ + "integer", + "float" + ] + }, + { + "name": "precision", + "description": "The number of decimal places to round to.", + "required": false, + "type": [ + "integer" + ], + "default": "0" + } + ], + "return": { + "types": [ + "integer", + "float" + ], + "rules": [ + "If `precision` is `0`, then an integer is returned, otherwise a float is returned." + ] + }, + "examples": [ + { + "title": "Round a number (without precision)", + "source": "round(4.345)", + "return": 4.0 + }, + { + "title": "Round a number (with precision)", + "source": "round(4.345, precision: 2)", + "return": 4.35 + }, + { + "title": "Round up", + "source": "round(5.5)", + "return": 6.0 + }, + { + "title": "Round down", + "source": "round(5.45)", + "return": 5.0 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/screamingsnakecase.cue b/website/cue/reference/remap/functions/screamingsnakecase.cue index 37ccf0d97a6f1..30f586116a220 100644 --- a/website/cue/reference/remap/functions/screamingsnakecase.cue +++ b/website/cue/reference/remap/functions/screamingsnakecase.cue @@ -1,43 +1,60 @@ -package metadata - -remap: functions: screamingsnakecase: { - category: "String" - description: """ - Takes the `value` string, and turns it into SCREAMING_SNAKE case. Optionally, you can - pass in the existing case of the function, or else we will try to figure out the case automatically. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to SCREAMING_SNAKE case." - required: true - type: ["string"] - }, - { - name: "original_case" - description: "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case" - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "SCREAMING_SNAKE a string" - source: #""" - screamingsnakecase("input-string") - """# - return: "INPUT_STRING" - }, - { - title: "SCREAMING_SNAKE a string" - source: #""" - screamingsnakecase("input-string", "kebab-case") - """# - return: "INPUT_STRING" - }, - ] -} +{ + "remap": { + "functions": { + "screamingsnakecase": { + "anchor": "screamingsnakecase", + "name": "screamingsnakecase", + "category": "String", + "description": "Takes the `value` string, and turns it into SCREAMING_SNAKE case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to SCREAMING_SNAKE case.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "original_case", + "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", + "required": false, + "type": [ + "string" + ], + "enum": { + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)" + } + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "SCREAMING_SNAKE_CASE a string without specifying original case", + "source": "screamingsnakecase(\"input-string\")", + "return": "INPUT_STRING" + }, + { + "title": "SCREAMING_SNAKE_CASE a snake_case string", + "source": "screamingsnakecase(\"foo_bar_baz\", \"snake_case\")", + "return": "FOO_BAR_BAZ" + }, + { + "title": "SCREAMING_SNAKE_CASE specifying the wrong original case (capitalizes but doesn't include `_` properly)", + "source": "screamingsnakecase(\"FooBarBaz\", \"kebab-case\")", + "return": "FOOBARBAZ" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/seahash.cue b/website/cue/reference/remap/functions/seahash.cue index d4367c2e7a827..e6947ac147efb 100644 --- a/website/cue/reference/remap/functions/seahash.cue +++ b/website/cue/reference/remap/functions/seahash.cue @@ -1,37 +1,40 @@ -package metadata - -remap: functions: seahash: { - category: "Cryptography" - description: """ - Calculates a [Seahash](\(urls.seahash)) hash of the `value`. - **Note**: Due to limitations in the underlying VRL data types, this function converts the unsigned 64-bit integer SeaHash result to a signed 64-bit integer. Results higher than the signed 64-bit integer maximum value wrap around to negative values. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["integer"] - - examples: [ - { - title: "Calculate seahash" - source: #""" - seahash("foobar") - """# - return: 5348458858952426560 - }, - { - title: "Calculate negative seahash" - source: #""" - seahash("bar") - """# - return: -2796170501982571315 - }, - ] -} +{ + "remap": { + "functions": { + "seahash": { + "anchor": "seahash", + "name": "seahash", + "category": "Cryptography", + "description": "Calculates a [Seahash](https://docs.rs/seahash/latest/seahash/) hash of the `value`.\n**Note**: Due to limitations in the underlying VRL data types, this function converts the unsigned 64-bit integer SeaHash result to a signed 64-bit integer. Results higher than the signed 64-bit integer maximum value wrap around to negative values.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "examples": [ + { + "title": "Calculate seahash", + "source": "seahash(\"foobar\")", + "return": 5348458858952426560 + }, + { + "title": "Calculate negative seahash", + "source": "seahash(\"bar\")", + "return": -2796170501982571315 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/set.cue b/website/cue/reference/remap/functions/set.cue index 6524588dc6388..acc592b6faccf 100644 --- a/website/cue/reference/remap/functions/set.cue +++ b/website/cue/reference/remap/functions/set.cue @@ -1,63 +1,125 @@ -package metadata - -remap: functions: set: { - category: "Path" - description: """ - Dynamically insert data into the path of a given object or array. - - If you know the path you want to assign a value to, - use static path assignments such as `.foo.bar[1] = true` for - improved performance and readability. However, if you do not - know the path names, use the dynamic `set` function to - insert the data into the object or array. - """ - - arguments: [ - { - name: "value" - description: "The object or array to insert data into." - required: true - type: ["object", "array"] - }, - { - name: "path" - description: "An array of path segments to insert the value into." - required: true - type: ["array"] - }, - { - name: "data" - description: "The data to be inserted." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - #"The `path` segment must be a string or an integer."#, - ] - return: types: ["object", "array"] - - examples: [ - { - title: "single-segment top-level field" - source: #""" - set!(value: { "foo": "bar" }, path: ["foo"], data: "baz") - """# - return: foo: "baz" - }, - { - title: "multi-segment nested field" - source: #""" - set!(value: { "foo": { "bar": "baz" } }, path: ["foo", "bar"], data: "qux") - """# - return: foo: bar: "qux" - }, - { - title: "array" - source: #""" - set!(value: ["foo", "bar", "baz"], path: [-2], data: 42) - """# - return: ["foo", 42, "baz"] - }, - ] -} +{ + "remap": { + "functions": { + "set": { + "anchor": "set", + "name": "set", + "category": "Path", + "description": "Dynamically insert data into the path of a given object or array.\n\nIf you know the path you want to assign a value to,\nuse static path assignments such as `.foo.bar[1] = true` for\nimproved performance and readability. However, if you do not\nknow the path names, use the dynamic `set` function to\ninsert the data into the object or array.", + "arguments": [ + { + "name": "value", + "description": "The object or array to insert data into.", + "required": true, + "type": [ + "object", + "array" + ] + }, + { + "name": "path", + "description": "An array of path segments to insert the value into.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "data", + "description": "The data to be inserted.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "object", + "array" + ] + }, + "internal_failure_reasons": [ + "The `path` segment must be a string or an integer." + ], + "examples": [ + { + "title": "Single-segment top-level field", + "source": "set!(value: { \"foo\": \"bar\" }, path: [\"foo\"], data: \"baz\")", + "return": { + "foo": "baz" + } + }, + { + "title": "Multi-segment nested field", + "source": "set!(value: { \"foo\": { \"bar\": \"baz\" } }, path: [\"foo\", \"bar\"], data: \"qux\")", + "return": { + "foo": { + "bar": "qux" + } + } + }, + { + "title": "Array", + "source": "set!(value: [\"foo\", \"bar\", \"baz\"], path: [-2], data: 42)", + "return": [ + "foo", + 42, + "baz" + ] + }, + { + "title": "Nested fields", + "source": "set!(value: {}, path: [\"foo\", \"bar\"], data: \"baz\")", + "return": { + "foo": { + "bar": "baz" + } + } + }, + { + "title": "Nested indexing", + "source": "set!(value: {\"foo\": { \"bar\": [] }}, path: [\"foo\", \"bar\", 1], data: \"baz\")", + "return": { + "foo": { + "bar": [ + null, + "baz" + ] + } + } + }, + { + "title": "External target", + "source": ". = { \"foo\": true }\nset!(value: ., path: [\"bar\"], data: \"baz\")\n", + "return": { + "bar": "baz", + "foo": true + } + }, + { + "title": "Variable", + "source": "var = { \"foo\": true }\nset!(value: var, path: [\"bar\"], data: \"baz\")\n", + "return": { + "bar": "baz", + "foo": true + } + }, + { + "title": "Invalid indexing", + "source": "set!(value: [], path: [\"foo\"], data: \"baz\")", + "return": { + "foo": "baz" + } + }, + { + "title": "Invalid segment type", + "source": "set!({\"foo\": { \"bar\": [92, 42] }}, [\"foo\", true], \"baz\")", + "raises": "function call error for \"set\" at (0:56): path segment must be either string or integer, not boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/set_secret.cue b/website/cue/reference/remap/functions/set_secret.cue index 7b54d22cb2f3a..7dd6a119a1bed 100644 --- a/website/cue/reference/remap/functions/set_secret.cue +++ b/website/cue/reference/remap/functions/set_secret.cue @@ -1,35 +1,43 @@ -package metadata - -remap: functions: set_secret: { - category: "Event" - description: """ - Sets the given secret in the event. - """ - - arguments: [ - { - name: "key" - description: "The name of the secret." - required: true - type: ["string"] - }, - { - name: "secret" - description: "The secret value." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["null"] - - examples: [ - { - title: "Set the Datadog API key to the given value" - source: #""" - set_secret("datadog_api_key", "abc122") - """# - return: null - }, - ] -} +{ + "remap": { + "functions": { + "set_secret": { + "anchor": "set_secret", + "name": "set_secret", + "category": "Event", + "description": "Sets the given secret in the event.", + "arguments": [ + { + "name": "key", + "description": "The name of the secret.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "secret", + "description": "The secret value.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "null" + ] + }, + "examples": [ + { + "title": "Set the datadog api key", + "source": "set_secret(\"datadog_api_key\", \"secret-value\")", + "return": null + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/set_semantic_meaning.cue b/website/cue/reference/remap/functions/set_semantic_meaning.cue index d2431a3c7a638..65626754392c3 100644 --- a/website/cue/reference/remap/functions/set_semantic_meaning.cue +++ b/website/cue/reference/remap/functions/set_semantic_meaning.cue @@ -1,43 +1,46 @@ -package metadata - -remap: functions: set_semantic_meaning: { - category: "Event" - description: """ - Sets a semantic meaning for an event. **Note**: This function assigns - meaning at startup, and has _no_ runtime behavior. It is suggested - to put all calls to this function at the beginning of a VRL function. The function - cannot be conditionally called. For example, using an if statement cannot stop the meaning - from being assigned. - """ - - arguments: [ - { - name: "target" - description: """ - The path of the value that is assigned a meaning. - """ - required: true - type: ["path"] - }, - { - name: "meaning" - description: """ - The name of the meaning to assign. - """ - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["null"] - - examples: [ - { - title: "Sets custom field semantic meaning" - source: #""" - set_semantic_meaning(.foo, "bar") - """# - return: null - }, - ] -} +{ + "remap": { + "functions": { + "set_semantic_meaning": { + "anchor": "set_semantic_meaning", + "name": "set_semantic_meaning", + "category": "Event", + "description": "Sets a semantic meaning for an event.", + "arguments": [ + { + "name": "target", + "description": "The path of the value that is assigned a meaning.", + "required": true, + "type": [ + "any" + ] + }, + { + "name": "meaning", + "description": "The name of the meaning to assign.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "null" + ] + }, + "examples": [ + { + "title": "Sets custom field semantic meaning", + "source": "set_semantic_meaning(.foo, \"bar\")", + "return": null + } + ], + "notices": [ + "This function assigns meaning at startup, and has _no_ runtime behavior. It is suggested\nto put all calls to this function at the beginning of a VRL function. The function\ncannot be conditionally called. For example, using an if statement cannot stop the\nmeaning from being assigned." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/sha1.cue b/website/cue/reference/remap/functions/sha1.cue index fc63040192693..14c0f2e3a4fc1 100644 --- a/website/cue/reference/remap/functions/sha1.cue +++ b/website/cue/reference/remap/functions/sha1.cue @@ -1,29 +1,35 @@ -package metadata - -remap: functions: sha1: { - category: "Cryptography" - description: """ - Calculates a [SHA-1](\(urls.sha1)) hash of the `value`. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Calculate sha1 hash" - source: #""" - sha1("foo") - """# - return: "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" - }, - ] -} +{ + "remap": { + "functions": { + "sha1": { + "anchor": "sha1", + "name": "sha1", + "category": "Cryptography", + "description": "Calculates a [SHA-1](https://en.wikipedia.org/wiki/SHA-1) hash of the `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Calculate sha1 hash", + "source": "sha1(\"foo\")", + "return": "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/sha2.cue b/website/cue/reference/remap/functions/sha2.cue index 0bf171b0b6c57..a01e3bf2d15c9 100644 --- a/website/cue/reference/remap/functions/sha2.cue +++ b/website/cue/reference/remap/functions/sha2.cue @@ -1,44 +1,62 @@ -package metadata - -remap: functions: sha2: { - category: "Cryptography" - description: """ - Calculates a [SHA-2](\(urls.sha2)) hash of the `value`. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - { - name: "variant" - description: "The variant of the algorithm to use." - enum: { - "SHA-224": "SHA-224 algorithm" - "SHA-256": "SHA-256 algorithm" - "SHA-384": "SHA-384 algorithm" - "SHA-512": "SHA-512 algorithm" - "SHA-512/224": "SHA-512/224 algorithm" - "SHA-512/256": "SHA-512/256 algorithm" - } - required: false - default: "SHA-512/256" - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Calculate sha2 hash" - source: #""" - sha2("foo", variant: "SHA-512/224") - """# - return: "d68f258d37d670cfc1ec1001a0394784233f88f056994f9a7e5e99be" - }, - ] -} +{ + "remap": { + "functions": { + "sha2": { + "anchor": "sha2", + "name": "sha2", + "category": "Cryptography", + "description": "Calculates a [SHA-2](https://en.wikipedia.org/wiki/SHA-2) hash of the `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "variant", + "description": "The variant of the algorithm to use.", + "required": false, + "type": [ + "string" + ], + "enum": { + "SHA-512": "SHA-512 algorithm", + "SHA-256": "SHA-256 algorithm", + "SHA-384": "SHA-384 algorithm", + "SHA-512/224": "SHA-512/224 algorithm", + "SHA-512/256": "SHA-512/256 algorithm", + "SHA-224": "SHA-224 algorithm" + }, + "default": "SHA-512/256" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Calculate sha2 hash using default variant", + "source": "sha2(\"foobar\")", + "return": "d014c752bc2be868e16330f47e0c316a5967bcbc9c286a457761d7055b9214ce" + }, + { + "title": "Calculate sha2 hash with SHA-512/224", + "source": "sha2(\"foo\", variant: \"SHA-512/224\")", + "return": "d68f258d37d670cfc1ec1001a0394784233f88f056994f9a7e5e99be" + }, + { + "title": "Calculate sha2 hash with SHA-384", + "source": "sha2(\"foobar\", \"SHA-384\")", + "return": "3c9c30d9f665e74d515c842960d4a451c83a0125fd3de7392d7b37231af10c72ea58aedfcdf89a5765bf902af93ecf06" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/sha3.cue b/website/cue/reference/remap/functions/sha3.cue index f43ad144e5537..211f05972b1c9 100644 --- a/website/cue/reference/remap/functions/sha3.cue +++ b/website/cue/reference/remap/functions/sha3.cue @@ -1,42 +1,60 @@ -package metadata - -remap: functions: sha3: { - category: "Cryptography" - description: """ - Calculates a [SHA-3](\(urls.sha3)) hash of the `value`. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - { - name: "variant" - description: "The variant of the algorithm to use." - enum: { - "SHA3-224": "SHA3-224 algorithm" - "SHA3-256": "SHA3-256 algorithm" - "SHA3-384": "SHA3-384 algorithm" - "SHA3-512": "SHA3-512 algorithm" - } - required: false - default: "SHA3-512" - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Calculate sha3 hash" - source: #""" - sha3("foo", variant: "SHA3-224") - """# - return: "f4f6779e153c391bbd29c95e72b0708e39d9166c7cea51d1f10ef58a" - }, - ] -} +{ + "remap": { + "functions": { + "sha3": { + "anchor": "sha3", + "name": "sha3", + "category": "Cryptography", + "description": "Calculates a [SHA-3](https://en.wikipedia.org/wiki/SHA-3) hash of the `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "variant", + "description": "The variant of the algorithm to use.", + "required": false, + "type": [ + "string" + ], + "enum": { + "SHA3-224": "SHA3-224 algorithm", + "SHA3-512": "SHA3-512 algorithm", + "SHA3-256": "SHA3-256 algorithm", + "SHA3-384": "SHA3-384 algorithm" + }, + "default": "SHA3-512" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Calculate sha3 hash using default variant", + "source": "sha3(\"foobar\")", + "return": "ff32a30c3af5012ea395827a3e99a13073c3a8d8410a708568ff7e6eb85968fccfebaea039bc21411e9d43fdb9a851b529b9960ffea8679199781b8f45ca85e2" + }, + { + "title": "Calculate sha3 hash with SHA3-224", + "source": "sha3(\"foo\", variant: \"SHA3-224\")", + "return": "f4f6779e153c391bbd29c95e72b0708e39d9166c7cea51d1f10ef58a" + }, + { + "title": "Calculate sha3 hash with SHA3-384", + "source": "sha3(\"foobar\", \"SHA3-384\")", + "return": "0fa8abfbdaf924ad307b74dd2ed183b9a4a398891a2f6bac8fd2db7041b77f068580f9c6c66f699b496c2da1cbcc7ed8" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/shannon_entropy.cue b/website/cue/reference/remap/functions/shannon_entropy.cue index 9f6c904403b3b..134c166063525 100644 --- a/website/cue/reference/remap/functions/shannon_entropy.cue +++ b/website/cue/reference/remap/functions/shannon_entropy.cue @@ -1,63 +1,64 @@ -package metadata - -remap: functions: shannon_entropy: { - category: "String" - description: """ - Generates [Shannon entropy](\(urls.shannon_entropy)) from given string. It can generate it - based on string bytes, codepoints, or graphemes. - """ - - arguments: [ - { - name: "value" - description: "The input string." - required: true - type: ["string"] - }, - { - name: "segmentation" - description: """ - Defines how to split the string to calculate entropy, based on occurrences of - segments. - - Byte segmentation is the fastest, but it might give undesired results when handling - UTF-8 strings, while grapheme segmentation is the slowest, but most correct in these - cases. - """ - required: false - type: ["string"] - default: "byte" - enum: { - byte: "Considers individual bytes when calculating entropy" - codepoint: "Considers codepoints when calculating entropy" - grapheme: "Considers graphemes when calculating entropy" - } - }, - ] - internal_failure_reasons: [] - return: types: ["float"] - - examples: [ - { - title: "Simple byte segmentation example" - source: #""" - floor(shannon_entropy("vector.dev"), precision: 4) - """# - return: 2.9219 - }, - { - title: "UTF-8 string with bytes segmentation" - source: #""" - floor(shannon_entropy("test123%456.فوائد.net."), precision: 4) - """# - return: 4.0784 - }, - { - title: "UTF-8 string with grapheme segmentation" - source: #""" - floor(shannon_entropy("test123%456.فوائد.net.", segmentation: "grapheme"), precision: 4) - """# - return: 3.9362 - }, - ] -} +{ + "remap": { + "functions": { + "shannon_entropy": { + "anchor": "shannon_entropy", + "name": "shannon_entropy", + "category": "String", + "description": "Generates [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_(information_theory)) from given string. It can generate it based on string bytes, codepoints, or graphemes.", + "arguments": [ + { + "name": "value", + "description": "The input string.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "segmentation", + "description": "Defines how to split the string to calculate entropy, based on occurrences of\nsegments.\n\nByte segmentation is the fastest, but it might give undesired results when handling\nUTF-8 strings, while grapheme segmentation is the slowest, but most correct in these\ncases.", + "required": false, + "type": [ + "string" + ], + "enum": { + "grapheme": "Considers graphemes when calculating entropy", + "byte": "Considers individual bytes when calculating entropy", + "codepoint": "Considers codepoints when calculating entropy" + }, + "default": "byte" + } + ], + "return": { + "types": [ + "float" + ] + }, + "examples": [ + { + "title": "Simple byte segmentation example", + "source": "floor(shannon_entropy(\"vector.dev\"), precision: 4)", + "return": 2.9219 + }, + { + "title": "UTF-8 string with bytes segmentation", + "source": "floor(shannon_entropy(\"test123%456.فوائد.net.\"), precision: 4)", + "return": 4.0784 + }, + { + "title": "UTF-8 string with grapheme segmentation", + "source": "floor(shannon_entropy(\"test123%456.فوائد.net.\", segmentation: \"grapheme\"), precision: 4)", + "return": 3.9362 + }, + { + "title": "UTF-8 emoji (7 Unicode scalar values) with grapheme segmentation", + "source": "shannon_entropy(\"👨‍👩‍👧‍👦\", segmentation: \"grapheme\")", + "return": 0.0 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/sieve.cue b/website/cue/reference/remap/functions/sieve.cue index 0388bb7f72c60..86d25c0e1d97a 100644 --- a/website/cue/reference/remap/functions/sieve.cue +++ b/website/cue/reference/remap/functions/sieve.cue @@ -1,65 +1,71 @@ -package metadata - -remap: functions: sieve: { - category: "String" - description: """ - Keeps only matches of `pattern` in `value`. - - This can be used to define patterns that are allowed in the string and - remove everything else. - """ - - arguments: [ - { - name: "value" - description: "The original string." - required: true - type: ["string"] - }, - { - name: "pattern" - description: """ - Keep all matches of this pattern. - """ - required: true - type: ["regex"] - }, - { - name: "replace_single" - description: """ - The string to use to replace single rejected characters. - """ - required: false - default: "" - type: ["string"] - }, - { - name: "replace_repeated" - description: """ - The string to use to replace multiple sequential instances of rejected characters. - """ - required: false - default: "" - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Sieve with regex" - source: #""" - sieve("test123%456.فوائد.net.", r'[a-z0-9.]') - """# - return: "test123456..net." - }, - { - title: "Custom replacements" - source: #""" - sieve("test123%456.فوائد.net.", r'[a-z.0-9]', replace_single: "X", replace_repeated: "") - """# - return: "test123X456..net." - }, - ] -} +{ + "remap": { + "functions": { + "sieve": { + "anchor": "sieve", + "name": "sieve", + "category": "String", + "description": "Keeps only matches of `pattern` in `value`.\n\nThis can be used to define patterns that are allowed in the string and\nremove everything else.", + "arguments": [ + { + "name": "value", + "description": "The original string.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "permitted_characters", + "description": "Keep all matches of this pattern.", + "required": true, + "type": [ + "regex" + ] + }, + { + "name": "replace_single", + "description": "The string to use to replace single rejected characters.", + "required": false, + "type": [ + "string" + ], + "default": "" + }, + { + "name": "replace_repeated", + "description": "The string to use to replace multiple sequential instances of rejected characters.", + "required": false, + "type": [ + "string" + ], + "default": "" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Keep only lowercase letters", + "source": "sieve(\"vector.dev/lowerUPPER\", permitted_characters: r'[a-z]')", + "return": "vectordevlower" + }, + { + "title": "Sieve with regex", + "source": "sieve(\"test123%456.فوائد.net.\", r'[a-z0-9.]')", + "return": "test123456..net." + }, + { + "title": "Custom replacements", + "source": "sieve(\"test123%456.فوائد.net.\", r'[a-z.0-9]', replace_single: \"X\", replace_repeated: \"\")", + "return": "test123X456..net." + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/slice.cue b/website/cue/reference/remap/functions/slice.cue index 8e4bf4afc2196..84b976f1ecc3a 100644 --- a/website/cue/reference/remap/functions/slice.cue +++ b/website/cue/reference/remap/functions/slice.cue @@ -1,53 +1,72 @@ -package metadata - -remap: functions: slice: { - category: "String" - description: """ - Returns a slice of `value` between the `start` and `end` positions. - - If the `start` and `end` parameters are negative, they refer to positions counting from the right of the - string or array. If `end` refers to a position that is greater than the length of the string or array, - a slice up to the end of the string or array is returned. - """ - - arguments: [ - { - name: "value" - description: "The string or array to slice." - required: true - type: ["array", "string"] - }, - { - name: "start" - description: "The inclusive start position. A zero-based index that can be negative." - required: true - type: ["integer"] - }, - { - name: "end" - description: "The exclusive end position. A zero-based index that can be negative." - required: false - default: "String length" - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: types: ["array", "string"] - - examples: [ - { - title: "Slice a string (positive index)" - source: #""" - slice!("Supercalifragilisticexpialidocious", start: 5, end: 13) - """# - return: "califrag" - }, - { - title: "Slice a string (negative index)" - source: #""" - slice!("Supercalifragilisticexpialidocious", start: 5, end: -14) - """# - return: "califragilistic" - }, - ] -} +{ + "remap": { + "functions": { + "slice": { + "anchor": "slice", + "name": "slice", + "category": "String", + "description": "Returns a slice of `value` between the `start` and `end` positions.\n\nIf the `start` and `end` parameters are negative, they refer to positions counting from the right of the\nstring or array. If `end` refers to a position that is greater than the length of the string or array,\na slice up to the end of the string or array is returned.", + "arguments": [ + { + "name": "value", + "description": "The string or array to slice.", + "required": true, + "type": [ + "string", + "array" + ] + }, + { + "name": "start", + "description": "The inclusive start position. A zero-based index that can be negative.", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "end", + "description": "The exclusive end position. A zero-based index that can be negative.", + "required": false, + "type": [ + "integer" + ], + "default": "String length" + } + ], + "return": { + "types": [ + "string", + "array" + ] + }, + "examples": [ + { + "title": "Slice a string (positive index)", + "source": "slice!(\"Supercalifragilisticexpialidocious\", start: 5, end: 13)", + "return": "califrag" + }, + { + "title": "Slice a string (negative index)", + "source": "slice!(\"Supercalifragilisticexpialidocious\", start: 5, end: -14)", + "return": "califragilistic" + }, + { + "title": "String start", + "source": "slice!(\"foobar\", 3)", + "return": "bar" + }, + { + "title": "Array start", + "source": "slice!([0, 1, 2], 1)", + "return": [ + 1, + 2 + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/snakecase.cue b/website/cue/reference/remap/functions/snakecase.cue index dab198c67feef..34334ec22a2d7 100644 --- a/website/cue/reference/remap/functions/snakecase.cue +++ b/website/cue/reference/remap/functions/snakecase.cue @@ -1,43 +1,77 @@ -package metadata - -remap: functions: snakecase: { - category: "String" - description: """ - Takes the `value` string, and turns it into snake-case. Optionally, you can - pass in the existing case of the function, or else we will try to figure out the case automatically. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to snake-case." - required: true - type: ["string"] - }, - { - name: "original_case" - description: "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case" - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "snake-case a string" - source: #""" - snakecase("input-string") - """# - return: "input_string" - }, - { - title: "snake-case a string" - source: #""" - snakecase("input-string", "kebab-case") - """# - return: "input_string" - }, - ] -} +{ + "remap": { + "functions": { + "snakecase": { + "anchor": "snakecase", + "name": "snakecase", + "category": "String", + "description": "Takes the `value` string, and turns it into snake_case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to snake_case.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "original_case", + "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", + "required": false, + "type": [ + "string" + ], + "enum": { + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + } + }, + { + "name": "excluded_boundaries", + "description": "Case boundaries to exclude during conversion.", + "required": false, + "type": [ + "array" + ], + "enum": { + "digit_lower": "Digit to lowercase transitions (e.g., 'Foo123barBaz' → 'foo' + '123bar' + 'baz')", + "digit_upper": "Digit to uppercase transitions (e.g., 'Version123Test' → 'version' + '123test')", + "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')", + "upper_lower": "Uppercase to lowercase transitions (e.g., 'CamelCase' → 'Camel' + 'Case')", + "lower_digit": "Lowercase to digit transitions (e.g., 'foo2bar' → 'foo2_bar')", + "lower_upper": "Lowercase to uppercase transitions (e.g., 'camelCase' → 'camel' + 'case')", + "upper_digit": "Uppercase to digit transitions (e.g., 'versionV2' → 'version_v2')" + } + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "snake_case a string", + "source": "snakecase(\"input-string\")", + "return": "input_string" + }, + { + "title": "snake_case a string with original case", + "source": "snakecase(\"input-string\", original_case: \"kebab-case\")", + "return": "input_string" + }, + { + "title": "snake_case with excluded boundaries", + "source": "snakecase(\"s3BucketDetails\", excluded_boundaries: [\"lower_digit\"])", + "return": "s3_bucket_details" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/split.cue b/website/cue/reference/remap/functions/split.cue index 2775252423f1a..fb8ffccd86496 100644 --- a/website/cue/reference/remap/functions/split.cue +++ b/website/cue/reference/remap/functions/split.cue @@ -1,53 +1,84 @@ -package metadata - -remap: functions: split: { - category: "String" - description: """ - Splits the `value` string using `pattern`. - """ - - arguments: [ - { - name: "value" - description: "The string to split." - required: true - type: ["string"] - }, - { - name: "pattern" - description: "The string is split whenever this pattern is matched." - required: true - type: ["string", "regex"] - }, - { - name: "limit" - description: "The maximum number of substrings to return." - required: false - type: ["integer"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - rules: [ - "If `limit` is specified, the remainder of the string is returned unsplit after `limit` has been reached.", - ] - } - - examples: [ - { - title: "Split a string (no limit)" - source: #""" - split("apples and pears and bananas", " and ") - """# - return: ["apples", "pears", "bananas"] - }, - { - title: "Split a string (with a limit)" - source: #""" - split("apples and pears and bananas", " and ", limit: 2) - """# - return: ["apples", "pears and bananas"] - }, - ] -} +{ + "remap": { + "functions": { + "split": { + "anchor": "split", + "name": "split", + "category": "String", + "description": "Splits the `value` string using `pattern`.", + "arguments": [ + { + "name": "value", + "description": "The string to split.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "pattern", + "description": "The string is split whenever this pattern is matched.", + "required": true, + "type": [ + "string", + "regex" + ] + }, + { + "name": "limit", + "description": "The maximum number of substrings to return.", + "required": false, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "If `limit` is specified, the remainder of the string is returned unsplit after `limit` has been reached." + ] + }, + "examples": [ + { + "title": "Split a string (no limit)", + "source": "split(\"apples and pears and bananas\", \" and \")", + "return": [ + "apples", + "pears", + "bananas" + ] + }, + { + "title": "Split a string (with a limit)", + "source": "split(\"apples and pears and bananas\", \" and \", limit: 2)", + "return": [ + "apples", + "pears and bananas" + ] + }, + { + "title": "Split string", + "source": "split(\"foobar\", \"b\")", + "return": [ + "foo", + "ar" + ] + }, + { + "title": "Split regex", + "source": "split(\"barbaz\", r'ba')", + "return": [ + "", + "r", + "z" + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/split_path.cue b/website/cue/reference/remap/functions/split_path.cue index 981f64bfb6522..8ee1d2b2106e5 100644 --- a/website/cue/reference/remap/functions/split_path.cue +++ b/website/cue/reference/remap/functions/split_path.cue @@ -1,53 +1,63 @@ -package metadata - -remap: functions: split_path: { - category: "String" - description: """ - Splits the given `path` into its constituent components, returning an array of strings. - Each component represents a part of the file system path hierarchy. - """ - - arguments: [ - { - name: "value" - description: "The path to split into components." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid string.", - ] - return: types: ["array"] - - examples: [ - { - title: "Split path with trailing slash" - source: """ - split_path("/home/user/") - """ - return: ["/", "home", "user"] - }, - { - title: "Split path from file path" - source: """ - split_path("/home/user") - """ - return: ["/", "home", "user"] - }, - { - title: "Split path from root" - source: """ - split_path("/") - """ - return: ["/"] - }, - { - title: "Empty path returns empty array" - source: """ - split_path("") - """ - return: [] - }, - ] -} +{ + "remap": { + "functions": { + "split_path": { + "anchor": "split_path", + "name": "split_path", + "category": "String", + "description": "Splits the given `path` into its constituent components, returning an array of strings. Each component represents a part of the file system path hierarchy.", + "arguments": [ + { + "name": "value", + "description": "The path to split into components.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid string." + ], + "examples": [ + { + "title": "Split path with trailing slash", + "source": "split_path(\"/home/user/\")", + "return": [ + "/", + "home", + "user" + ] + }, + { + "title": "Split path from file path", + "source": "split_path(\"/home/user\")", + "return": [ + "/", + "home", + "user" + ] + }, + { + "title": "Split path from root", + "source": "split_path(\"/\")", + "return": [ + "/" + ] + }, + { + "title": "Empty path returns empty array", + "source": "split_path(\"\")", + "return": [] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/starts_with.cue b/website/cue/reference/remap/functions/starts_with.cue index 31496583701a3..3f6e3a4c96e39 100644 --- a/website/cue/reference/remap/functions/starts_with.cue +++ b/website/cue/reference/remap/functions/starts_with.cue @@ -1,49 +1,62 @@ -package metadata - -remap: functions: starts_with: { - category: "String" - description: """ - Determines whether `value` begins with `substring`. - """ - - arguments: [ - { - name: "value" - description: "The string to search." - required: true - type: ["string"] - }, - { - name: "substring" - description: "The substring that the `value` must start with." - required: true - type: ["string"] - }, - { - name: "case_sensitive" - description: "Whether the match should be case sensitive." - required: false - type: ["boolean"] - default: true - }, - ] - internal_failure_reasons: [] - return: types: ["boolean"] - - examples: [ - { - title: "String starts with (case sensitive)" - source: #""" - starts_with("The Needle In The Haystack", "The Needle") - """# - return: true - }, - { - title: "String starts with (case insensitive)" - source: #""" - starts_with("The Needle In The Haystack", "the needle", case_sensitive: false) - """# - return: true - }, - ] -} +{ + "remap": { + "functions": { + "starts_with": { + "anchor": "starts_with", + "name": "starts_with", + "category": "String", + "description": "Determines whether `value` begins with `substring`.", + "arguments": [ + { + "name": "value", + "description": "The string to search.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "substring", + "description": "The substring that the `value` must start with.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "case_sensitive", + "description": "Whether the match should be case sensitive.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "examples": [ + { + "title": "String starts with (case sensitive)", + "source": "starts_with(\"The Needle In The Haystack\", \"The Needle\")", + "return": true + }, + { + "title": "String starts with (case insensitive)", + "source": "starts_with(\"The Needle In The Haystack\", \"the needle\", case_sensitive: false)", + "return": true + }, + { + "title": "String starts with (case sensitive failure)", + "source": "starts_with(\"foobar\", \"F\")", + "return": false + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/string.cue b/website/cue/reference/remap/functions/string.cue index 16ff4af9e39cb..8b8ed4745e0c5 100644 --- a/website/cue/reference/remap/functions/string.cue +++ b/website/cue/reference/remap/functions/string.cue @@ -1,38 +1,47 @@ -package metadata - -remap: functions: string: { - category: "Type" - description: """ - Returns `value` if it is a string, otherwise returns an error. This enables the type checker to guarantee that the - returned value is a string and can be used in any function that expects a string. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is a string." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not a string.", - ] - return: { - types: ["string"] - rules: [ - #"Returns the `value` if it's a string."#, - #"Raises an error if not a string."#, - ] - } - examples: [ - { - title: "Declare a string type" - input: log: message: #"{"field": "value"}"# - source: #""" - string!(.message) - """# - return: input.log.message - }, - ] -} +{ + "remap": { + "functions": { + "string": { + "anchor": "string", + "name": "string", + "category": "Type", + "description": "Returns `value` if it is a string, otherwise returns an error. This enables the type checker to guarantee that the returned value is a string and can be used in any function that expects a string.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a string.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "string" + ], + "rules": [ + "Returns the `value` if it's a string.", + "Raises an error if not a string." + ] + }, + "internal_failure_reasons": [ + "`value` is not a string." + ], + "examples": [ + { + "title": "Declare a string type", + "source": ". = { \"message\": \"{\\\"field\\\": \\\"value\\\"}\" }\nstring(.message)\n", + "return": "{\"field\": \"value\"}" + }, + { + "title": "Invalid type", + "source": "string!(true)", + "raises": "function call error for \"string\" at (0:13): expected string, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue b/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue index 2ec9717b1a5fe..a72c5daefb99c 100644 --- a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue +++ b/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue @@ -1,29 +1,28 @@ -package metadata - -remap: functions: strip_ansi_escape_codes: { - category: "String" - description: """ - Strips [ANSI escape codes](\(urls.ansi_escape_codes)) from `value`. - """ - - arguments: [ - { - name: "value" - description: "The string to strip." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Strip ANSI escape codes" - source: #""" - strip_ansi_escape_codes("\e[46mfoo\e[0m bar") - """# - return: "foo bar" - }, - ] -} +{ + "remap": { + "functions": { + "strip_ansi_escape_codes": { + "anchor": "strip_ansi_escape_codes", + "name": "strip_ansi_escape_codes", + "category": "String", + "description": "Strips [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to strip.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/strip_whitespace.cue b/website/cue/reference/remap/functions/strip_whitespace.cue index bef2bec05b9e9..a88aff32dca6f 100644 --- a/website/cue/reference/remap/functions/strip_whitespace.cue +++ b/website/cue/reference/remap/functions/strip_whitespace.cue @@ -1,30 +1,50 @@ -package metadata - -remap: functions: strip_whitespace: { - category: "String" - description: """ - Strips whitespace from the start and end of `value`, where whitespace is defined by the [Unicode - `White_Space` property](\(urls.unicode_whitespace)). - """ - - arguments: [ - { - name: "value" - description: "The string to trim." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Strip whitespace" - source: #""" - strip_whitespace(" A sentence. ") - """# - return: "A sentence." - }, - ] -} +{ + "remap": { + "functions": { + "strip_whitespace": { + "anchor": "strip_whitespace", + "name": "strip_whitespace", + "category": "String", + "description": "Strips whitespace from the start and end of `value`, where whitespace is defined by the [Unicode `White_Space` property](https://en.wikipedia.org/wiki/Unicode_character_property#Whitespace).", + "arguments": [ + { + "name": "value", + "description": "The string to trim.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Strip whitespace", + "source": "strip_whitespace(\" A sentence. \")", + "return": "A sentence." + }, + { + "title": "Start whitespace", + "source": "strip_whitespace(\" foobar\")", + "return": "foobar" + }, + { + "title": "End whitespace", + "source": "strip_whitespace(\"foo bar \")", + "return": "foo bar" + }, + { + "title": "Newlines", + "source": "strip_whitespace(\"\\n\\nfoo bar\\n \")", + "return": "foo bar" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/strlen.cue b/website/cue/reference/remap/functions/strlen.cue index 5aab9bb20a188..ecc3e29b61f57 100644 --- a/website/cue/reference/remap/functions/strlen.cue +++ b/website/cue/reference/remap/functions/strlen.cue @@ -1,35 +1,35 @@ -package metadata - -remap: functions: strlen: { - category: "Enumerate" - description: """ - Returns the number of UTF-8 characters in `value`. This differs from - `length` which counts the number of bytes of a string. - - **Note**: This is the count of [Unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value) - which can sometimes differ from [Unicode code points](https://www.unicode.org/glossary/#code_point). - """ - - arguments: [ - { - name: "value" - description: "The string." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["integer"] - } - - examples: [ - { - title: "strlen" - source: """ - strlen("ñandú") - """ - return: 5 - }, - ] -} +{ + "remap": { + "functions": { + "strlen": { + "anchor": "strlen", + "name": "strlen", + "category": "Enumerate", + "description": "Returns the number of UTF-8 characters in `value`. This differs from\n`length` which counts the number of bytes of a string.\n\n**Note**: This is the count of [Unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value)\nwhich can sometimes differ from [Unicode code points](https://www.unicode.org/glossary/#code_point).", + "arguments": [ + { + "name": "value", + "description": "The string.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "examples": [ + { + "title": "Count Unicode scalar values", + "source": "strlen(\"ñandú\")", + "return": 5 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/tag_types_externally.cue b/website/cue/reference/remap/functions/tag_types_externally.cue index 99e1e290bbb78..d2e3cf20ed122 100644 --- a/website/cue/reference/remap/functions/tag_types_externally.cue +++ b/website/cue/reference/remap/functions/tag_types_externally.cue @@ -1,74 +1,70 @@ -package metadata - -remap: functions: tag_types_externally: { - category: "Type" - description: """ - Adds type information to all (nested) scalar values in the provided `value`. - - The type information is added externally, meaning that `value` has the form of `"type": value` after this - transformation. - """ - arguments: [ - { - name: "value" - description: "The value to tag with types." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [] - return: types: ["object", "array", "null"] - examples: [ - { - title: "Tag types externally (scalar)" - source: #""" - tag_types_externally(123) - """# - return: { - integer: 123 - } - }, - { - title: "Tag types externally (object)" - source: #""" - tag_types_externally({ - "message": "Hello world", - "request": { - "duration_ms": 67.9 - } - }) - """# - return: { - message: { - string: "Hello world" - } - request: { - duration_ms: { - float: 67.9 - } - } - } - }, - { - title: "Tag types externally (array)" - source: #""" - tag_types_externally(["foo", "bar"]) - """# - return: [ - { - string: "foo" - }, - { - string: "bar" - }, - ] - }, - { - title: "Tag types externally (null)" - source: #""" - tag_types_externally(null) - """# - return: null - }, - ] -} +{ + "remap": { + "functions": { + "tag_types_externally": { + "anchor": "tag_types_externally", + "name": "tag_types_externally", + "category": "Type", + "description": "Adds type information to all (nested) scalar values in the provided `value`.\n\nThe type information is added externally, meaning that `value` has the form of `\"type\": value` after this\ntransformation.", + "arguments": [ + { + "name": "value", + "description": "The value to tag with types.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "object", + "array", + "null" + ] + }, + "examples": [ + { + "title": "Tag types externally (scalar)", + "source": "tag_types_externally(123)", + "return": { + "integer": 123 + } + }, + { + "title": "Tag types externally (object)", + "source": "tag_types_externally({\n \"message\": \"Hello world\",\n \"request\": {\n \"duration_ms\": 67.9\n }\n})\n", + "return": { + "message": { + "string": "Hello world" + }, + "request": { + "duration_ms": { + "float": 67.9 + } + } + } + }, + { + "title": "Tag types externally (array)", + "source": "tag_types_externally([\"foo\", \"bar\"])", + "return": [ + { + "string": "foo" + }, + { + "string": "bar" + } + ] + }, + { + "title": "Tag types externally (null)", + "source": "tag_types_externally(null)", + "return": null + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/tally.cue b/website/cue/reference/remap/functions/tally.cue new file mode 100644 index 0000000000000..64a05e6e24e80 --- /dev/null +++ b/website/cue/reference/remap/functions/tally.cue @@ -0,0 +1,39 @@ +{ + "remap": { + "functions": { + "tally": { + "anchor": "tally", + "name": "tally", + "category": "Enumerate", + "description": "Counts the occurrences of each string value in the provided array and returns an object with the counts.", + "arguments": [ + { + "name": "value", + "description": "The array of strings to count occurrences for.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "tally", + "source": "tally!([\"foo\", \"bar\", \"foo\", \"baz\"])", + "return": { + "bar": 1, + "baz": 1, + "foo": 2 + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/tally_value.cue b/website/cue/reference/remap/functions/tally_value.cue new file mode 100644 index 0000000000000..a037b3bbf5a8a --- /dev/null +++ b/website/cue/reference/remap/functions/tally_value.cue @@ -0,0 +1,43 @@ +{ + "remap": { + "functions": { + "tally_value": { + "anchor": "tally_value", + "name": "tally_value", + "category": "Enumerate", + "description": "Counts the number of times a specific value appears in the provided array.", + "arguments": [ + { + "name": "array", + "description": "The array to search through.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "value", + "description": "The value to count occurrences of in the array.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "examples": [ + { + "title": "count matching values", + "source": "tally_value([\"foo\", \"bar\", \"foo\", \"baz\"], \"foo\")", + "return": 2 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/timestamp.cue b/website/cue/reference/remap/functions/timestamp.cue index 37da9bd4a2c78..6adea2d8ecd7b 100644 --- a/website/cue/reference/remap/functions/timestamp.cue +++ b/website/cue/reference/remap/functions/timestamp.cue @@ -1,38 +1,47 @@ -package metadata - -remap: functions: timestamp: { - category: "Type" - description: """ - Returns `value` if it is a timestamp, otherwise returns an error. This enables the type checker to guarantee that - the returned value is a timestamp and can be used in any function that expects a timestamp. - """ - - arguments: [ - { - name: "value" - description: "The value to check if it is a timestamp." - required: true - type: ["any"] - }, - ] - internal_failure_reasons: [ - "`value` is not a timestamp.", - ] - return: { - types: ["timestamp"] - rules: [ - #"Returns the `value` if it's a timestamp."#, - #"Raises an error if not a timestamp."#, - ] - } - examples: [ - { - title: "Declare a timestamp type" - input: log: timestamp: "2020-10-10T16:00:00Z" - source: #""" - timestamp(t'2020-10-10T16:00:00Z') - """# - return: "2020-10-10T16:00:00Z" - }, - ] -} +{ + "remap": { + "functions": { + "timestamp": { + "anchor": "timestamp", + "name": "timestamp", + "category": "Type", + "description": "Returns `value` if it is a timestamp, otherwise returns an error. This enables the type checker to guarantee that the returned value is a timestamp and can be used in any function that expects a timestamp.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it is a timestamp.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "timestamp" + ], + "rules": [ + "Returns the `value` if it's a timestamp.", + "Raises an error if not a timestamp." + ] + }, + "internal_failure_reasons": [ + "`value` is not a timestamp." + ], + "examples": [ + { + "title": "Declare a timestamp type", + "source": "timestamp(t'2020-10-10T16:00:00Z')", + "return": "t'2020-10-10T16:00:00Z'" + }, + { + "title": "Invalid type", + "source": "timestamp!(true)", + "raises": "function call error for \"timestamp\" at (0:16): expected timestamp, got boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_bool.cue b/website/cue/reference/remap/functions/to_bool.cue index 3ba6a9d45d898..c1ed036445822 100644 --- a/website/cue/reference/remap/functions/to_bool.cue +++ b/website/cue/reference/remap/functions/to_bool.cue @@ -1,69 +1,136 @@ -package metadata - -remap: functions: to_bool: { - category: "Coerce" - description: """ - Coerces the `value` into a boolean. - """ - - arguments: [ - { - name: "value" - description: "The value to convert to a Boolean." - required: true - type: ["boolean", "integer", "float", "null", "string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a supported boolean representation.", - ] - return: { - types: ["boolean"] - rules: [ - #"If `value` is `"true"`, `"t"`, `"yes"`, or `"y"`, `true` is returned."#, - #"If `value` is `"false"`, `"f"`, `"no"`, `"n"`, or `"0"`, `false` is returned."#, - #"If `value` is `0.0`, `false` is returned, otherwise `true` is returned."#, - #"If `value` is `0`, `false` is returned, otherwise `true` is returned."#, - #"If `value` is `null`, `false` is returned."#, - #"If `value` is a Boolean, it's returned unchanged."#, - ] - } - - examples: [ - { - title: "Coerce to a Boolean (string)" - source: """ - to_bool!("yes") - """ - return: true - }, - { - title: "Coerce to a Boolean (float)" - source: """ - to_bool(0.0) - """ - return: false - }, - { - title: "Coerce to a Boolean (int)" - source: """ - to_bool(0) - """ - return: false - }, - { - title: "Coerce to a Boolean (null)" - source: """ - to_bool(null) - """ - return: false - }, - { - title: "Coerce to a Boolean (Boolean)" - source: """ - to_bool(true) - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "to_bool": { + "anchor": "to_bool", + "name": "to_bool", + "category": "Coerce", + "description": "Coerces the `value` into a boolean.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a Boolean.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "If `value` is `\"true\"`, `\"t\"`, `\"yes\"`, or `\"y\"`, `true` is returned.", + "If `value` is `\"false\"`, `\"f\"`, `\"no\"`, `\"n\"`, or `\"0\"`, `false` is returned.", + "If `value` is `0.0`, `false` is returned, otherwise `true` is returned.", + "If `value` is `0`, `false` is returned, otherwise `true` is returned.", + "If `value` is `null`, `false` is returned.", + "If `value` is a Boolean, it's returned unchanged." + ] + }, + "internal_failure_reasons": [ + "`value` is not a supported boolean representation." + ], + "examples": [ + { + "title": "Coerce to a Boolean (string)", + "source": "to_bool!(\"yes\")", + "return": true + }, + { + "title": "Coerce to a Boolean (float)", + "source": "to_bool(0.0)", + "return": false + }, + { + "title": "Coerce to a Boolean (int)", + "source": "to_bool(0)", + "return": false + }, + { + "title": "Coerce to a Boolean (null)", + "source": "to_bool(null)", + "return": false + }, + { + "title": "Coerce to a Boolean (Boolean)", + "source": "to_bool(true)", + "return": true + }, + { + "title": "Integer (other)", + "source": "to_bool(2)", + "return": true + }, + { + "title": "Float (other)", + "source": "to_bool(5.6)", + "return": true + }, + { + "title": "False", + "source": "to_bool(false)", + "return": false + }, + { + "title": "True string", + "source": "to_bool!(s'true')", + "return": true + }, + { + "title": "Y string", + "source": "to_bool!(s'y')", + "return": true + }, + { + "title": "Non-zero integer string", + "source": "to_bool!(s'1')", + "return": true + }, + { + "title": "False string", + "source": "to_bool!(s'false')", + "return": false + }, + { + "title": "No string", + "source": "to_bool!(s'no')", + "return": false + }, + { + "title": "N string", + "source": "to_bool!(s'n')", + "return": false + }, + { + "title": "Invalid string", + "source": "to_bool!(s'foobar')", + "raises": "function call error for \"to_bool\" at (0:19): Invalid boolean value \"foobar\"" + }, + { + "title": "Timestamp", + "source": "to_bool!(t'2020-01-01T00:00:00Z')", + "raises": "function call error for \"to_bool\" at (0:33): unable to coerce timestamp into boolean" + }, + { + "title": "Array", + "source": "to_bool!([])", + "raises": "function call error for \"to_bool\" at (0:12): unable to coerce array into boolean" + }, + { + "title": "Object", + "source": "to_bool!({})", + "raises": "function call error for \"to_bool\" at (0:12): unable to coerce object into boolean" + }, + { + "title": "Regex", + "source": "to_bool!(r'foo')", + "raises": "function call error for \"to_bool\" at (0:16): unable to coerce regex into boolean" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_float.cue b/website/cue/reference/remap/functions/to_float.cue index fbbd18f16e0bc..ceae764f9c92d 100644 --- a/website/cue/reference/remap/functions/to_float.cue +++ b/website/cue/reference/remap/functions/to_float.cue @@ -1,48 +1,95 @@ -package metadata - -remap: functions: to_float: { - category: "Coerce" - description: """ - Coerces the `value` into a float. - """ - arguments: [ - { - name: "value" - description: """ - The value to convert to a float. Must be convertible to a float, otherwise an error is raised. - """ - required: true - type: ["integer", "float", "boolean", "string", "timestamp"] - }, - ] - internal_failure_reasons: [ - "`value` is not a supported float representation.", - ] - return: { - types: ["float"] - rules: [ - "If `value` is a float, it will be returned as-is.", - "If `value` is an integer, it will be returned as as a float.", - "If `value` is a string, it must be the string representation of an float or else an error is raised.", - "If `value` is a boolean, `0.0` is returned for `false` and `1.0` is returned for `true`.", - "If `value` is a timestamp, a [Unix timestamp](\(urls.unix_timestamp)) with fractional seconds is returned.", - ] - } - - examples: [ - { - title: "Coerce to a float" - source: """ - to_float!("3.145") - """ - return: 3.145 - }, - { - title: "Coerce to a float (timestamp)" - source: """ - to_float(t'2020-12-30T22:20:53.824727Z') - """ - return: 1609366853.824727 - }, - ] -} +{ + "remap": { + "functions": { + "to_float": { + "anchor": "to_float", + "name": "to_float", + "category": "Coerce", + "description": "Coerces the `value` into a float.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a float. Must be convertible to a float, otherwise an error is raised.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "float" + ], + "rules": [ + "If `value` is a float, it will be returned as-is.", + "If `value` is an integer, it will be returned as as a float.", + "If `value` is a string, it must be the string representation of an float or else an error is raised.", + "If `value` is a boolean, `0.0` is returned for `false` and `1.0` is returned for `true`.", + "If `value` is a timestamp, a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) with fractional seconds is returned." + ] + }, + "internal_failure_reasons": [ + "`value` is not a supported float representation." + ], + "examples": [ + { + "title": "Coerce to a float", + "source": "to_float!(\"3.145\")", + "return": 3.145 + }, + { + "title": "Coerce to a float (timestamp)", + "source": "to_float(t'2020-12-30T22:20:53.824727Z')", + "return": 1609366853.824727 + }, + { + "title": "Integer", + "source": "to_float(5)", + "return": 5.0 + }, + { + "title": "Float", + "source": "to_float(5.6)", + "return": 5.6 + }, + { + "title": "True", + "source": "to_float(true)", + "return": 1.0 + }, + { + "title": "False", + "source": "to_float(false)", + "return": 0.0 + }, + { + "title": "Null", + "source": "to_float(null)", + "return": 0.0 + }, + { + "title": "Invalid string", + "source": "to_float!(s'foobar')", + "raises": "function call error for \"to_float\" at (0:20): Invalid floating point number \"foobar\": invalid float literal" + }, + { + "title": "Array", + "source": "to_float!([])", + "raises": "function call error for \"to_float\" at (0:13): unable to coerce array into float" + }, + { + "title": "Object", + "source": "to_float!({})", + "raises": "function call error for \"to_float\" at (0:13): unable to coerce object into float" + }, + { + "title": "Regex", + "source": "to_float!(r'foo')", + "raises": "function call error for \"to_float\" at (0:17): unable to coerce regex into float" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_int.cue b/website/cue/reference/remap/functions/to_int.cue index 688c59704c0a2..978b79e36c3a2 100644 --- a/website/cue/reference/remap/functions/to_int.cue +++ b/website/cue/reference/remap/functions/to_int.cue @@ -1,51 +1,97 @@ -package metadata - -remap: functions: to_int: { - category: "Coerce" - description: """ - Coerces the `value` into an integer. - """ - - arguments: [ - { - name: "value" - description: """ - The value to convert to an integer. - """ - required: true - type: ["integer", "float", "boolean", "string", "timestamp", "null"] - }, - ] - internal_failure_reasons: [ - "`value` is a string but the text is not an integer.", - "`value` is not a string, int, or timestamp.", - ] - return: { - types: ["integer"] - rules: [ - "If `value` is an integer, it will be returned as-is.", - "If `value` is a float, it will be truncated to its integer portion.", - "If `value` is a string, it must be the string representation of an integer or else an error is raised.", - "If `value` is a boolean, `0` is returned for `false` and `1` is returned for `true`.", - "If `value` is a timestamp, a [Unix timestamp](\(urls.unix_timestamp)) (in seconds) is returned.", - "If `value` is null, `0` is returned.", - ] - } - - examples: [ - { - title: "Coerce to an int (string)" - source: """ - to_int!("2") - """ - return: 2 - }, - { - title: "Coerce to an int (timestamp)" - source: """ - to_int(t'2020-12-30T22:20:53.824727Z') - """ - return: 1609366853 - }, - ] -} +{ + "remap": { + "functions": { + "to_int": { + "anchor": "to_int", + "name": "to_int", + "category": "Coerce", + "description": "Coerces the `value` into an integer.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to an integer.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "integer" + ], + "rules": [ + "If `value` is an integer, it will be returned as-is.", + "If `value` is a float, it will be truncated to its integer portion.", + "If `value` is a string, it must be the string representation of an integer or else an error is raised.", + "If `value` is a boolean, `0` is returned for `false` and `1` is returned for `true`.", + "If `value` is a timestamp, a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) (in seconds) is returned.", + "If `value` is null, `0` is returned." + ] + }, + "internal_failure_reasons": [ + "`value` is a string but the text is not an integer.", + "`value` is not a string, int, or timestamp." + ], + "examples": [ + { + "title": "Coerce to an int (string)", + "source": "to_int!(\"2\")", + "return": 2 + }, + { + "title": "Coerce to an int (timestamp)", + "source": "to_int(t'2020-12-30T22:20:53.824727Z')", + "return": 1609366853 + }, + { + "title": "Integer", + "source": "to_int(5)", + "return": 5 + }, + { + "title": "Float", + "source": "to_int(5.6)", + "return": 5 + }, + { + "title": "True", + "source": "to_int(true)", + "return": 1 + }, + { + "title": "False", + "source": "to_int(false)", + "return": 0 + }, + { + "title": "Null", + "source": "to_int(null)", + "return": 0 + }, + { + "title": "Invalid string", + "source": "to_int!(s'foobar')", + "raises": "function call error for \"to_int\" at (0:18): Invalid integer \"foobar\": invalid digit found in string" + }, + { + "title": "Array", + "source": "to_int!([])", + "raises": "function call error for \"to_int\" at (0:11): unable to coerce array into integer" + }, + { + "title": "Object", + "source": "to_int!({})", + "raises": "function call error for \"to_int\" at (0:11): unable to coerce object into integer" + }, + { + "title": "Regex", + "source": "to_int!(r'foo')", + "raises": "function call error for \"to_int\" at (0:15): unable to coerce regex into integer" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_regex.cue b/website/cue/reference/remap/functions/to_regex.cue index 9497da6d46508..907c6a12315c7 100644 --- a/website/cue/reference/remap/functions/to_regex.cue +++ b/website/cue/reference/remap/functions/to_regex.cue @@ -1,37 +1,44 @@ -package metadata - -remap: functions: to_regex: { - category: "Coerce" - description: """ - Coerces the `value` into a regex. - """ - notices: ["Compiling a regular expression is an expensive operation and can limit Vector throughput. Don't use this function unless you are absolutely sure there is no other way!"] - - arguments: [ - { - name: "value" - description: "The value to convert to a regex." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a string.", - ] - return: { - types: ["regex"] - rules: [ - #"If `value` is a string that contains a valid regex, returns the regex constructed with this string."#, - ] - } - - examples: [ - { - title: "Coerce to a regex" - source: #""" - to_regex("^foo$") ?? r'' - """# - return: "^foo$" - }, - ] -} +{ + "remap": { + "functions": { + "to_regex": { + "anchor": "to_regex", + "name": "to_regex", + "category": "Coerce", + "description": "Coerces the `value` into a regex.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a regex.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "regex" + ], + "rules": [ + "If `value` is a string that contains a valid regex, returns the regex constructed with this string." + ] + }, + "internal_failure_reasons": [ + "`value` is not a string." + ], + "examples": [ + { + "title": "Coerce to a regex", + "source": "to_regex!(\"^foo$\")", + "return": "r'^foo$'" + } + ], + "notices": [ + "Compiling a regular expression is an expensive operation and can limit Vector's\nthroughput. Don't use this function unless you are absolutely sure there is no other\nway!" + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_string.cue b/website/cue/reference/remap/functions/to_string.cue index 4a8104d1bd32b..7de9823460999 100644 --- a/website/cue/reference/remap/functions/to_string.cue +++ b/website/cue/reference/remap/functions/to_string.cue @@ -1,53 +1,89 @@ -package metadata - -remap: functions: to_string: { - category: "Coerce" - description: """ - Coerces the `value` into a string. - """ - - arguments: [ - { - name: "value" - description: "The value to convert to a string." - required: true - type: ["integer", "float", "boolean", "string", "timestamp", "null"] - }, - ] - internal_failure_reasons: [ - "`value` is not an integer, float, boolean, string, timestamp, or null.", - ] - return: { - types: ["string"] - rules: [ - #"If `value` is an integer or float, returns the string representation."#, - #"If `value` is a boolean, returns `"true"` or `"false"`."#, - #"If `value` is a timestamp, returns an [RFC 3339](\(urls.rfc3339)) representation."#, - #"If `value` is a null, returns `""`."#, - ] - } - - examples: [ - { - title: "Coerce to a string (Boolean)" - source: #""" - to_string(true) - """# - return: "true" - }, - { - title: "Coerce to a string (int)" - source: #""" - to_string(52) - """# - return: "52" - }, - { - title: "Coerce to a string (float)" - source: #""" - to_string(52.2) - """# - return: "52.2" - }, - ] -} +{ + "remap": { + "functions": { + "to_string": { + "anchor": "to_string", + "name": "to_string", + "category": "Coerce", + "description": "Coerces the `value` into a string.", + "arguments": [ + { + "name": "value", + "description": "The value to convert to a string.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "string" + ], + "rules": [ + "If `value` is an integer or float, returns the string representation.", + "If `value` is a boolean, returns `\"true\"` or `\"false\"`.", + "If `value` is a timestamp, returns an [RFC 3339](\\(urls.rfc3339)) representation.", + "If `value` is a null, returns `\"\"`." + ] + }, + "internal_failure_reasons": [ + "`value` is not an integer, float, boolean, string, timestamp, or null." + ], + "examples": [ + { + "title": "Coerce to a string (Boolean)", + "source": "to_string(true)", + "return": "s'true'" + }, + { + "title": "Coerce to a string (int)", + "source": "to_string(52)", + "return": "s'52'" + }, + { + "title": "Coerce to a string (float)", + "source": "to_string(52.2)", + "return": "s'52.2'" + }, + { + "title": "String", + "source": "to_string(s'foo')", + "return": "foo" + }, + { + "title": "False", + "source": "to_string(false)", + "return": "s'false'" + }, + { + "title": "Null", + "source": "to_string(null)", + "return": "" + }, + { + "title": "Timestamp", + "source": "to_string(t'2020-01-01T00:00:00Z')", + "return": "2020-01-01T00:00:00Z" + }, + { + "title": "Array", + "source": "to_string!([])", + "raises": "function call error for \"to_string\" at (0:14): unable to coerce array into string" + }, + { + "title": "Object", + "source": "to_string!({})", + "raises": "function call error for \"to_string\" at (0:14): unable to coerce object into string" + }, + { + "title": "Regex", + "source": "to_string!(r'foo')", + "raises": "function call error for \"to_string\" at (0:18): unable to coerce regex into string" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_syslog_facility.cue b/website/cue/reference/remap/functions/to_syslog_facility.cue index 01cfc89ea909a..5559fc77d56df 100644 --- a/website/cue/reference/remap/functions/to_syslog_facility.cue +++ b/website/cue/reference/remap/functions/to_syslog_facility.cue @@ -1,32 +1,43 @@ -package metadata - -remap: functions: to_syslog_facility: { - category: "Convert" - description: """ - Converts the `value`, a Syslog [facility code](\(urls.syslog_facility)), into its corresponding - Syslog keyword. For example, `0` into `"kern"`, `1` into `"user"`, etc. - """ - - arguments: [ - { - name: "value" - description: "The facility code." - required: true - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid Syslog [facility code](\(urls.syslog_facility)).", - ] - return: types: ["string"] - - examples: [ - { - title: "Coerce to a Syslog facility" - source: """ - to_syslog_facility!(4) - """ - return: "auth" - }, - ] -} +{ + "remap": { + "functions": { + "to_syslog_facility": { + "anchor": "to_syslog_facility", + "name": "to_syslog_facility", + "category": "Convert", + "description": "Converts the `value`, a Syslog [facility code](https://en.wikipedia.org/wiki/Syslog#Facility), into its corresponding Syslog keyword. For example, `0` into `\"kern\"`, `1` into `\"user\"`, etc.", + "arguments": [ + { + "name": "value", + "description": "The facility code.", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid Syslog [facility code](https://en.wikipedia.org/wiki/Syslog#Facility)." + ], + "examples": [ + { + "title": "Coerce to a Syslog facility", + "source": "to_syslog_facility!(4)", + "return": "auth" + }, + { + "title": "invalid", + "source": "to_syslog_facility!(500)", + "raises": "function call error for \"to_syslog_facility\" at (0:24): facility code 500 not valid" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_syslog_facility_code.cue b/website/cue/reference/remap/functions/to_syslog_facility_code.cue index 718c82f82ea00..1d560a64a659a 100644 --- a/website/cue/reference/remap/functions/to_syslog_facility_code.cue +++ b/website/cue/reference/remap/functions/to_syslog_facility_code.cue @@ -1,32 +1,43 @@ -package metadata - -remap: functions: to_syslog_facility_code: { - category: "Convert" - description: """ - Converts the `value`, a Syslog [facility keyword](\(urls.syslog_facility)), into a Syslog integer - facility code (`0` to `23`). - """ - - arguments: [ - { - name: "value" - description: "The Syslog facility keyword to convert." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid Syslog facility keyword.", - ] - return: types: ["integer"] - - examples: [ - { - title: "Coerce to Syslog facility code" - source: """ - to_syslog_facility_code!("authpriv") - """ - return: 10 - }, - ] -} +{ + "remap": { + "functions": { + "to_syslog_facility_code": { + "anchor": "to_syslog_facility_code", + "name": "to_syslog_facility_code", + "category": "Convert", + "description": "Converts the `value`, a Syslog [facility keyword](https://en.wikipedia.org/wiki/Syslog#Facility), into a Syslog integer facility code (`0` to `23`).", + "arguments": [ + { + "name": "value", + "description": "The Syslog facility keyword to convert.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "integer" + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid Syslog facility keyword." + ], + "examples": [ + { + "title": "Coerce to Syslog facility code", + "source": "to_syslog_facility_code!(\"authpriv\")", + "return": 10 + }, + { + "title": "invalid", + "source": "to_syslog_facility_code!(s'foobar')", + "raises": "function call error for \"to_syslog_facility_code\" at (0:35): syslog facility 'foobar' not valid" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_syslog_level.cue b/website/cue/reference/remap/functions/to_syslog_level.cue index c39f69e93d02c..c8465cb27422b 100644 --- a/website/cue/reference/remap/functions/to_syslog_level.cue +++ b/website/cue/reference/remap/functions/to_syslog_level.cue @@ -1,32 +1,43 @@ -package metadata - -remap: functions: to_syslog_level: { - category: "Convert" - description: """ - Converts the `value`, a Syslog [severity level](\(urls.syslog_levels)), into its corresponding keyword, - i.e. 0 into `"emerg"`, 1 into `"alert"`, etc. - """ - - arguments: [ - { - name: "value" - description: "The severity level." - required: true - type: ["integer"] - }, - ] - internal_failure_reasons: [ - "`value` isn't a valid Syslog [severity level](\(urls.syslog_levels)).", - ] - return: types: ["string"] - - examples: [ - { - title: "Coerce to a Syslog level" - source: """ - to_syslog_level!(5) - """ - return: "notice" - }, - ] -} +{ + "remap": { + "functions": { + "to_syslog_level": { + "anchor": "to_syslog_level", + "name": "to_syslog_level", + "category": "Convert", + "description": "Converts the `value`, a Syslog [severity level](https://en.wikipedia.org/wiki/Syslog#Severity_level), into its corresponding keyword, i.e. 0 into `\"emerg\"`, 1 into `\"alert\"`, etc.", + "arguments": [ + { + "name": "value", + "description": "The severity level.", + "required": true, + "type": [ + "integer" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` isn't a valid Syslog [severity level](https://en.wikipedia.org/wiki/Syslog#Severity_level)." + ], + "examples": [ + { + "title": "Coerce to a Syslog level", + "source": "to_syslog_level!(5)", + "return": "notice" + }, + { + "title": "invalid", + "source": "to_syslog_level!(500)", + "raises": "function call error for \"to_syslog_level\" at (0:21): severity level 500 not valid" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_syslog_severity.cue b/website/cue/reference/remap/functions/to_syslog_severity.cue index a50986a9ecbc5..037db2f1c5336 100644 --- a/website/cue/reference/remap/functions/to_syslog_severity.cue +++ b/website/cue/reference/remap/functions/to_syslog_severity.cue @@ -1,37 +1,46 @@ -package metadata - -remap: functions: to_syslog_severity: { - category: "Convert" - description: """ - Converts the `value`, a Syslog [log level keyword](\(urls.syslog_levels)), into a Syslog integer - severity level (`0` to `7`). - """ - - arguments: [ - { - name: "value" - description: "The Syslog level keyword to convert." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [ - "`value` is not a valid Syslog level keyword.", - ] - return: { - types: ["integer"] - rules: [ - "The now-deprecated keywords `panic`, `error`, and `warn` are converted to `0`, `3`, and `4` respectively.", - ] - } - - examples: [ - { - title: "Coerce to Syslog severity" - source: """ - to_syslog_severity!("alert") - """ - return: 1 - }, - ] -} +{ + "remap": { + "functions": { + "to_syslog_severity": { + "anchor": "to_syslog_severity", + "name": "to_syslog_severity", + "category": "Convert", + "description": "Converts the `value`, a Syslog [log level keyword](https://en.wikipedia.org/wiki/Syslog#Severity_level), into a Syslog integer severity level (`0` to `7`).", + "arguments": [ + { + "name": "value", + "description": "The Syslog level keyword to convert.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "integer" + ], + "rules": [ + "The now-deprecated keywords `panic`, `error`, and `warn` are converted to `0`, `3`, and `4` respectively." + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid Syslog level keyword." + ], + "examples": [ + { + "title": "Coerce to Syslog severity", + "source": "to_syslog_severity!(\"alert\")", + "return": 1 + }, + { + "title": "invalid", + "source": "to_syslog_severity!(s'foobar')", + "raises": "function call error for \"to_syslog_severity\" at (0:30): syslog level foobar not valid" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/to_unix_timestamp.cue b/website/cue/reference/remap/functions/to_unix_timestamp.cue index 2a622576f2678..5dca78d2d6892 100644 --- a/website/cue/reference/remap/functions/to_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/to_unix_timestamp.cue @@ -1,59 +1,67 @@ -package metadata - -remap: functions: to_unix_timestamp: { - category: "Convert" - description: """ - Converts the `value` timestamp into a [Unix timestamp](\(urls.unix_timestamp)). - - Returns the number of seconds since the Unix epoch by default. To return the number in milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`. - """ - - arguments: [ - { - name: "value" - description: "The timestamp to convert into a Unix timestamp." - required: true - type: ["timestamp"] - }, - { - name: "unit" - description: "The time unit." - type: ["string"] - required: false - enum: { - seconds: "Express Unix time in seconds" - milliseconds: "Express Unix time in milliseconds" - nanoseconds: "Express Unix time in nanoseconds" - } - default: "seconds" - }, - ] - internal_failure_reasons: [ - "`value` cannot be represented in nanoseconds. Result is too large or too small for a 64 bit integer.", - ] - return: types: ["integer"] - - examples: [ - { - title: "Convert to a Unix timestamp (seconds)" - source: #""" - to_unix_timestamp(t'2021-01-01T00:00:00+00:00') - """# - return: 1609459200 - }, - { - title: "Convert to a Unix timestamp (milliseconds)" - source: #""" - to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: "milliseconds") - """# - return: 1609459200000 - }, - { - title: "Convert to a Unix timestamp (nanoseconds)" - source: #""" - to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: "nanoseconds") - """# - return: 1609459200000000000 - }, - ] -} +{ + "remap": { + "functions": { + "to_unix_timestamp": { + "anchor": "to_unix_timestamp", + "name": "to_unix_timestamp", + "category": "Convert", + "description": "Converts the `value` timestamp into a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time).\n\nReturns the number of seconds since the Unix epoch by default. To return the number in milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`.", + "arguments": [ + { + "name": "value", + "description": "The timestamp to convert into a Unix timestamp.", + "required": true, + "type": [ + "timestamp" + ] + }, + { + "name": "unit", + "description": "The time unit.", + "required": false, + "type": [ + "string" + ], + "enum": { + "seconds": "Express Unix time in seconds", + "nanoseconds": "Express Unix time in nanoseconds", + "milliseconds": "Express Unix time in milliseconds" + }, + "default": "seconds" + } + ], + "return": { + "types": [ + "integer" + ] + }, + "internal_failure_reasons": [ + "`value` cannot be represented in nanoseconds. Result is too large or too small for a 64 bit integer." + ], + "examples": [ + { + "title": "Convert to a Unix timestamp (seconds)", + "source": "to_unix_timestamp(t'2021-01-01T00:00:00+00:00')", + "return": 1609459200 + }, + { + "title": "Convert to a Unix timestamp (milliseconds)", + "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"milliseconds\")", + "return": 1609459200000 + }, + { + "title": "Convert to a Unix timestamp (microseconds)", + "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"microseconds\")", + "return": 1609459200000000 + }, + { + "title": "Convert to a Unix timestamp (nanoseconds)", + "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"nanoseconds\")", + "return": 1609459200000000000 + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/truncate.cue b/website/cue/reference/remap/functions/truncate.cue index 233fb95ab4bc4..ad3901b19b87d 100644 --- a/website/cue/reference/remap/functions/truncate.cue +++ b/website/cue/reference/remap/functions/truncate.cue @@ -1,66 +1,64 @@ -package metadata - -remap: functions: truncate: { - category: "String" - description: """ - Truncates the `value` string up to the `limit` number of characters. - """ - - arguments: [ - { - name: "value" - description: "The string to truncate." - required: true - type: ["string"] - }, - { - name: "limit" - description: "The number of characters to truncate the string after." - required: true - type: ["integer", "float"] - }, - { - name: "ellipsis" - description: """ - This argument is deprecated. An ellipsis (`...`) is appended if the parameter is set to `true` _and_ the `value` string - is truncated because it exceeded the `limit`. - """ - required: false - type: ["boolean"] - }, - { - name: "suffix" - description: """ - A custom suffix (`...`) is appended to truncated strings. - If `ellipsis` is set to `true`, this parameter is ignored for backwards compatibility. - """ - required: false - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["string"] - rules: [ - "The string is returned unchanged its length is less than `limit`.", - "If `ellipsis` is `true`, then an ellipsis (`...`) is appended to the string (beyond the specified `limit`).", - ] - } - - examples: [ - { - title: "Truncate a string" - source: #""" - truncate("A rather long sentence.", limit: 11, suffix: "...") - """# - return: "A rather lo..." - }, - { - title: "Truncate a string" - source: #""" - truncate("A rather long sentence.", limit: 11, suffix: "[TRUNCATED]") - """# - return: "A rather lo[TRUNCATED]" - }, - ] -} +{ + "remap": { + "functions": { + "truncate": { + "anchor": "truncate", + "name": "truncate", + "category": "String", + "description": "Truncates the `value` string up to the `limit` number of characters.", + "arguments": [ + { + "name": "value", + "description": "The string to truncate.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "limit", + "description": "The number of characters to truncate the string after.", + "required": true, + "type": [ + "integer" + ] + }, + { + "name": "suffix", + "description": "A custom suffix (`...`) is appended to truncated strings.\nIf `ellipsis` is set to `true`, this parameter is ignored for backwards compatibility.", + "required": false, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ], + "rules": [ + "The string is returned unchanged its length is less than `limit`." + ] + }, + "examples": [ + { + "title": "Truncate a string", + "source": "truncate(\"A rather long sentence.\", limit: 11, suffix: \"...\")", + "return": "A rather lo..." + }, + { + "title": "Truncate a string (custom suffix)", + "source": "truncate(\"A rather long sentence.\", limit: 11, suffix: \"[TRUNCATED]\")", + "return": "A rather lo[TRUNCATED]" + }, + { + "title": "Truncate", + "source": "truncate(\"foobar\", 3)", + "return": "foo" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/type_def.cue b/website/cue/reference/remap/functions/type_def.cue new file mode 100644 index 0000000000000..548002d7df458 --- /dev/null +++ b/website/cue/reference/remap/functions/type_def.cue @@ -0,0 +1,37 @@ +{ + "remap": { + "functions": { + "type_def": { + "anchor": "type_def", + "name": "type_def", + "category": "Type", + "description": "Returns the type definition of an expression at runtime.\n\nThis is a debug function that is *UNSTABLE*. Behavior is *NOT* guaranteed even though it is technically usable.", + "arguments": [ + { + "name": "value", + "description": "The expression to get the type definition for.", + "required": true, + "type": [ + "any" + ] + } + ], + "return": { + "types": [ + "any" + ] + }, + "examples": [ + { + "title": "return type definition", + "source": "type_def(42)", + "return": { + "integer": true + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/unflatten.cue b/website/cue/reference/remap/functions/unflatten.cue index 67ca69aa17010..e336607d6d3b3 100644 --- a/website/cue/reference/remap/functions/unflatten.cue +++ b/website/cue/reference/remap/functions/unflatten.cue @@ -1,111 +1,106 @@ -package metadata - -remap: functions: unflatten: { - category: "Enumerate" - description: #""" - Unflattens the `value` into a nested representation. - """# - - arguments: [ - { - name: "value" - description: "The array or object to unflatten." - required: true - type: ["object"] - }, - { - name: "separator" - description: "The separator to split flattened keys." - required: false - default: "." - type: ["string"] - }, - { - name: "recursive" - description: "Whether to recursively unflatten the object values." - required: false - default: "true" - type: ["boolean"] - }, - ] - internal_failure_reasons: [] - return: types: ["object"] - - examples: [ - { - title: "Unflatten" - source: #""" - unflatten({ - "foo.bar.baz": true, - "foo.bar.qux": false, - "foo.quux": 42 - }) - """# - return: { - "foo": { - "bar": { - "baz": true - "qux": false - } - "quux": 42 - } - } - }, - { - title: "Unflatten recursively" - source: #""" - unflatten({ - "flattened.parent": { - "foo.bar": true, - "foo.baz": false - } - }) - """# - return: { - "flattened": { - "parent": { - "foo": { - "bar": true - "baz": false - } - } - } - } - }, - { - title: "Unflatten non-recursively" - source: #""" - unflatten({ - "flattened.parent": { - "foo.bar": true, - "foo.baz": false - } - }, recursive: false) - """# - return: { - "flattened": { - "parent": { - "foo.bar": true - "foo.baz": false - } - } - } - }, - { - title: "Ignore inconsistent keys values" - source: #""" - unflatten({ - "a": 3, - "a.b": 2, - "a.c": 4 - }) - """# - return: { - "a": { - "b": 2 - "c": 4 - } - } - }, - ] -} +{ + "remap": { + "functions": { + "unflatten": { + "anchor": "unflatten", + "name": "unflatten", + "category": "Enumerate", + "description": "Unflattens the `value` into a nested representation.", + "arguments": [ + { + "name": "value", + "description": "The array or object to unflatten.", + "required": true, + "type": [ + "object" + ] + }, + { + "name": "separator", + "description": "The separator to split flattened keys.", + "required": false, + "type": [ + "string" + ], + "default": "." + }, + { + "name": "recursive", + "description": "Whether to recursively unflatten the object values.", + "required": false, + "type": [ + "boolean" + ], + "default": "true" + } + ], + "return": { + "types": [ + "object" + ] + }, + "examples": [ + { + "title": "Unflatten", + "source": "unflatten({\n \"foo.bar.baz\": true,\n \"foo.bar.qux\": false,\n \"foo.quux\": 42\n})\n", + "return": { + "foo": { + "bar": { + "baz": true, + "qux": false + }, + "quux": 42 + } + } + }, + { + "title": "Unflatten recursively", + "source": "unflatten({\n \"flattened.parent\": {\n \"foo.bar\": true,\n \"foo.baz\": false\n }\n})\n", + "return": { + "flattened": { + "parent": { + "foo": { + "bar": true, + "baz": false + } + } + } + } + }, + { + "title": "Unflatten non-recursively", + "source": "unflatten({\n \"flattened.parent\": {\n \"foo.bar\": true,\n \"foo.baz\": false\n }\n}, recursive: false)\n", + "return": { + "flattened": { + "parent": { + "foo.bar": true, + "foo.baz": false + } + } + } + }, + { + "title": "Ignore inconsistent keys values", + "source": "unflatten({\n \"a\": 3,\n \"a.b\": 2,\n \"a.c\": 4\n})\n", + "return": { + "a": { + "b": 2, + "c": 4 + } + } + }, + { + "title": "Unflatten with custom separator", + "source": "unflatten({ \"foo_bar\": true }, \"_\")", + "return": { + "foo": { + "bar": true + } + } + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/unique.cue b/website/cue/reference/remap/functions/unique.cue index 6dcb86389ca49..9c13102655144 100644 --- a/website/cue/reference/remap/functions/unique.cue +++ b/website/cue/reference/remap/functions/unique.cue @@ -1,33 +1,39 @@ -package metadata - -remap: functions: unique: { - category: "Enumerate" - description: #""" - Returns the unique values for an array. - - The first occurrence of each element is kept. - """# - - arguments: [ - { - name: "value" - description: "The array to return unique elements from." - required: true - type: ["array"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - } - - examples: [ - { - title: "Unique" - source: #""" - unique(["foo", "bar", "foo", "baz"]) - """# - return: ["foo", "bar", "baz"] - }, - ] -} +{ + "remap": { + "functions": { + "unique": { + "anchor": "unique", + "name": "unique", + "category": "Enumerate", + "description": "Returns the unique values for an array.\n\nThe first occurrence of each element is kept.", + "arguments": [ + { + "name": "value", + "description": "The array to return unique elements from.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "array" + ] + }, + "examples": [ + { + "title": "Unique", + "source": "unique([\"foo\", \"bar\", \"foo\", \"baz\"])", + "return": [ + "foo", + "bar", + "baz" + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/unnest.cue b/website/cue/reference/remap/functions/unnest.cue index 3a1592a646f26..6c77f1fbd6d1c 100644 --- a/website/cue/reference/remap/functions/unnest.cue +++ b/website/cue/reference/remap/functions/unnest.cue @@ -1,79 +1,68 @@ -package metadata - -remap: functions: unnest: { - category: "Object" - description: """ - Unnest an array field from an object to create an array of objects using that field; keeping all other fields. - - Assigning the array result of this to `.` results in multiple events being emitted from `remap`. See the - [`remap` transform docs](\(urls.vector_remap_transform_multiple)) for more details. - - This is also referred to as `explode` in some languages. - """ - - arguments: [ - { - name: "path" - description: "The path of the field to unnest." - required: true - type: ["path"] - }, - ] - internal_failure_reasons: [ - "The field path referred to is not an array.", - ] - notices: [] - return: { - types: ["array"] - rules: [ - "Returns an array of objects that matches the original object, but each with the specified path replaced with a single element from the original path.", - ] - } - - examples: [ - { - title: "Unnest an array field" - input: log: { - hostname: "localhost" - messages: [ - "message 1", - "message 2", - ] - } - source: ". = unnest!(.messages)" - output: [ - {log: { - hostname: "localhost" - messages: "message 1" - }}, - {log: { - hostname: "localhost" - messages: "message 2" - }}, - ] - }, - { - title: "Unnest nested an array field" - input: log: { - hostname: "localhost" - event: { - messages: [ - "message 1", - "message 2", - ] - } - } - source: ". = unnest!(.event.messages)" - output: [ - {log: { - hostname: "localhost" - event: messages: "message 1" - }}, - {log: { - hostname: "localhost" - event: messages: "message 2" - }}, - ] - }, - ] -} +{ + "remap": { + "functions": { + "unnest": { + "anchor": "unnest", + "name": "unnest", + "category": "Object", + "description": "Unnest an array field from an object to create an array of objects using that field; keeping all other fields.\n\nAssigning the array result of this to `.` results in multiple events being emitted from `remap`. See the\n[`remap` transform docs](/docs/reference/configuration/transforms/remap/#emitting-multiple-log-events) for more details.\n\nThis is also referred to as `explode` in some languages.", + "arguments": [ + { + "name": "path", + "description": "The path of the field to unnest.", + "required": true, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Returns an array of objects that matches the original object, but each with the specified path replaced with a single element from the original path." + ] + }, + "internal_failure_reasons": [ + "The field path referred to is not an array." + ], + "examples": [ + { + "title": "Unnest an array field", + "source": ". = {\"hostname\": \"localhost\", \"messages\": [\"message 1\", \"message 2\"]}\n. = unnest(.messages)\n", + "return": [ + { + "hostname": "localhost", + "messages": "message 1" + }, + { + "hostname": "localhost", + "messages": "message 2" + } + ] + }, + { + "title": "Unnest a nested array field", + "source": ". = {\"hostname\": \"localhost\", \"event\": {\"messages\": [\"message 1\", \"message 2\"]}}\n. = unnest(.event.messages)\n", + "return": [ + { + "event": { + "messages": "message 1" + }, + "hostname": "localhost" + }, + { + "event": { + "messages": "message 2" + }, + "hostname": "localhost" + } + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/upcase.cue b/website/cue/reference/remap/functions/upcase.cue index 69f2f339cfcef..afa2b85f3ee08 100644 --- a/website/cue/reference/remap/functions/upcase.cue +++ b/website/cue/reference/remap/functions/upcase.cue @@ -1,30 +1,35 @@ -package metadata - -remap: functions: upcase: { - description: """ - Upcases `value`, where upcase is defined according to the Unicode Derived Core Property - Uppercase. - """ - - arguments: [ - { - name: "value" - description: "The string to convert to uppercase." - required: true - type: ["string"] - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - category: "String" - - examples: [ - { - title: "Upcase a string" - source: #""" - upcase("Hello, World!") - """# - return: "HELLO, WORLD!" - }, - ] -} +{ + "remap": { + "functions": { + "upcase": { + "anchor": "upcase", + "name": "upcase", + "category": "String", + "description": "Upcases `value`, where upcase is defined according to the Unicode Derived Core Property Uppercase.", + "arguments": [ + { + "name": "value", + "description": "The string to convert to uppercase.", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Upcase a string", + "source": "upcase(\"Hello, World!\")", + "return": "HELLO, WORLD!" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue b/website/cue/reference/remap/functions/uuid_from_friendly_id.cue index b017e918bebfd..f51de47fe076e 100644 --- a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue +++ b/website/cue/reference/remap/functions/uuid_from_friendly_id.cue @@ -1,32 +1,39 @@ -package metadata - -remap: functions: uuid_from_friendly_id: { - category: "Random" - description: """ - Convert a Friendly ID (base62 encoding a 128-bit word) to a UUID. - """ - - arguments: [ - { - name: "value" - description: "A string that is a Friendly ID" - required: true - type: ["timestamp"] - }, - ] - internal_failure_reasons: [ - "`value` is a string but the text uses characters outside of class [0-9A-Za-z].", - "`value` is a base62 encoding of an integer, but the integer is greater than or equal to 2^128.", - ] - return: types: ["string"] - - examples: [ - { - title: "Convert a Friendly ID to a UUID" - source: #""" - uuid_from_friendly_id!("3s87yEvnmkiPBMHsj8bwwc") - """# - return: "7f41deed-d5e2-8b5e-7a13-ab4ff93cfad2" - }, - ] -} +{ + "remap": { + "functions": { + "uuid_from_friendly_id": { + "anchor": "uuid_from_friendly_id", + "name": "uuid_from_friendly_id", + "category": "Random", + "description": "Convert a Friendly ID (base62 encoding a 128-bit word) to a UUID.", + "arguments": [ + { + "name": "value", + "description": "A string that is a Friendly ID", + "required": true, + "type": [ + "string" + ] + } + ], + "return": { + "types": [ + "string" + ] + }, + "internal_failure_reasons": [ + "`value` is a string but the text uses characters outside of class [0-9A-Za-z].", + "`value` is a base62 encoding of an integer, but the integer is greater than or equal to 2^128." + ], + "examples": [ + { + "title": "Convert a Friendly ID to a UUID", + "source": "uuid_from_friendly_id!(\"3s87yEvnmkiPBMHsj8bwwc\")", + "return": "7f41deed-d5e2-8b5e-7a13-ab4ff93cfad2" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/uuid_v4.cue b/website/cue/reference/remap/functions/uuid_v4.cue index c6c4a7738fed0..1f142b0d4ed05 100644 --- a/website/cue/reference/remap/functions/uuid_v4.cue +++ b/website/cue/reference/remap/functions/uuid_v4.cue @@ -1,22 +1,26 @@ -package metadata - -remap: functions: uuid_v4: { - category: "Random" - description: """ - Generates a random [UUIDv4](\(urls.uuidv4)) string. - """ - - arguments: [] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Create a UUIDv4" - source: #""" - uuid_v4() - """# - return: "1d262f4f-199b-458d-879f-05fd0a5f0683" - }, - ] -} +{ + "remap": { + "functions": { + "uuid_v4": { + "anchor": "uuid_v4", + "name": "uuid_v4", + "category": "Random", + "description": "Generates a random [UUIDv4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) string.", + "arguments": [], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Create a UUIDv4", + "source": "uuid_v4()", + "return": "1d262f4f-199b-458d-879f-05fd0a5f0683" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/uuid_v7.cue b/website/cue/reference/remap/functions/uuid_v7.cue index 8b6be2040e871..74602505d9dd4 100644 --- a/website/cue/reference/remap/functions/uuid_v7.cue +++ b/website/cue/reference/remap/functions/uuid_v7.cue @@ -1,44 +1,46 @@ -package metadata - -remap: functions: uuid_v7: { - category: "Random" - description: """ - Generates a random [UUIDv7](\(urls.uuidv7)) string. - """ - - arguments: [ - { - name: "timestamp" - description: "The timestamp used to generate the UUIDv7." - required: false - type: ["timestamp"] - default: "`now()`" - }, - ] - internal_failure_reasons: [] - return: types: ["string"] - - examples: [ - { - title: "Create a UUIDv7 with implicit `now()`" - source: #""" - uuid_v7() - """# - return: "06338364-8305-7b74-8000-de4963503139" - }, - { - title: "Create a UUIDv7 with explicit `now()`" - source: #""" - uuid_v7(now()) - """# - return: "018e29b3-0bea-7f78-8af3-d32ccb1b93c1" - }, - { - title: "Create a UUIDv7 with custom timestamp" - source: #""" - uuid_v7(t'2020-12-30T22:20:53.824727Z') - """# - return: "0176b5bd-5d19-7394-bb60-c21028c6152b" - }, - ] -} +{ + "remap": { + "functions": { + "uuid_v7": { + "anchor": "uuid_v7", + "name": "uuid_v7", + "category": "Random", + "description": "Generates a random [UUIDv7](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#name-uuid-version-7) string.", + "arguments": [ + { + "name": "timestamp", + "description": "The timestamp used to generate the UUIDv7.", + "required": false, + "type": [ + "timestamp" + ], + "default": "`now()`" + } + ], + "return": { + "types": [ + "string" + ] + }, + "examples": [ + { + "title": "Create a UUIDv7 with implicit `now()`", + "source": "uuid_v7()", + "return": "0135ddb4-a444-794c-a7a2-088f260104c0" + }, + { + "title": "Create a UUIDv7 with explicit `now()`", + "source": "uuid_v7(now())", + "return": "0135ddb4-a444-794c-a7a2-088f260104c0" + }, + { + "title": "Create a UUIDv7 with custom timestamp", + "source": "uuid_v7(t'2020-12-30T22:20:53.824727Z')", + "return": "0176b5bd-5d19-794c-a7a2-088f260104c0" + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/validate_json_schema.cue b/website/cue/reference/remap/functions/validate_json_schema.cue index 314d6fdee8bca..c11683d9ed597 100644 --- a/website/cue/reference/remap/functions/validate_json_schema.cue +++ b/website/cue/reference/remap/functions/validate_json_schema.cue @@ -1,81 +1,79 @@ -package metadata - -remap: functions: validate_json_schema: { - category: "Type" - description: """ - Check if `value` conforms to a JSON Schema definition. This function validates a JSON payload against a JSON Schema definition. It can be used to ensure that the data structure and types in `value` match the expectations defined in `schema_definition`. - """ - notices: [ - """ - This function uses a compiled schema cache. The first time it is called with a specific `schema_definition`, it will compile the schema and cache it for subsequent calls. This improves performance when validating multiple values against the same schema. - The cache implementation is fairly naive and does not support refreshing the schema if it changes. If you update the schema definition file, you must restart Vector to clear the cache. - """, - ] - arguments: [ - { - name: "value" - description: #"The value to check if it conforms to the JSON schema definition."# - required: true - type: ["any"] - }, - { - name: "schema_definition" - description: #"The location (path) of the JSON Schema definition."# - required: true - type: ["any"] - }, - { - name: "ignore_unknown_formats" - description: #"Unknown formats can be silently ignored by setting this to `true` and validation continues without failing due to those fields."# - required: false - type: ["boolean"] - }, - - ] - internal_failure_reasons: [ - "`value` is not a valid JSON Schema payload.", - "`value` contains custom format declarations and `ignore_unknown_formats` has not been set to `true`.", - "`schema_definition` is not a valid JSON Schema definition.", - "`schema_definition` file does not exist.", - ] - return: { - types: ["boolean"] - rules: [ - #"Returns `true` if `value` conforms to the JSON Schema definition."#, - #"Returns `false` if `value` does not conform to the JSON Schema definition."#, - ] - } - - examples: [ - { - title: "Payload contains a valid email." - source: """ - validate_json_schema!(s'{ "productUser": "valid@email.com" }', "resources/json-schema_definition.json", false) - """ - return: true - }, - { - title: "Payload contains an invalid email." - source: """ - ok, _err = validate_json_schema(s'{ "productUser": "invalidEmail" }', "resources/json-schema_definition.json", false) - ok - """ - return: false - }, - { - title: "Payload contains a custom format declaration." - source: """ - ok, _err = validate_json_schema(s'{ "productUser": "a-custom-formatted-string" }', "resources/json-schema_definition.json", false) - ok - """ - return: false - }, - { - title: "Payload contains a custom format declaration, with ignore_unknown_formats set to true." - source: """ - validate_json_schema!(s'{ "productUser": "valid@email.com" }', "resources/json-schema_definition.json", true) - """ - return: true - }, - ] -} +{ + "remap": { + "functions": { + "validate_json_schema": { + "anchor": "validate_json_schema", + "name": "validate_json_schema", + "category": "Type", + "description": "Check if `value` conforms to a JSON Schema definition. This function validates a JSON payload against a JSON Schema definition. It can be used to ensure that the data structure and types in `value` match the expectations defined in `schema_definition`.", + "arguments": [ + { + "name": "value", + "description": "The value to check if it conforms to the JSON schema definition.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "schema_definition", + "description": "The location (path) of the JSON Schema definition.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "ignore_unknown_formats", + "description": "Unknown formats can be silently ignored by setting this to `true` and validation continues without failing due to those fields.", + "required": false, + "type": [ + "boolean" + ] + } + ], + "return": { + "types": [ + "boolean" + ], + "rules": [ + "Returns `true` if `value` conforms to the JSON Schema definition.", + "Returns `false` if `value` does not conform to the JSON Schema definition." + ] + }, + "internal_failure_reasons": [ + "`value` is not a valid JSON Schema payload.", + "`value` contains custom format declarations and `ignore_unknown_formats` has not been set to `true`.", + "`schema_definition` is not a valid JSON Schema definition.", + "`schema_definition` file does not exist." + ], + "examples": [ + { + "title": "Payload contains a valid email", + "source": "validate_json_schema!(s'{ \"productUser\": \"valid@email.com\" }', \"schema_with_email_format.json\", false)", + "return": true + }, + { + "title": "Payload contains an invalid email", + "source": "validate_json_schema!(s'{ \"productUser\": \"invalidEmail\" }', \"schema_with_email_format.json\", false)", + "raises": "function call error for \"validate_json_schema\" at (0:99): JSON schema validation failed: \"invalidEmail\" is not a \"email\" at /productUser" + }, + { + "title": "Payload contains a custom format declaration", + "source": "validate_json_schema!(s'{ \"productUser\": \"a-custom-formatted-string\" }', \"schema_with_custom_format.json\", false)", + "raises": "function call error for \"validate_json_schema\" at (0:113): Failed to compile schema: Unknown format: 'my-custom-format'. Adjust configuration to ignore unrecognized formats" + }, + { + "title": "Payload contains a custom format declaration, with ignore_unknown_formats set to true", + "source": "validate_json_schema!(s'{ \"productUser\": \"a-custom-formatted-string\" }', \"schema_with_custom_format.json\", true)", + "return": true + } + ], + "notices": [ + "This function uses a compiled schema cache. The first time it is called with a specific\n`schema_definition`, it will compile the schema and cache it for subsequent calls. This\nimproves performance when validating multiple values against the same schema. The cache\nimplementation is fairly naive and does not support refreshing the schema if it changes.\nIf you update the schema definition file, you must restart Vector to clear the cache." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/values.cue b/website/cue/reference/remap/functions/values.cue index 78586579b159d..16a056ba64a8e 100644 --- a/website/cue/reference/remap/functions/values.cue +++ b/website/cue/reference/remap/functions/values.cue @@ -1,37 +1,56 @@ -package metadata - -remap: functions: values: { - category: "Enumerate" - description: #""" - Returns the values from the object passed into the function. - """# - - arguments: [ - { - name: "value" - description: "The object to extract values from." - required: true - type: ["object"] - }, - ] - internal_failure_reasons: [] - return: { - types: ["array"] - rules: [ - #"Returns an array of all the values."#, - ] - } - examples: [ - { - title: "Get values from the object" - input: log: { - "key1": "val1" - "key2": "val2" - } - source: #""" - values({"key1": "val1", "key2": "val2"}) - """# - return: ["val1", "val2"] - }, - ] -} +{ + "remap": { + "functions": { + "values": { + "anchor": "values", + "name": "values", + "category": "Enumerate", + "description": "Returns the values from the object passed into the function.", + "arguments": [ + { + "name": "value", + "description": "The object to extract values from.", + "required": true, + "type": [ + "object" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "Returns an array of all the values." + ] + }, + "examples": [ + { + "title": "Get values from the object", + "source": "values({\"key1\": \"val1\", \"key2\": \"val2\"})", + "return": [ + "val1", + "val2" + ] + }, + { + "title": "Get values from a complex object", + "source": "values({\"key1\": \"val1\", \"key2\": [1, 2, 3], \"key3\": {\"foo\": \"bar\"}})", + "return": [ + "val1", + [ + 1, + 2, + 3 + ], + { + "foo": "bar" + } + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/xxhash.cue b/website/cue/reference/remap/functions/xxhash.cue index f420bf9f80410..d3dc5a0a40220 100644 --- a/website/cue/reference/remap/functions/xxhash.cue +++ b/website/cue/reference/remap/functions/xxhash.cue @@ -1,65 +1,68 @@ -package metadata - -remap: functions: xxhash: { - category: "Checksum" - description: """ - Calculates a [xxHash](\(urls.xxhash_rust)) hash of the `value`. - **Note**: Due to limitations in the underlying VRL data types, this function converts the unsigned 64-bit integer hash result to a signed 64-bit integer. Results higher than the signed 64-bit integer maximum value wrap around to negative values. For the XXH3-128 hash algorithm, values are returned as a string. - """ - - arguments: [ - { - name: "value" - description: "The string to calculate the hash for." - required: true - type: ["string"] - }, - { - name: "variant" - description: "The xxHash hashing algorithm to use." - required: false - type: ["string"] - default: "XXH32" - }, - ] - internal_failure_reasons: [] - return: types: ["integer", "string"] - - examples: [ - { - title: "Calculate a hash using the default (XXH32) algorithm" - source: #""" - xxhash("foo") - """# - return: 3792637401 - }, - { - title: "Calculate a hash using the XXH32 algorithm" - source: #""" - xxhash("foo", "XXH32") - """# - return: 3792637401 - }, - { - title: "Calculate a hash using the XXH64 algorithm" - source: #""" - xxhash("foo", "XXH64") - """# - return: 3728699739546630719 - }, - { - title: "Calculate a hash using the XXH3-64 algorithm" - source: #""" - xxhash("foo", "XXH3-64") - """# - return: -6093828362558603894 - }, - { - title: "Calculate a hash using the XXH3-128 algorithm" - source: #""" - xxhash("foo", "XXH3-128") - """# - return: "161745101148472925293886522910304009610" - }, - ] -} +{ + "remap": { + "functions": { + "xxhash": { + "anchor": "xxhash", + "name": "xxhash", + "category": "Checksum", + "description": "Calculates a [xxHash](https://github.com/DoumanAsh/xxhash-rust) hash of the `value`.", + "arguments": [ + { + "name": "value", + "description": "The string to calculate the hash for.", + "required": true, + "type": [ + "string" + ] + }, + { + "name": "variant", + "description": "The xxHash hashing algorithm to use.", + "required": false, + "type": [ + "string" + ], + "default": "XXH32" + } + ], + "return": { + "types": [ + "string", + "integer" + ] + }, + "examples": [ + { + "title": "Calculate a hash using the default (XXH32) algorithm", + "source": "xxhash(\"foo\")", + "return": 3792637401 + }, + { + "title": "Calculate a hash using the XXH32 algorithm", + "source": "xxhash(\"foo\", \"XXH32\")", + "return": 3792637401 + }, + { + "title": "Calculate a hash using the XXH64 algorithm", + "source": "xxhash(\"foo\", \"XXH64\")", + "return": 3728699739546630719 + }, + { + "title": "Calculate a hash using the XXH3-64 algorithm", + "source": "xxhash(\"foo\", \"XXH3-64\")", + "return": -6093828362558603894 + }, + { + "title": "Calculate a hash using the XXH3-128 algorithm", + "source": "xxhash(\"foo\", \"XXH3-128\")", + "return": "161745101148472925293886522910304009610" + } + ], + "notices": [ + "Due to limitations in the underlying VRL data types, this function converts the unsigned\n64-bit integer hash result to a signed 64-bit integer. Results higher than the signed\n64-bit integer maximum value wrap around to negative values. For the XXH3-128 hash\nalgorithm, values are returned as a string." + ], + "pure": true + } + } + } +} \ No newline at end of file diff --git a/website/cue/reference/remap/functions/zip.cue b/website/cue/reference/remap/functions/zip.cue index 90f5e7927596f..36bf480d9df5c 100644 --- a/website/cue/reference/remap/functions/zip.cue +++ b/website/cue/reference/remap/functions/zip.cue @@ -1,55 +1,117 @@ -package metadata - -remap: functions: zip: { - category: "Array" - description: """ - Iterate over several arrays in parallel, producing a new array containing arrays of items from each source. - The resulting array will be as long as the shortest input array, with all the remaining elements dropped. - This function is modeled from the `zip` function [in Python](https://docs.python.org/3/library/functions.html#zip), - but similar methods can be found in [Ruby](https://docs.ruby-lang.org/en/master/Array.html#method-i-zip) - and [Rust](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.zip). - - If a single parameter is given, it must contain an array of all the input arrays. - """ - - arguments: [ - { - name: "array_0" - description: "The first array of elements, or the array of input arrays if no other parameter is present." - required: true - type: ["array"] - }, - { - name: "array_1" - description: "The second array of elements. If not present, the first parameter contains all the arrays." - required: false - type: ["array"] - }, - ] - internal_failure_reasons: [ - "`array_0` and `array_1` must be arrays.", - ] - return: { - types: ["array"] - rules: [ - "`zip` is considered fallible if any of the parameters is not an array, or if only the first parameter is present and it is not an array of arrays.", - ] - } - - examples: [ - { - title: "Merge two arrays" - source: #""" - zip([1, 2, 3], [4, 5, 6, 7]) - """# - return: [[1, 4], [2, 5], [3, 6]] - }, - { - title: "Merge three arrays" - source: #""" - zip([[1, 2], [3, 4], [5, 6]]) - """# - return: [[1, 3, 5], [2, 4, 6]] - }, - ] -} +{ + "remap": { + "functions": { + "zip": { + "anchor": "zip", + "name": "zip", + "category": "Array", + "description": "Iterate over several arrays in parallel, producing a new array containing arrays of items from each source.\nThe resulting array will be as long as the shortest input array, with all the remaining elements dropped.\nThis function is modeled from the `zip` function [in Python](https://docs.python.org/3/library/functions.html#zip),\nbut similar methods can be found in [Ruby](https://docs.ruby-lang.org/en/master/Array.html#method-i-zip)\nand [Rust](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.zip).\n\nIf a single parameter is given, it must contain an array of all the input arrays.", + "arguments": [ + { + "name": "array_0", + "description": "The first array of elements, or the array of input arrays if no other parameter is present.", + "required": true, + "type": [ + "array" + ] + }, + { + "name": "array_1", + "description": "The second array of elements. If not present, the first parameter contains all the arrays.", + "required": false, + "type": [ + "array" + ] + } + ], + "return": { + "types": [ + "array" + ], + "rules": [ + "`zip` is considered fallible if any of the parameters is not an array, or if only the first parameter is present and it is not an array of arrays." + ] + }, + "internal_failure_reasons": [ + "`array_0` and `array_1` must be arrays." + ], + "examples": [ + { + "title": "Merge two arrays", + "source": "zip([1, 2, 3], [4, 5, 6, 7])", + "return": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ] + }, + { + "title": "Merge three arrays", + "source": "zip([[1, 2], [3, 4], [5, 6]])", + "return": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ] + }, + { + "title": "Merge an array of three arrays into an array of 3-tuples", + "source": "zip([[\"a\", \"b\", \"c\"], [1, null, true], [4, 5, 6]])", + "return": [ + [ + "a", + 1, + 4 + ], + [ + "b", + null, + 5 + ], + [ + "c", + true, + 6 + ] + ] + }, + { + "title": "Merge two array parameters", + "source": "zip([1, 2, 3, 4], [5, 6, 7])", + "return": [ + [ + 1, + 5 + ], + [ + 2, + 6 + ], + [ + 3, + 7 + ] + ] + } + ], + "pure": true + } + } + } +} \ No newline at end of file From ad2a14b72f3f0a9a1c2e63660126e098bf2cbd39 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 15:40:09 -0500 Subject: [PATCH 23/44] Format json using 4 spaces instead of 2 --- vdev/src/commands/build/vrl_docs.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 1ec39459ae98c..de9b26e031cff 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -1,5 +1,7 @@ use anyhow::Result; use serde::Serialize; +use serde_json::Serializer; +use serde_json::ser::PrettyFormatter; use std::{collections::HashMap, fs, path::PathBuf}; use vrl::compiler::Function; use vrl::compiler::value::kind; @@ -97,7 +99,18 @@ impl Cli { }, }; - let json = serde_json::to_string_pretty(&wrapper)?; + // Unrolling of `serde_json::to_string_pretty` but using 4 space indents instead + let mut vec = Vec::with_capacity(128); + // Define 4 spaces + let indent = b" "; + let formatter = PrettyFormatter::with_indent(indent); + let mut serializer = Serializer::with_formatter(&mut vec, formatter); + + wrapper.serialize(&mut serializer)?; + + // Safe to expect - serde_json even uses from_utf8_unchecked here + let json = String::from_utf8(vec).expect("Invalid UTF-8 serialized"); + fs::write(&filepath, json)?; println!("Generated: {}", filepath.display()); From cc139f5bc05b9f3d4039c31fea3d35668a1fefd3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 15:44:52 -0500 Subject: [PATCH 24/44] Ignore VRL generated docs from cue fmt --- scripts/cue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/cue.sh b/scripts/cue.sh index 6a1b499a1afe5..f161e26a19ef0 100755 --- a/scripts/cue.sh +++ b/scripts/cue.sh @@ -24,7 +24,8 @@ cmd_list() { } cmd_fmt() { - list-docs-files | xargs cue fmt "$@" + # Ignore JSON-style cue files generated from VRL source code + list-docs-files | grep -v "${CUE_SOURCES}/reference/remap/functions/" | xargs cue fmt "$@" } cmd_vet() { From ad035c83c6fc68e41dd96999a403fc8ccb54c6d4 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 15:44:58 -0500 Subject: [PATCH 25/44] Revert "Format json using 4 spaces instead of 2" This reverts commit ad2a14b72f3f0a9a1c2e63660126e098bf2cbd39. --- vdev/src/commands/build/vrl_docs.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index de9b26e031cff..1ec39459ae98c 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -1,7 +1,5 @@ use anyhow::Result; use serde::Serialize; -use serde_json::Serializer; -use serde_json::ser::PrettyFormatter; use std::{collections::HashMap, fs, path::PathBuf}; use vrl::compiler::Function; use vrl::compiler::value::kind; @@ -99,18 +97,7 @@ impl Cli { }, }; - // Unrolling of `serde_json::to_string_pretty` but using 4 space indents instead - let mut vec = Vec::with_capacity(128); - // Define 4 spaces - let indent = b" "; - let formatter = PrettyFormatter::with_indent(indent); - let mut serializer = Serializer::with_formatter(&mut vec, formatter); - - wrapper.serialize(&mut serializer)?; - - // Safe to expect - serde_json even uses from_utf8_unchecked here - let json = String::from_utf8(vec).expect("Invalid UTF-8 serialized"); - + let json = serde_json::to_string_pretty(&wrapper)?; fs::write(&filepath, json)?; println!("Generated: {}", filepath.display()); From ee95f012c7543b2be90c52bfeb07cfd3ef21805c Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 23 Feb 2026 15:47:15 -0500 Subject: [PATCH 26/44] Push newline at the end of generated json --- vdev/src/commands/build/vrl_docs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 1ec39459ae98c..59d1d1d4e8da5 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -97,7 +97,9 @@ impl Cli { }, }; - let json = serde_json::to_string_pretty(&wrapper)?; + let mut json = serde_json::to_string_pretty(&wrapper)?; + json.push_str("\n"); + fs::write(&filepath, json)?; println!("Generated: {}", filepath.display()); From 92eefbca19dd023fea0968cf1a348855f126c457 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:03:28 -0500 Subject: [PATCH 27/44] Bump VRL --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 0560958b51893..8cb02c8e42eae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13109,7 +13109,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#c4afddc9d18cc368796686c312cd87d90d3c8808" +source = "git+https://github.com/vectordotdev/vrl.git?branch=main#74f9a58fea5ea39f53c614fb4a5d7521b85c0a46" dependencies = [ "aes", "aes-siv", From 76cd0c9360e71659e6a2be4507e81801ad62cf93 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:10:08 -0500 Subject: [PATCH 28/44] Add preserve_order to keep doc generation consistent --- vdev/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index 0b06c55bb65cf..4ad605caf37d0 100644 --- a/vdev/Cargo.toml +++ b/vdev/Cargo.toml @@ -35,7 +35,7 @@ paste.workspace = true regex.workspace = true reqwest = { workspace = true, features = ["blocking"] } serde.workspace = true -serde_json.workspace = true +serde_json = { workspace = true, features = ["preserve_order"] } serde_yaml.workspace = true sha2 = "0.10.9" tempfile.workspace = true From 0782eabe333cf0b102ee3fbed72af9674356097e Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:15:36 -0500 Subject: [PATCH 29/44] Render input --- vdev/src/commands/build/vrl_docs.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 59d1d1d4e8da5..d2193220c4d66 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -4,8 +4,8 @@ use std::{collections::HashMap, fs, path::PathBuf}; use vrl::compiler::Function; use vrl::compiler::value::kind; use vrl::core::Value; -use vrl::prelude::Parameter; use vrl::prelude::function::EnumVariant; +use vrl::prelude::{Example, Parameter}; /// Generate VRL function documentation as JSON files. /// @@ -71,6 +71,8 @@ struct ExampleDoc { title: String, source: String, #[serde(skip_serializing_if = "Option::is_none")] + input: Option, + #[serde(skip_serializing_if = "Option::is_none")] r#return: Option, #[serde(skip_serializing_if = "Option::is_none")] raises: Option, @@ -153,7 +155,16 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { .examples() .iter() .map(|example| { - let (r#return, raises) = match &example.result { + let Example { + title, + source, + result, + input, + file: _, + line: _, + } = example; + + let (r#return, raises) = match result { Ok(result) => { // Try to parse as JSON, otherwise treat as string let value = serde_json::from_str(result) @@ -163,11 +174,13 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { Err(error) => (None, Some(error.to_string())), }; - let source = example.source.to_string(); - let title = example.title.to_string(); + let source = source.to_string(); + let title = title.to_string(); + let input = input.map(String::from); ExampleDoc { title, source, + input, r#return, raises, } From 1fad561f84ed8f89199aa9df20ead095da59871f Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:15:55 -0500 Subject: [PATCH 30/44] Regenerate docs --- website/cue/reference/remap/functions/abs.cue | 2 +- .../functions/aggregate_vector_metrics.cue | 8 +- .../cue/reference/remap/functions/append.cue | 2 +- .../cue/reference/remap/functions/array.cue | 5 +- .../cue/reference/remap/functions/assert.cue | 2 +- .../reference/remap/functions/assert_eq.cue | 2 +- .../reference/remap/functions/basename.cue | 2 +- .../cue/reference/remap/functions/bool.cue | 5 +- .../reference/remap/functions/camelcase.cue | 6 +- .../cue/reference/remap/functions/ceil.cue | 2 +- .../cue/reference/remap/functions/chunks.cue | 2 +- .../remap/functions/community_id.cue | 2 +- .../cue/reference/remap/functions/compact.cue | 2 +- .../reference/remap/functions/contains.cue | 2 +- .../remap/functions/contains_all.cue | 2 +- website/cue/reference/remap/functions/crc.cue | 190 +++++++++--------- .../remap/functions/decode_base16.cue | 2 +- .../remap/functions/decode_base64.cue | 6 +- .../remap/functions/decode_charset.cue | 2 +- .../reference/remap/functions/decode_gzip.cue | 2 +- .../reference/remap/functions/decode_lz4.cue | 2 +- .../remap/functions/decode_mime_q.cue | 2 +- .../remap/functions/decode_percent.cue | 2 +- .../remap/functions/decode_punycode.cue | 2 +- .../remap/functions/decode_snappy.cue | 2 +- .../reference/remap/functions/decode_zlib.cue | 2 +- .../reference/remap/functions/decode_zstd.cue | 2 +- .../cue/reference/remap/functions/decrypt.cue | 2 +- .../reference/remap/functions/decrypt_ip.cue | 2 +- website/cue/reference/remap/functions/del.cue | 6 +- .../cue/reference/remap/functions/dirname.cue | 2 +- .../reference/remap/functions/dns_lookup.cue | 7 +- .../reference/remap/functions/downcase.cue | 2 +- .../remap/functions/encode_base16.cue | 2 +- .../remap/functions/encode_base64.cue | 6 +- .../remap/functions/encode_charset.cue | 4 +- .../reference/remap/functions/encode_gzip.cue | 2 +- .../reference/remap/functions/encode_json.cue | 2 +- .../remap/functions/encode_key_value.cue | 2 +- .../remap/functions/encode_logfmt.cue | 2 +- .../reference/remap/functions/encode_lz4.cue | 2 +- .../remap/functions/encode_percent.cue | 14 +- .../remap/functions/encode_proto.cue | 2 +- .../remap/functions/encode_punycode.cue | 2 +- .../remap/functions/encode_snappy.cue | 2 +- .../reference/remap/functions/encode_zlib.cue | 2 +- .../reference/remap/functions/encode_zstd.cue | 2 +- .../cue/reference/remap/functions/encrypt.cue | 2 +- .../reference/remap/functions/encrypt_ip.cue | 2 +- .../reference/remap/functions/ends_with.cue | 2 +- .../cue/reference/remap/functions/exists.cue | 2 +- .../cue/reference/remap/functions/filter.cue | 2 +- .../cue/reference/remap/functions/find.cue | 2 +- .../find_enrichment_table_records.cue | 18 +- .../remap/functions/find_vector_metrics.cue | 6 +- .../cue/reference/remap/functions/flatten.cue | 2 +- .../cue/reference/remap/functions/float.cue | 2 +- .../cue/reference/remap/functions/floor.cue | 2 +- .../reference/remap/functions/for_each.cue | 2 +- .../reference/remap/functions/format_int.cue | 2 +- .../remap/functions/format_number.cue | 2 +- .../remap/functions/format_timestamp.cue | 2 +- .../remap/functions/from_unix_timestamp.cue | 6 +- website/cue/reference/remap/functions/get.cue | 5 +- .../functions/get_enrichment_table_record.cue | 8 +- .../reference/remap/functions/get_env_var.cue | 2 +- .../remap/functions/get_hostname.cue | 2 +- .../reference/remap/functions/get_secret.cue | 2 +- .../remap/functions/get_timezone_name.cue | 2 +- .../remap/functions/get_vector_metric.cue | 6 +- .../reference/remap/functions/haversine.cue | 14 +- .../cue/reference/remap/functions/hmac.cue | 6 +- .../remap/functions/http_request.cue | 7 +- .../reference/remap/functions/includes.cue | 2 +- website/cue/reference/remap/functions/int.cue | 2 +- .../cue/reference/remap/functions/ip_aton.cue | 2 +- .../remap/functions/ip_cidr_contains.cue | 2 +- .../cue/reference/remap/functions/ip_ntoa.cue | 2 +- .../cue/reference/remap/functions/ip_ntop.cue | 2 +- .../cue/reference/remap/functions/ip_pton.cue | 2 +- .../reference/remap/functions/ip_subnet.cue | 2 +- .../reference/remap/functions/ip_to_ipv6.cue | 2 +- .../remap/functions/ipv6_to_ipv4.cue | 2 +- .../reference/remap/functions/is_array.cue | 2 +- .../reference/remap/functions/is_boolean.cue | 2 +- .../reference/remap/functions/is_empty.cue | 2 +- .../reference/remap/functions/is_float.cue | 2 +- .../reference/remap/functions/is_integer.cue | 2 +- .../cue/reference/remap/functions/is_ipv4.cue | 2 +- .../cue/reference/remap/functions/is_ipv6.cue | 2 +- .../cue/reference/remap/functions/is_json.cue | 10 +- .../cue/reference/remap/functions/is_null.cue | 2 +- .../reference/remap/functions/is_nullish.cue | 2 +- .../reference/remap/functions/is_object.cue | 2 +- .../reference/remap/functions/is_regex.cue | 2 +- .../reference/remap/functions/is_string.cue | 2 +- .../remap/functions/is_timestamp.cue | 2 +- .../cue/reference/remap/functions/join.cue | 2 +- .../reference/remap/functions/kebabcase.cue | 8 +- .../cue/reference/remap/functions/keys.cue | 2 +- .../cue/reference/remap/functions/length.cue | 2 +- website/cue/reference/remap/functions/log.cue | 10 +- .../reference/remap/functions/map_keys.cue | 6 +- .../reference/remap/functions/map_values.cue | 6 +- .../cue/reference/remap/functions/match.cue | 2 +- .../reference/remap/functions/match_any.cue | 2 +- .../reference/remap/functions/match_array.cue | 2 +- .../remap/functions/match_datadog_query.cue | 2 +- website/cue/reference/remap/functions/md5.cue | 2 +- .../cue/reference/remap/functions/merge.cue | 2 +- website/cue/reference/remap/functions/mod.cue | 2 +- website/cue/reference/remap/functions/now.cue | 2 +- .../cue/reference/remap/functions/object.cue | 2 +- .../remap/functions/object_from_array.cue | 2 +- .../remap/functions/parse_apache_log.cue | 4 +- .../remap/functions/parse_aws_alb_log.cue | 2 +- ...ws_cloudwatch_log_subscription_message.cue | 2 +- .../functions/parse_aws_vpc_flow_log.cue | 26 +-- .../reference/remap/functions/parse_bytes.cue | 22 +- .../reference/remap/functions/parse_cbor.cue | 2 +- .../reference/remap/functions/parse_cef.cue | 76 +++---- .../remap/functions/parse_common_log.cue | 2 +- .../reference/remap/functions/parse_csv.cue | 2 +- .../remap/functions/parse_dnstap.cue | 8 +- .../remap/functions/parse_duration.cue | 14 +- .../reference/remap/functions/parse_etld.cue | 2 +- .../reference/remap/functions/parse_float.cue | 2 +- .../reference/remap/functions/parse_glog.cue | 2 +- .../reference/remap/functions/parse_grok.cue | 6 +- .../reference/remap/functions/parse_groks.cue | 6 +- .../remap/functions/parse_influxdb.cue | 52 ++--- .../reference/remap/functions/parse_int.cue | 2 +- .../reference/remap/functions/parse_json.cue | 2 +- .../remap/functions/parse_key_value.cue | 34 ++-- .../reference/remap/functions/parse_klog.cue | 2 +- .../functions/parse_linux_authorization.cue | 2 +- .../remap/functions/parse_logfmt.cue | 16 +- .../remap/functions/parse_nginx_log.cue | 6 +- .../reference/remap/functions/parse_proto.cue | 2 +- .../remap/functions/parse_query_string.cue | 6 +- .../reference/remap/functions/parse_regex.cue | 2 +- .../remap/functions/parse_regex_all.cue | 22 +- .../remap/functions/parse_ruby_hash.cue | 2 +- .../remap/functions/parse_syslog.cue | 2 +- .../remap/functions/parse_timestamp.cue | 2 +- .../remap/functions/parse_tokens.cue | 2 +- .../reference/remap/functions/parse_url.cue | 2 +- .../remap/functions/parse_user_agent.cue | 6 +- .../reference/remap/functions/parse_xml.cue | 2 +- .../reference/remap/functions/pascalcase.cue | 6 +- website/cue/reference/remap/functions/pop.cue | 2 +- .../cue/reference/remap/functions/push.cue | 2 +- .../reference/remap/functions/random_bool.cue | 2 +- .../remap/functions/random_bytes.cue | 2 +- .../remap/functions/random_float.cue | 2 +- .../reference/remap/functions/random_int.cue | 2 +- .../cue/reference/remap/functions/redact.cue | 2 +- .../cue/reference/remap/functions/remove.cue | 5 +- .../remap/functions/remove_secret.cue | 2 +- .../cue/reference/remap/functions/replace.cue | 2 +- .../remap/functions/replace_with.cue | 2 +- .../reference/remap/functions/reverse_dns.cue | 2 +- .../cue/reference/remap/functions/round.cue | 2 +- .../remap/functions/screamingsnakecase.cue | 10 +- .../cue/reference/remap/functions/seahash.cue | 2 +- website/cue/reference/remap/functions/set.cue | 13 +- .../reference/remap/functions/set_secret.cue | 2 +- .../remap/functions/set_semantic_meaning.cue | 2 +- .../cue/reference/remap/functions/sha1.cue | 2 +- .../cue/reference/remap/functions/sha2.cue | 10 +- .../cue/reference/remap/functions/sha3.cue | 6 +- .../remap/functions/shannon_entropy.cue | 6 +- .../cue/reference/remap/functions/sieve.cue | 2 +- .../cue/reference/remap/functions/slice.cue | 2 +- .../reference/remap/functions/snakecase.cue | 16 +- .../cue/reference/remap/functions/split.cue | 2 +- .../reference/remap/functions/split_path.cue | 2 +- .../reference/remap/functions/starts_with.cue | 2 +- .../cue/reference/remap/functions/string.cue | 2 +- .../functions/strip_ansi_escape_codes.cue | 2 +- .../remap/functions/strip_whitespace.cue | 2 +- .../cue/reference/remap/functions/strlen.cue | 2 +- .../remap/functions/tag_types_externally.cue | 2 +- .../cue/reference/remap/functions/tally.cue | 6 +- .../reference/remap/functions/tally_value.cue | 2 +- .../reference/remap/functions/timestamp.cue | 2 +- .../cue/reference/remap/functions/to_bool.cue | 2 +- .../reference/remap/functions/to_float.cue | 2 +- .../cue/reference/remap/functions/to_int.cue | 2 +- .../reference/remap/functions/to_regex.cue | 2 +- .../reference/remap/functions/to_string.cue | 2 +- .../remap/functions/to_syslog_facility.cue | 2 +- .../functions/to_syslog_facility_code.cue | 2 +- .../remap/functions/to_syslog_level.cue | 2 +- .../remap/functions/to_syslog_severity.cue | 2 +- .../remap/functions/to_unix_timestamp.cue | 2 +- .../reference/remap/functions/truncate.cue | 2 +- .../reference/remap/functions/type_def.cue | 2 +- .../reference/remap/functions/unflatten.cue | 2 +- .../cue/reference/remap/functions/unique.cue | 2 +- .../cue/reference/remap/functions/unnest.cue | 10 +- .../cue/reference/remap/functions/upcase.cue | 2 +- .../remap/functions/uuid_from_friendly_id.cue | 2 +- .../cue/reference/remap/functions/uuid_v4.cue | 2 +- .../cue/reference/remap/functions/uuid_v7.cue | 2 +- .../remap/functions/validate_json_schema.cue | 2 +- .../cue/reference/remap/functions/values.cue | 2 +- .../cue/reference/remap/functions/xxhash.cue | 2 +- website/cue/reference/remap/functions/zip.cue | 2 +- 209 files changed, 547 insertions(+), 536 deletions(-) diff --git a/website/cue/reference/remap/functions/abs.cue b/website/cue/reference/remap/functions/abs.cue index b655dc2a520dc..e20abf0c3a307 100644 --- a/website/cue/reference/remap/functions/abs.cue +++ b/website/cue/reference/remap/functions/abs.cue @@ -47,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue index 79a420c04f90e..18221b26fd2c9 100644 --- a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue +++ b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue @@ -15,10 +15,10 @@ "string" ], "enum": { - "avg": "Find the average of the values of all the matched metrics.", - "min": "Find the lowest metric value of all the matched metrics.", + "max": "Find the highest metric value of all the matched metrics.", "sum": "Sum the values of all the matched metrics.", - "max": "Find the highest metric value of all the matched metrics." + "min": "Find the lowest metric value of all the matched metrics.", + "avg": "Find the average of the values of all the matched metrics." } }, { @@ -76,4 +76,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/append.cue b/website/cue/reference/remap/functions/append.cue index 8424c243df174..db2d3391afacf 100644 --- a/website/cue/reference/remap/functions/append.cue +++ b/website/cue/reference/remap/functions/append.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/array.cue b/website/cue/reference/remap/functions/array.cue index a1c6d6d248296..bfe95f1a9635b 100644 --- a/website/cue/reference/remap/functions/array.cue +++ b/website/cue/reference/remap/functions/array.cue @@ -31,7 +31,8 @@ "examples": [ { "title": "Declare an array type", - "source": ".value = [1, 2, 3]\narray(.value)\n", + "source": "array!(.value)", + "input": "{\"value\": [1, 2, 3]}", "return": [ 1, 2, @@ -57,4 +58,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/assert.cue b/website/cue/reference/remap/functions/assert.cue index 2828046db1a9f..52c483b25b088 100644 --- a/website/cue/reference/remap/functions/assert.cue +++ b/website/cue/reference/remap/functions/assert.cue @@ -56,4 +56,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/assert_eq.cue b/website/cue/reference/remap/functions/assert_eq.cue index 3e1762e277293..eaf36428a797b 100644 --- a/website/cue/reference/remap/functions/assert_eq.cue +++ b/website/cue/reference/remap/functions/assert_eq.cue @@ -61,4 +61,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/basename.cue b/website/cue/reference/remap/functions/basename.cue index ec2fa08ce954a..b45436b443c35 100644 --- a/website/cue/reference/remap/functions/basename.cue +++ b/website/cue/reference/remap/functions/basename.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/bool.cue b/website/cue/reference/remap/functions/bool.cue index c779e843965ff..d5793bce12b72 100644 --- a/website/cue/reference/remap/functions/bool.cue +++ b/website/cue/reference/remap/functions/bool.cue @@ -41,7 +41,8 @@ }, { "title": "Valid Boolean from path", - "source": ". = { \"value\": true }\nbool(.value)\n", + "source": "bool!(.value)", + "input": "{ \"value\": true }", "return": true } ], @@ -49,4 +50,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/camelcase.cue b/website/cue/reference/remap/functions/camelcase.cue index 1a7b10686530d..77da51e416384 100644 --- a/website/cue/reference/remap/functions/camelcase.cue +++ b/website/cue/reference/remap/functions/camelcase.cue @@ -23,10 +23,10 @@ "string" ], "enum": { + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)" } } @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ceil.cue b/website/cue/reference/remap/functions/ceil.cue index e2a042f13a2dc..d14083903968f 100644 --- a/website/cue/reference/remap/functions/ceil.cue +++ b/website/cue/reference/remap/functions/ceil.cue @@ -56,4 +56,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/chunks.cue b/website/cue/reference/remap/functions/chunks.cue index ed24a124214bf..77ba3c9a62c62 100644 --- a/website/cue/reference/remap/functions/chunks.cue +++ b/website/cue/reference/remap/functions/chunks.cue @@ -58,4 +58,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/community_id.cue b/website/cue/reference/remap/functions/community_id.cue index e964a2ee9930a..589191facfd06 100644 --- a/website/cue/reference/remap/functions/community_id.cue +++ b/website/cue/reference/remap/functions/community_id.cue @@ -87,4 +87,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/compact.cue b/website/cue/reference/remap/functions/compact.cue index 66f8196da4847..e49d043b3429f 100644 --- a/website/cue/reference/remap/functions/compact.cue +++ b/website/cue/reference/remap/functions/compact.cue @@ -129,4 +129,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/contains.cue b/website/cue/reference/remap/functions/contains.cue index 755d5ab52febf..a003374bd12e6 100644 --- a/website/cue/reference/remap/functions/contains.cue +++ b/website/cue/reference/remap/functions/contains.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/contains_all.cue b/website/cue/reference/remap/functions/contains_all.cue index 0f371c867acfe..70980a0613ba4 100644 --- a/website/cue/reference/remap/functions/contains_all.cue +++ b/website/cue/reference/remap/functions/contains_all.cue @@ -58,4 +58,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/crc.cue b/website/cue/reference/remap/functions/crc.cue index 79735b25c7c30..a912420ee832e 100644 --- a/website/cue/reference/remap/functions/crc.cue +++ b/website/cue/reference/remap/functions/crc.cue @@ -23,118 +23,118 @@ "string" ], "enum": { - "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", - "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", - "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", - "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", - "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard", - "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", - "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", - "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", - "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", - "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", - "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", - "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities", - "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", + "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols", + "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", "CRC_8_I_CODE": "8-bit CRC used in I-CODE RFID systems", - "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", + "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", + "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication", + "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", + "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard", + "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", + "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", + "CRC_64_WE": "64-bit CRC variant for wide-area error detection", + "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_16_USB": "16-bit CRC used in USB communication for error detection", + "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", + "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol", "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication", + "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", + "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks", - "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", - "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", - "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards", - "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", - "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", - "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", + "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity", - "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", - "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", - "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks", - "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", - "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)", - "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", - "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards", - "CRC_32_XFER": "32-bit CRC used in data transfer protocols", - "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", + "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", + "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", + "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard", - "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", - "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", - "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", - "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", + "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", + "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication", + "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format", - "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", + "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", + "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", + "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", + "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", + "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", + "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", + "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", + "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", + "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", + "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", + "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", + "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks", + "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards", + "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications", + "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", + "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", + "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", "CRC_16_ARC": "16-bit CRC used in ARC (Adaptive Routing Code) communication", - "CRC_16_USB": "16-bit CRC used in USB communication for error detection", - "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol", - "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", + "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", + "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", + "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", + "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", + "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", + "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)", - "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", - "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols", "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems", - "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", - "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", - "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", - "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", - "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", - "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", - "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", - "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication", - "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", - "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", - "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", - "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", - "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", - "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications", - "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", - "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", - "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", - "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", - "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", - "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", - "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", + "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", + "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", + "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", "CRC_16_DDS_110": "16-bit CRC used in DDS (Digital Data Storage) standard", - "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", - "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity", - "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", - "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", - "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", - "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", - "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", - "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", - "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems", "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications", - "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection", - "CRC_64_WE": "64-bit CRC variant for wide-area error detection", + "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities", + "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", + "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", + "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", + "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", + "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", + "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", + "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", + "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", + "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", + "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication", + "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications", - "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", - "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", + "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", + "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", + "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", + "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", + "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", + "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", "CRC_16_IBM_SDLC": "16-bit CRC used in IBM SDLC (Synchronous Data Link Control)", - "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", - "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", + "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard", + "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol", + "CRC_32_XFER": "32-bit CRC used in data transfer protocols", + "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", + "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", + "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", + "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", + "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", + "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", + "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", "CRC_30_CDMA": "30-bit CRC used in CDMA (Code Division Multiple Access) communication standard", - "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication", - "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", - "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", - "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", - "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", - "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", - "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol" + "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)", + "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", + "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", + "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", + "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", + "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection", + "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards" }, "default": "CRC_32_ISO_HDLC" } @@ -164,4 +164,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_base16.cue b/website/cue/reference/remap/functions/decode_base16.cue index 249199bf6e9f4..8d86242aeb942 100644 --- a/website/cue/reference/remap/functions/decode_base16.cue +++ b/website/cue/reference/remap/functions/decode_base16.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_base64.cue b/website/cue/reference/remap/functions/decode_base64.cue index 723a6703fc6b1..491c27d9255db 100644 --- a/website/cue/reference/remap/functions/decode_base64.cue +++ b/website/cue/reference/remap/functions/decode_base64.cue @@ -23,8 +23,8 @@ "string" ], "enum": { - "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications).", - "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format." + "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format.", + "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications)." }, "default": "standard" } @@ -53,4 +53,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_charset.cue b/website/cue/reference/remap/functions/decode_charset.cue index e1fb19ffbd220..75a113664fea9 100644 --- a/website/cue/reference/remap/functions/decode_charset.cue +++ b/website/cue/reference/remap/functions/decode_charset.cue @@ -53,4 +53,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_gzip.cue b/website/cue/reference/remap/functions/decode_gzip.cue index 0d695ff8a930c..321f955e80e63 100644 --- a/website/cue/reference/remap/functions/decode_gzip.cue +++ b/website/cue/reference/remap/functions/decode_gzip.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_lz4.cue b/website/cue/reference/remap/functions/decode_lz4.cue index 37bae74042685..60d230130127c 100644 --- a/website/cue/reference/remap/functions/decode_lz4.cue +++ b/website/cue/reference/remap/functions/decode_lz4.cue @@ -61,4 +61,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_mime_q.cue b/website/cue/reference/remap/functions/decode_mime_q.cue index 5612ffd7a6c7a..8a6ee5810124b 100644 --- a/website/cue/reference/remap/functions/decode_mime_q.cue +++ b/website/cue/reference/remap/functions/decode_mime_q.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_percent.cue b/website/cue/reference/remap/functions/decode_percent.cue index bd4c5d42102db..e659cbadd104b 100644 --- a/website/cue/reference/remap/functions/decode_percent.cue +++ b/website/cue/reference/remap/functions/decode_percent.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_punycode.cue b/website/cue/reference/remap/functions/decode_punycode.cue index 16bae236824ce..dfbd48743223b 100644 --- a/website/cue/reference/remap/functions/decode_punycode.cue +++ b/website/cue/reference/remap/functions/decode_punycode.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_snappy.cue b/website/cue/reference/remap/functions/decode_snappy.cue index 471b921aade6a..1bf175c855b76 100644 --- a/website/cue/reference/remap/functions/decode_snappy.cue +++ b/website/cue/reference/remap/functions/decode_snappy.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_zlib.cue b/website/cue/reference/remap/functions/decode_zlib.cue index 6936da70306cb..f39986108902b 100644 --- a/website/cue/reference/remap/functions/decode_zlib.cue +++ b/website/cue/reference/remap/functions/decode_zlib.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decode_zstd.cue b/website/cue/reference/remap/functions/decode_zstd.cue index a9fce0bf20ea4..54bc01f1c13dc 100644 --- a/website/cue/reference/remap/functions/decode_zstd.cue +++ b/website/cue/reference/remap/functions/decode_zstd.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decrypt.cue b/website/cue/reference/remap/functions/decrypt.cue index cffd38c8cf420..73cb449947e2e 100644 --- a/website/cue/reference/remap/functions/decrypt.cue +++ b/website/cue/reference/remap/functions/decrypt.cue @@ -66,4 +66,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/decrypt_ip.cue b/website/cue/reference/remap/functions/decrypt_ip.cue index 567dfe827636d..57cdd6016540d 100644 --- a/website/cue/reference/remap/functions/decrypt_ip.cue +++ b/website/cue/reference/remap/functions/decrypt_ip.cue @@ -76,4 +76,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/del.cue b/website/cue/reference/remap/functions/del.cue index c15f26f307393..a177b42717c68 100644 --- a/website/cue/reference/remap/functions/del.cue +++ b/website/cue/reference/remap/functions/del.cue @@ -69,8 +69,8 @@ "title": "Delete object field", "source": "var = { \"foo\": {\"nested\": true}, \"bar\": 10 }\ndel(var.foo.nested, false)\nvar\n", "return": { - "bar": 10, - "foo": {} + "foo": {}, + "bar": 10 } }, { @@ -88,4 +88,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/dirname.cue b/website/cue/reference/remap/functions/dirname.cue index 922a796ae3ac3..2a8504790513b 100644 --- a/website/cue/reference/remap/functions/dirname.cue +++ b/website/cue/reference/remap/functions/dirname.cue @@ -55,4 +55,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/dns_lookup.cue b/website/cue/reference/remap/functions/dns_lookup.cue index 8ad0e232ecbdb..1decb751c7d06 100644 --- a/website/cue/reference/remap/functions/dns_lookup.cue +++ b/website/cue/reference/remap/functions/dns_lookup.cue @@ -5,7 +5,7 @@ "anchor": "dns_lookup", "name": "dns_lookup", "category": "System", - "description": "Performs a DNS lookup on the provided domain name. This function performs network calls and blocks on each request until a response is received. It is not recommended for frequent or performance-critical workflows.", + "description": "Performs a DNS lookup on the provided domain name.", "arguments": [ { "name": "value", @@ -254,8 +254,11 @@ } } ], + "notices": [ + "This function performs network calls and blocks on each request until a response is\nreceived. It is not recommended for frequent or performance-critical workflows." + ], "pure": true } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/downcase.cue b/website/cue/reference/remap/functions/downcase.cue index 237ac00540080..bff98b9f00131 100644 --- a/website/cue/reference/remap/functions/downcase.cue +++ b/website/cue/reference/remap/functions/downcase.cue @@ -37,4 +37,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_base16.cue b/website/cue/reference/remap/functions/encode_base16.cue index f71bfae2f68fa..2c09897f1a2fe 100644 --- a/website/cue/reference/remap/functions/encode_base16.cue +++ b/website/cue/reference/remap/functions/encode_base16.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_base64.cue b/website/cue/reference/remap/functions/encode_base64.cue index f444c02ba49ad..0cf0e537a1046 100644 --- a/website/cue/reference/remap/functions/encode_base64.cue +++ b/website/cue/reference/remap/functions/encode_base64.cue @@ -32,8 +32,8 @@ "string" ], "enum": { - "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications).", - "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format." + "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format.", + "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications)." }, "default": "standard" } @@ -69,4 +69,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_charset.cue b/website/cue/reference/remap/functions/encode_charset.cue index 9152417299809..53eb0d4691a3e 100644 --- a/website/cue/reference/remap/functions/encode_charset.cue +++ b/website/cue/reference/remap/functions/encode_charset.cue @@ -5,7 +5,7 @@ "anchor": "encode_charset", "name": "encode_charset", "category": "Codec", - "description": "Encodes the `value` (a non-UTF8 string) to a UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", + "description": "Encodes the `value` (a UTF8 string) to a non-UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", "arguments": [ { "name": "value", @@ -53,4 +53,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_gzip.cue b/website/cue/reference/remap/functions/encode_gzip.cue index dd15ab0dd42ff..a16ee3013ff11 100644 --- a/website/cue/reference/remap/functions/encode_gzip.cue +++ b/website/cue/reference/remap/functions/encode_gzip.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_json.cue b/website/cue/reference/remap/functions/encode_json.cue index 9f3e1420caa2b..04f12f406c14a 100644 --- a/website/cue/reference/remap/functions/encode_json.cue +++ b/website/cue/reference/remap/functions/encode_json.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_key_value.cue b/website/cue/reference/remap/functions/encode_key_value.cue index f7a5e56cac04e..22c90b381b6df 100644 --- a/website/cue/reference/remap/functions/encode_key_value.cue +++ b/website/cue/reference/remap/functions/encode_key_value.cue @@ -99,4 +99,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_logfmt.cue b/website/cue/reference/remap/functions/encode_logfmt.cue index 0e102d647c6fb..a6f787459e7d5 100644 --- a/website/cue/reference/remap/functions/encode_logfmt.cue +++ b/website/cue/reference/remap/functions/encode_logfmt.cue @@ -62,4 +62,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_lz4.cue b/website/cue/reference/remap/functions/encode_lz4.cue index 4ddcca363e03d..709d2f9cb72c1 100644 --- a/website/cue/reference/remap/functions/encode_lz4.cue +++ b/website/cue/reference/remap/functions/encode_lz4.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_percent.cue b/website/cue/reference/remap/functions/encode_percent.cue index 0e673042bca02..f979842544d45 100644 --- a/website/cue/reference/remap/functions/encode_percent.cue +++ b/website/cue/reference/remap/functions/encode_percent.cue @@ -23,15 +23,15 @@ "string" ], "enum": { - "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option.", - "COMPONENT": "Encode only [component characters](https://url.spec.whatwg.org/#component-percent-encode-set)", - "PATH": "Encode only [path characters](https://url.spec.whatwg.org/#path-percent-encode-set)", + "CONTROLS": "Encode only [control characters](https://infra.spec.whatwg.org/#c0-control).", "QUERY": "Encode only [query characters](https://url.spec.whatwg.org/#query-percent-encode-set)", + "SPECIAL": "Encode only [special characters](https://url.spec.whatwg.org/#special-percent-encode-set)", "FRAGMENT": "Encode only [fragment characters](https://url.spec.whatwg.org/#fragment-percent-encode-set)", - "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)", - "CONTROLS": "Encode only [control characters](https://infra.spec.whatwg.org/#c0-control).", + "PATH": "Encode only [path characters](https://url.spec.whatwg.org/#path-percent-encode-set)", "USERINFO": "Encode only [userinfo characters](https://url.spec.whatwg.org/#userinfo-percent-encode-set)", - "SPECIAL": "Encode only [special characters](https://url.spec.whatwg.org/#special-percent-encode-set)" + "COMPONENT": "Encode only [component characters](https://url.spec.whatwg.org/#component-percent-encode-set)", + "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)", + "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option." }, "default": "NON_ALPHANUMERIC" } @@ -62,4 +62,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_proto.cue b/website/cue/reference/remap/functions/encode_proto.cue index 000803a765620..9a1a25f884d89 100644 --- a/website/cue/reference/remap/functions/encode_proto.cue +++ b/website/cue/reference/remap/functions/encode_proto.cue @@ -52,4 +52,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_punycode.cue b/website/cue/reference/remap/functions/encode_punycode.cue index 6f31a595a81fd..2d293b1fa0743 100644 --- a/website/cue/reference/remap/functions/encode_punycode.cue +++ b/website/cue/reference/remap/functions/encode_punycode.cue @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_snappy.cue b/website/cue/reference/remap/functions/encode_snappy.cue index ad4df2d45ed20..9a50830643fa3 100644 --- a/website/cue/reference/remap/functions/encode_snappy.cue +++ b/website/cue/reference/remap/functions/encode_snappy.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_zlib.cue b/website/cue/reference/remap/functions/encode_zlib.cue index 8f4e8382a58fb..f7a34aed5f2a8 100644 --- a/website/cue/reference/remap/functions/encode_zlib.cue +++ b/website/cue/reference/remap/functions/encode_zlib.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encode_zstd.cue b/website/cue/reference/remap/functions/encode_zstd.cue index 86009ff1b50a0..f4bd875943c17 100644 --- a/website/cue/reference/remap/functions/encode_zstd.cue +++ b/website/cue/reference/remap/functions/encode_zstd.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encrypt.cue b/website/cue/reference/remap/functions/encrypt.cue index fe46747da89c6..37326469100f0 100644 --- a/website/cue/reference/remap/functions/encrypt.cue +++ b/website/cue/reference/remap/functions/encrypt.cue @@ -66,4 +66,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/encrypt_ip.cue b/website/cue/reference/remap/functions/encrypt_ip.cue index 6126f91564ac8..9d9bcde349a38 100644 --- a/website/cue/reference/remap/functions/encrypt_ip.cue +++ b/website/cue/reference/remap/functions/encrypt_ip.cue @@ -71,4 +71,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ends_with.cue b/website/cue/reference/remap/functions/ends_with.cue index cfd34fa06bb94..f1b0dae5ff2e3 100644 --- a/website/cue/reference/remap/functions/ends_with.cue +++ b/website/cue/reference/remap/functions/ends_with.cue @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/exists.cue b/website/cue/reference/remap/functions/exists.cue index a799c54d4e911..85bd2c0be6edd 100644 --- a/website/cue/reference/remap/functions/exists.cue +++ b/website/cue/reference/remap/functions/exists.cue @@ -42,4 +42,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/filter.cue b/website/cue/reference/remap/functions/filter.cue index dc033487a01d2..367554fc8cdd6 100644 --- a/website/cue/reference/remap/functions/filter.cue +++ b/website/cue/reference/remap/functions/filter.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/find.cue b/website/cue/reference/remap/functions/find.cue index ff44ca52b3baa..3b00297eeefc0 100644 --- a/website/cue/reference/remap/functions/find.cue +++ b/website/cue/reference/remap/functions/find.cue @@ -70,4 +70,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/find_enrichment_table_records.cue b/website/cue/reference/remap/functions/find_enrichment_table_records.cue index 76a9a23bf8bf1..6aeb89934fcc1 100644 --- a/website/cue/reference/remap/functions/find_enrichment_table_records.cue +++ b/website/cue/reference/remap/functions/find_enrichment_table_records.cue @@ -60,13 +60,13 @@ "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"Smith\"}\n)\n", "return": [ { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" }, { - "firstname": "Fred", "id": 2, + "firstname": "Fred", "surname": "Smith" } ] @@ -76,13 +76,13 @@ "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"smith\"},\n case_sensitive: false\n)\n", "return": [ { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" }, { - "firstname": "Fred", "id": 2, + "firstname": "Fred", "surname": "Smith" } ] @@ -92,13 +92,13 @@ "source": "find_enrichment_table_records!(\n \"test\",\n {\"firstname\": \"Bob\"},\n wildcard: \"fred\",\n case_sensitive: false\n)\n", "return": [ { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" }, { - "firstname": "Fred", "id": 2, + "firstname": "Fred", "surname": "Smith" } ] @@ -108,13 +108,13 @@ "source": "find_enrichment_table_records!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", "return": [ { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" }, { - "firstname": "Fred", "id": 2, + "firstname": "Fred", "surname": "Smith" } ] @@ -124,4 +124,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/find_vector_metrics.cue b/website/cue/reference/remap/functions/find_vector_metrics.cue index e6ad660ed2c06..c9d8a4b271616 100644 --- a/website/cue/reference/remap/functions/find_vector_metrics.cue +++ b/website/cue/reference/remap/functions/find_vector_metrics.cue @@ -36,7 +36,6 @@ "source": "find_vector_metrics(\"utilization\")", "return": [ { - "kind": "absolute", "name": "utilization", "tags": { "component_id": [ @@ -44,6 +43,7 @@ ] }, "type": "gauge", + "kind": "absolute", "value": 0.5 } ] @@ -53,7 +53,6 @@ "source": "find_vector_metrics(\"utilization\", tags: {\"component_id\": \"test\"})", "return": [ { - "kind": "absolute", "name": "utilization", "tags": { "component_id": [ @@ -61,6 +60,7 @@ ] }, "type": "gauge", + "kind": "absolute", "value": 0.5 } ] @@ -70,4 +70,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/flatten.cue b/website/cue/reference/remap/functions/flatten.cue index 69675c83b1462..b677ebb91122c 100644 --- a/website/cue/reference/remap/functions/flatten.cue +++ b/website/cue/reference/remap/functions/flatten.cue @@ -72,4 +72,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/float.cue b/website/cue/reference/remap/functions/float.cue index 730bc80ff8d25..21f47ae8e883f 100644 --- a/website/cue/reference/remap/functions/float.cue +++ b/website/cue/reference/remap/functions/float.cue @@ -49,4 +49,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/floor.cue b/website/cue/reference/remap/functions/floor.cue index 18c95e3b0a0fe..9cc8c6a2ad6c5 100644 --- a/website/cue/reference/remap/functions/floor.cue +++ b/website/cue/reference/remap/functions/floor.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/for_each.cue b/website/cue/reference/remap/functions/for_each.cue index c932216840c8c..5f8d0c234054d 100644 --- a/website/cue/reference/remap/functions/for_each.cue +++ b/website/cue/reference/remap/functions/for_each.cue @@ -47,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/format_int.cue b/website/cue/reference/remap/functions/format_int.cue index 7f0332425b856..e24be8d9cf90d 100644 --- a/website/cue/reference/remap/functions/format_int.cue +++ b/website/cue/reference/remap/functions/format_int.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/format_number.cue b/website/cue/reference/remap/functions/format_number.cue index 5d8311fe032b3..244f25d0284e2 100644 --- a/website/cue/reference/remap/functions/format_number.cue +++ b/website/cue/reference/remap/functions/format_number.cue @@ -68,4 +68,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/format_timestamp.cue b/website/cue/reference/remap/functions/format_timestamp.cue index 8c7c9d2a75009..722be6f647a83 100644 --- a/website/cue/reference/remap/functions/format_timestamp.cue +++ b/website/cue/reference/remap/functions/format_timestamp.cue @@ -63,4 +63,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/from_unix_timestamp.cue b/website/cue/reference/remap/functions/from_unix_timestamp.cue index e089336898215..d472c62f9892d 100644 --- a/website/cue/reference/remap/functions/from_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/from_unix_timestamp.cue @@ -23,10 +23,10 @@ "string" ], "enum": { + "milliseconds": "Express Unix time in milliseconds", "microseconds": "Express Unix time in microseconds", "seconds": "Express Unix time in seconds", - "nanoseconds": "Express Unix time in nanoseconds", - "milliseconds": "Express Unix time in milliseconds" + "nanoseconds": "Express Unix time in nanoseconds" }, "default": "seconds" } @@ -62,4 +62,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get.cue b/website/cue/reference/remap/functions/get.cue index c3178ae478dae..58b7099ae0cc5 100644 --- a/website/cue/reference/remap/functions/get.cue +++ b/website/cue/reference/remap/functions/get.cue @@ -66,7 +66,8 @@ }, { "title": "External target", - "source": ". = { \"foo\": true }\nget!(value: ., path: [\"foo\"])\n", + "source": "get!(value: ., path: [\"foo\"])", + "input": "{ \"foo\": true }", "return": true }, { @@ -94,4 +95,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_enrichment_table_record.cue b/website/cue/reference/remap/functions/get_enrichment_table_record.cue index 3cb6064631fe2..4e1bdb0cddcf2 100644 --- a/website/cue/reference/remap/functions/get_enrichment_table_record.cue +++ b/website/cue/reference/remap/functions/get_enrichment_table_record.cue @@ -63,8 +63,8 @@ "title": "Exact match", "source": "get_enrichment_table_record!(\"test\", {\"id\": 1})", "return": { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" } }, @@ -72,8 +72,8 @@ "title": "Case insensitive match", "source": "get_enrichment_table_record!(\n \"test\",\n {\"surname\": \"bob\", \"firstname\": \"John\"},\n case_sensitive: false\n)\n", "return": { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" } }, @@ -81,8 +81,8 @@ "title": "Date range search", "source": "get_enrichment_table_record!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", "return": { - "firstname": "Bob", "id": 1, + "firstname": "Bob", "surname": "Smith" } } @@ -91,4 +91,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_env_var.cue b/website/cue/reference/remap/functions/get_env_var.cue index 2a0dde1abe05c..83efb10db884f 100644 --- a/website/cue/reference/remap/functions/get_env_var.cue +++ b/website/cue/reference/remap/functions/get_env_var.cue @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_hostname.cue b/website/cue/reference/remap/functions/get_hostname.cue index 1d46d584e9522..757a77eace88d 100644 --- a/website/cue/reference/remap/functions/get_hostname.cue +++ b/website/cue/reference/remap/functions/get_hostname.cue @@ -26,4 +26,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_secret.cue b/website/cue/reference/remap/functions/get_secret.cue index 5e5a49fd8fa16..dd19870ae3a66 100644 --- a/website/cue/reference/remap/functions/get_secret.cue +++ b/website/cue/reference/remap/functions/get_secret.cue @@ -38,4 +38,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_timezone_name.cue b/website/cue/reference/remap/functions/get_timezone_name.cue index a31129dd09d11..f08748a1019eb 100644 --- a/website/cue/reference/remap/functions/get_timezone_name.cue +++ b/website/cue/reference/remap/functions/get_timezone_name.cue @@ -26,4 +26,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/get_vector_metric.cue b/website/cue/reference/remap/functions/get_vector_metric.cue index 896b9060afa54..5a98e7f476342 100644 --- a/website/cue/reference/remap/functions/get_vector_metric.cue +++ b/website/cue/reference/remap/functions/get_vector_metric.cue @@ -36,7 +36,6 @@ "title": "Get a vector internal metric matching the name", "source": "get_vector_metric(\"utilization\")", "return": { - "kind": "absolute", "name": "utilization", "tags": { "component_id": [ @@ -44,6 +43,7 @@ ] }, "type": "gauge", + "kind": "absolute", "value": 0.5 } }, @@ -51,7 +51,6 @@ "title": "Get a vector internal metric matching the name and tags", "source": "get_vector_metric(\"utilization\", tags: {\"component_id\": \"test\"})", "return": { - "kind": "absolute", "name": "utilization", "tags": { "component_id": [ @@ -59,6 +58,7 @@ ] }, "type": "gauge", + "kind": "absolute", "value": 0.5 } } @@ -67,4 +67,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/haversine.cue b/website/cue/reference/remap/functions/haversine.cue index 5665d40d0bdaa..c6365ac2c983c 100644 --- a/website/cue/reference/remap/functions/haversine.cue +++ b/website/cue/reference/remap/functions/haversine.cue @@ -47,8 +47,8 @@ "string" ], "enum": { - "miles": "Use miles for the resulting distance.", - "kilometers": "Use kilometers for the resulting distance." + "kilometers": "Use kilometers for the resulting distance.", + "miles": "Use miles for the resulting distance." } } ], @@ -62,16 +62,16 @@ "title": "Haversine in kilometers", "source": "haversine(0.0, 0.0, 10.0, 10.0)", "return": { - "bearing": 44.561, - "distance": 1568.5227233 + "distance": 1568.5227233, + "bearing": 44.561 } }, { "title": "Haversine in miles", "source": "haversine(0.0, 0.0, 10.0, 10.0, measurement_unit: \"miles\")", "return": { - "bearing": 44.561, - "distance": 974.6348468 + "distance": 974.6348468, + "bearing": 44.561 } } ], @@ -79,4 +79,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/hmac.cue b/website/cue/reference/remap/functions/hmac.cue index 9f10e9a4d3685..47d29c8c035c4 100644 --- a/website/cue/reference/remap/functions/hmac.cue +++ b/website/cue/reference/remap/functions/hmac.cue @@ -31,11 +31,11 @@ "string" ], "enum": { + "SHA-224": "SHA-224 algorithm", "SHA-256": "SHA-256 algorithm", - "SHA-384": "SHA-384 algorithm", "SHA-512": "SHA-512 algorithm", "SHA1": "SHA1 algorithm", - "SHA-224": "SHA-224 algorithm" + "SHA-384": "SHA-384 algorithm" }, "default": "SHA-256" } @@ -71,4 +71,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/http_request.cue b/website/cue/reference/remap/functions/http_request.cue index 6e2c56a4c34d8..d5fa501cfde82 100644 --- a/website/cue/reference/remap/functions/http_request.cue +++ b/website/cue/reference/remap/functions/http_request.cue @@ -5,7 +5,7 @@ "anchor": "http_request", "name": "http_request", "category": "System", - "description": "Makes an HTTP request to the specified URL. This function performs synchronous blocking operations and is not recommended for frequent or performance-critical workflows due to potential network-related delays.", + "description": "Makes an HTTP request to the specified URL.", "arguments": [ { "name": "url", @@ -102,8 +102,11 @@ } } ], + "notices": [ + "This function performs synchronous blocking operations and is not recommended for\nfrequent or performance-critical workflows due to potential network-related delays." + ], "pure": true } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/includes.cue b/website/cue/reference/remap/functions/includes.cue index b643d33601e79..750ecb8e10a66 100644 --- a/website/cue/reference/remap/functions/includes.cue +++ b/website/cue/reference/remap/functions/includes.cue @@ -50,4 +50,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/int.cue b/website/cue/reference/remap/functions/int.cue index 01d1b8d54e37a..92fc7cfb7a029 100644 --- a/website/cue/reference/remap/functions/int.cue +++ b/website/cue/reference/remap/functions/int.cue @@ -49,4 +49,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_aton.cue b/website/cue/reference/remap/functions/ip_aton.cue index e19255309349c..0e155959cc2e2 100644 --- a/website/cue/reference/remap/functions/ip_aton.cue +++ b/website/cue/reference/remap/functions/ip_aton.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_cidr_contains.cue b/website/cue/reference/remap/functions/ip_cidr_contains.cue index da66fedb2af15..80a5a11e02def 100644 --- a/website/cue/reference/remap/functions/ip_cidr_contains.cue +++ b/website/cue/reference/remap/functions/ip_cidr_contains.cue @@ -65,4 +65,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_ntoa.cue b/website/cue/reference/remap/functions/ip_ntoa.cue index 8325318db0786..1e28ba4ee7031 100644 --- a/website/cue/reference/remap/functions/ip_ntoa.cue +++ b/website/cue/reference/remap/functions/ip_ntoa.cue @@ -35,4 +35,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_ntop.cue b/website/cue/reference/remap/functions/ip_ntop.cue index ca34fc1728556..91d0911bf169d 100644 --- a/website/cue/reference/remap/functions/ip_ntop.cue +++ b/website/cue/reference/remap/functions/ip_ntop.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_pton.cue b/website/cue/reference/remap/functions/ip_pton.cue index 071b68302e433..ad5781420669b 100644 --- a/website/cue/reference/remap/functions/ip_pton.cue +++ b/website/cue/reference/remap/functions/ip_pton.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_subnet.cue b/website/cue/reference/remap/functions/ip_subnet.cue index 575e09925e4ad..0870e6d3a14bf 100644 --- a/website/cue/reference/remap/functions/ip_subnet.cue +++ b/website/cue/reference/remap/functions/ip_subnet.cue @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ip_to_ipv6.cue b/website/cue/reference/remap/functions/ip_to_ipv6.cue index 3e82877446d2a..2b180784d8a05 100644 --- a/website/cue/reference/remap/functions/ip_to_ipv6.cue +++ b/website/cue/reference/remap/functions/ip_to_ipv6.cue @@ -39,4 +39,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue b/website/cue/reference/remap/functions/ipv6_to_ipv4.cue index 759f6388294e7..613860fdc1991 100644 --- a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue +++ b/website/cue/reference/remap/functions/ipv6_to_ipv4.cue @@ -39,4 +39,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_array.cue b/website/cue/reference/remap/functions/is_array.cue index 2f0b34b68f3db..e3a0c691a44b4 100644 --- a/website/cue/reference/remap/functions/is_array.cue +++ b/website/cue/reference/remap/functions/is_array.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_boolean.cue b/website/cue/reference/remap/functions/is_boolean.cue index c863596f444fb..c4b542827dbdf 100644 --- a/website/cue/reference/remap/functions/is_boolean.cue +++ b/website/cue/reference/remap/functions/is_boolean.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_empty.cue b/website/cue/reference/remap/functions/is_empty.cue index f653ad335ecee..a750d6041a060 100644 --- a/website/cue/reference/remap/functions/is_empty.cue +++ b/website/cue/reference/remap/functions/is_empty.cue @@ -63,4 +63,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_float.cue b/website/cue/reference/remap/functions/is_float.cue index ea4762f7324be..886f1e105fa49 100644 --- a/website/cue/reference/remap/functions/is_float.cue +++ b/website/cue/reference/remap/functions/is_float.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_integer.cue b/website/cue/reference/remap/functions/is_integer.cue index 81c94a9a2b6d7..f6e32418ccf2f 100644 --- a/website/cue/reference/remap/functions/is_integer.cue +++ b/website/cue/reference/remap/functions/is_integer.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_ipv4.cue b/website/cue/reference/remap/functions/is_ipv4.cue index 1e29c7425a55c..34aeccbde4144 100644 --- a/website/cue/reference/remap/functions/is_ipv4.cue +++ b/website/cue/reference/remap/functions/is_ipv4.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_ipv6.cue b/website/cue/reference/remap/functions/is_ipv6.cue index 67c17ed2b57ae..ac947d60b056d 100644 --- a/website/cue/reference/remap/functions/is_ipv6.cue +++ b/website/cue/reference/remap/functions/is_ipv6.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_json.cue b/website/cue/reference/remap/functions/is_json.cue index 98049f9f40522..187d20fbb0ff7 100644 --- a/website/cue/reference/remap/functions/is_json.cue +++ b/website/cue/reference/remap/functions/is_json.cue @@ -23,12 +23,12 @@ "string" ], "enum": { - "number": "Integer or float numbers", - "bool": "True or false", + "null": "Exact null value", "object": "JSON object - {}", + "string": "JSON-formatted string values wrapped with quote marks", + "bool": "True or false", "array": "JSON array - []", - "null": "Exact null value", - "string": "JSON-formatted string values wrapped with quote marks" + "number": "Integer or float numbers" } } ], @@ -72,4 +72,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_null.cue b/website/cue/reference/remap/functions/is_null.cue index 0338cccc2ac4a..032def4a50904 100644 --- a/website/cue/reference/remap/functions/is_null.cue +++ b/website/cue/reference/remap/functions/is_null.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_nullish.cue b/website/cue/reference/remap/functions/is_nullish.cue index 9ba4fe413e276..190174e9a6bcf 100644 --- a/website/cue/reference/remap/functions/is_nullish.cue +++ b/website/cue/reference/remap/functions/is_nullish.cue @@ -56,4 +56,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_object.cue b/website/cue/reference/remap/functions/is_object.cue index 40482acd11a1d..39b75bf36f923 100644 --- a/website/cue/reference/remap/functions/is_object.cue +++ b/website/cue/reference/remap/functions/is_object.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_regex.cue b/website/cue/reference/remap/functions/is_regex.cue index c59da40e56ff3..76c9118e44069 100644 --- a/website/cue/reference/remap/functions/is_regex.cue +++ b/website/cue/reference/remap/functions/is_regex.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_string.cue b/website/cue/reference/remap/functions/is_string.cue index e7890a0aeece6..f0604ea35eb69 100644 --- a/website/cue/reference/remap/functions/is_string.cue +++ b/website/cue/reference/remap/functions/is_string.cue @@ -51,4 +51,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/is_timestamp.cue b/website/cue/reference/remap/functions/is_timestamp.cue index 0b87e2eb9041e..362ecf67fd4f6 100644 --- a/website/cue/reference/remap/functions/is_timestamp.cue +++ b/website/cue/reference/remap/functions/is_timestamp.cue @@ -46,4 +46,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/join.cue b/website/cue/reference/remap/functions/join.cue index 760c9a47aeced..e3ce88708f737 100644 --- a/website/cue/reference/remap/functions/join.cue +++ b/website/cue/reference/remap/functions/join.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/kebabcase.cue b/website/cue/reference/remap/functions/kebabcase.cue index fd6a340bba904..5f0fa7f54d861 100644 --- a/website/cue/reference/remap/functions/kebabcase.cue +++ b/website/cue/reference/remap/functions/kebabcase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)" } } ], @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/keys.cue b/website/cue/reference/remap/functions/keys.cue index 70098a2c13cb0..26d72e7386e4e 100644 --- a/website/cue/reference/remap/functions/keys.cue +++ b/website/cue/reference/remap/functions/keys.cue @@ -38,4 +38,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/length.cue b/website/cue/reference/remap/functions/length.cue index bf8a044cd8268..826699f680b0a 100644 --- a/website/cue/reference/remap/functions/length.cue +++ b/website/cue/reference/remap/functions/length.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/log.cue b/website/cue/reference/remap/functions/log.cue index b5c75accf20f6..d44be9cdd4e52 100644 --- a/website/cue/reference/remap/functions/log.cue +++ b/website/cue/reference/remap/functions/log.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "error": "Log at the `error` level.", - "debug": "Log at the `debug` level.", - "info": "Log at the `info` level.", "warn": "Log at the `warn` level.", - "trace": "Log at the `trace` level." + "info": "Log at the `info` level.", + "debug": "Log at the `debug` level.", + "trace": "Log at the `trace` level.", + "error": "Log at the `error` level." }, "default": "info" }, @@ -62,4 +62,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/map_keys.cue b/website/cue/reference/remap/functions/map_keys.cue index db546a27df405..d0752f2d5fe5a 100644 --- a/website/cue/reference/remap/functions/map_keys.cue +++ b/website/cue/reference/remap/functions/map_keys.cue @@ -35,11 +35,11 @@ "title": "Upcase keys", "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\",\n \"baz\": {\"nested key\": \"val\"}\n}\nmap_keys(.) -> |key| { upcase(key) }\n", "return": { + "FOO": "foo", "BAR": "bar", "BAZ": { "nested key": "val" - }, - "FOO": "foo" + } } }, { @@ -74,4 +74,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/map_values.cue b/website/cue/reference/remap/functions/map_values.cue index 4bdde517ced17..12df5fb06bb87 100644 --- a/website/cue/reference/remap/functions/map_values.cue +++ b/website/cue/reference/remap/functions/map_values.cue @@ -37,8 +37,8 @@ "title": "Upcase values", "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\"\n}\nmap_values(.) -> |value| { upcase(value) }\n", "return": { - "bar": "BAR", - "foo": "FOO" + "foo": "FOO", + "bar": "BAR" } }, { @@ -64,4 +64,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/match.cue b/website/cue/reference/remap/functions/match.cue index 39e592ab9548b..32ac612cb88e5 100644 --- a/website/cue/reference/remap/functions/match.cue +++ b/website/cue/reference/remap/functions/match.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/match_any.cue b/website/cue/reference/remap/functions/match_any.cue index 7f45e83fc8332..795590e72b6c1 100644 --- a/website/cue/reference/remap/functions/match_any.cue +++ b/website/cue/reference/remap/functions/match_any.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/match_array.cue b/website/cue/reference/remap/functions/match_array.cue index 7aa15c3f2c9e5..8cfbdc32815a0 100644 --- a/website/cue/reference/remap/functions/match_array.cue +++ b/website/cue/reference/remap/functions/match_array.cue @@ -64,4 +64,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/match_datadog_query.cue b/website/cue/reference/remap/functions/match_datadog_query.cue index 6f5ed6841f291..ed6e2adeca3a8 100644 --- a/website/cue/reference/remap/functions/match_datadog_query.cue +++ b/website/cue/reference/remap/functions/match_datadog_query.cue @@ -55,4 +55,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/md5.cue b/website/cue/reference/remap/functions/md5.cue index 76f1727ddd559..3fbb39736098b 100644 --- a/website/cue/reference/remap/functions/md5.cue +++ b/website/cue/reference/remap/functions/md5.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/merge.cue b/website/cue/reference/remap/functions/merge.cue index 3e10752d29fb7..f05bfeceed7be 100644 --- a/website/cue/reference/remap/functions/merge.cue +++ b/website/cue/reference/remap/functions/merge.cue @@ -75,4 +75,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/mod.cue b/website/cue/reference/remap/functions/mod.cue index 71f4930d30107..1e1fccaeca0fc 100644 --- a/website/cue/reference/remap/functions/mod.cue +++ b/website/cue/reference/remap/functions/mod.cue @@ -48,4 +48,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/now.cue b/website/cue/reference/remap/functions/now.cue index ae75276dd82b6..cf50e80f0ad1d 100644 --- a/website/cue/reference/remap/functions/now.cue +++ b/website/cue/reference/remap/functions/now.cue @@ -23,4 +23,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/object.cue b/website/cue/reference/remap/functions/object.cue index e41638f69b136..b750bb37a2671 100644 --- a/website/cue/reference/remap/functions/object.cue +++ b/website/cue/reference/remap/functions/object.cue @@ -47,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/object_from_array.cue b/website/cue/reference/remap/functions/object_from_array.cue index 6703366f71d5c..b9963cfed2772 100644 --- a/website/cue/reference/remap/functions/object_from_array.cue +++ b/website/cue/reference/remap/functions/object_from_array.cue @@ -67,4 +67,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_apache_log.cue b/website/cue/reference/remap/functions/parse_apache_log.cue index fa69d13578adc..1cfd889f54054 100644 --- a/website/cue/reference/remap/functions/parse_apache_log.cue +++ b/website/cue/reference/remap/functions/parse_apache_log.cue @@ -23,8 +23,8 @@ "string" ], "enum": { - "error": "Default Apache error format", "combined": "Apache combined format", + "error": "Default Apache error format", "common": "Common format" } }, @@ -105,4 +105,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_aws_alb_log.cue b/website/cue/reference/remap/functions/parse_aws_alb_log.cue index 29f025bbff168..157b5a6922a39 100644 --- a/website/cue/reference/remap/functions/parse_aws_alb_log.cue +++ b/website/cue/reference/remap/functions/parse_aws_alb_log.cue @@ -115,4 +115,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue b/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue index 0279ec878a436..d0293c34df27e 100644 --- a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue +++ b/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue @@ -50,4 +50,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue b/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue index 289ac6b2346dd..efdfc1784d938 100644 --- a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue +++ b/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue @@ -37,32 +37,32 @@ "title": "Parse AWS VPC Flow log (default format)", "source": "parse_aws_vpc_flow_log!(\"2 123456789010 eni-1235b8ca123456789 - - - - - - - 1431280876 1431280934 - NODATA\")", "return": { + "version": 2, "account_id": "123456789010", - "action": null, - "bytes": null, - "dstaddr": null, - "dstport": null, - "end": 1431280934, "interface_id": "eni-1235b8ca123456789", - "log_status": "NODATA", - "packets": null, - "protocol": null, "srcaddr": null, + "dstaddr": null, "srcport": null, + "dstport": null, + "protocol": null, + "packets": null, + "bytes": null, "start": 1431280876, - "version": 2 + "end": 1431280934, + "action": null, + "log_status": "NODATA" } }, { "title": "Parse AWS VPC Flow log (custom format)", "source": "parse_aws_vpc_flow_log!(\n \"- eni-1235b8ca123456789 10.0.1.5 10.0.0.220 10.0.1.5 203.0.113.5\",\n \"instance_id interface_id srcaddr dstaddr pkt_srcaddr pkt_dstaddr\"\n)\n", "return": { - "dstaddr": "10.0.0.220", "instance_id": null, "interface_id": "eni-1235b8ca123456789", - "pkt_dstaddr": "203.0.113.5", + "srcaddr": "10.0.1.5", + "dstaddr": "10.0.0.220", "pkt_srcaddr": "10.0.1.5", - "srcaddr": "10.0.1.5" + "pkt_dstaddr": "203.0.113.5" } }, { @@ -105,4 +105,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_bytes.cue b/website/cue/reference/remap/functions/parse_bytes.cue index e1528c8403450..743d7dedcafdb 100644 --- a/website/cue/reference/remap/functions/parse_bytes.cue +++ b/website/cue/reference/remap/functions/parse_bytes.cue @@ -23,19 +23,19 @@ "string" ], "enum": { - "TiB": "Terabytes (1024 gigabytes)", + "TB": "Terabytes (1 thousand gigabytes in SI)", + "GB": "Gigabytes (1 billion bytes in SI)", + "B": "Bytes", + "MB": "Megabytes (1 million bytes in SI)", + "PB": "Petabytes (1 million gigabytes in SI)", "EB": "Exabytes (1 billion gigabytes in SI)", - "MiB": "Megabytes (1024 ** 2 bytes)", + "kiB": "Kilobytes (1024 bytes)", "PiB": "Petabytes (1024 ** 2 gigabytes)", - "GiB": "Gigabytes (1024 ** 3 bytes)", "kB": "Kilobytes (1 thousand bytes in SI)", - "kiB": "Kilobytes (1024 bytes)", - "PB": "Petabytes (1 million gigabytes in SI)", - "MB": "Megabytes (1 million bytes in SI)", - "GB": "Gigabytes (1 billion bytes in SI)", - "TB": "Terabytes (1 thousand gigabytes in SI)", - "B": "Bytes", - "EiB": "Exabytes (1024 ** 3 gigabytes)" + "EiB": "Exabytes (1024 ** 3 gigabytes)", + "MiB": "Megabytes (1024 ** 2 bytes)", + "GiB": "Gigabytes (1024 ** 3 bytes)", + "TiB": "Terabytes (1024 gigabytes)" } }, { @@ -92,4 +92,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_cbor.cue b/website/cue/reference/remap/functions/parse_cbor.cue index 077bf86fe34f7..fa39b0552cce1 100644 --- a/website/cue/reference/remap/functions/parse_cbor.cue +++ b/website/cue/reference/remap/functions/parse_cbor.cue @@ -74,4 +74,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_cef.cue b/website/cue/reference/remap/functions/parse_cef.cue index 8ca5e1e9ddfa5..ecbc318a507fc 100644 --- a/website/cue/reference/remap/functions/parse_cef.cue +++ b/website/cue/reference/remap/functions/parse_cef.cue @@ -39,28 +39,28 @@ "source": "parse_cef!(\n \"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft|8|suser=mike2@prod1.domain.com shost=prod1.domain.com src=1.1.1.1 duser=andy@dev1.domain.com dhost=dev1.domain.com dst=2.2.2.2 cs1Label=ExtraData cs1=None cs2Label=EventID cs2=52b06812ec3500ed864c461e deviceCustomDate1Label=detectionDate deviceCustomDate1=1388577900000 cs3Label=PTAlink cs3=https://1.1.1.1/incidents/52b06812ec3500ed864c461e cs4Label=ExternalLink cs4=None\"\n)\n", "return": { "cefVersion": "0", - "cs1": "None", - "cs1Label": "ExtraData", - "cs2": "52b06812ec3500ed864c461e", - "cs2Label": "EventID", - "cs3": "https://1.1.1.1/incidents/52b06812ec3500ed864c461e", - "cs3Label": "PTAlink", - "cs4": "None", - "cs4Label": "ExternalLink", - "deviceCustomDate1": "1388577900000", - "deviceCustomDate1Label": "detectionDate", - "deviceEventClassId": "1", - "deviceProduct": "PTA", "deviceVendor": "CyberArk", + "deviceProduct": "PTA", "deviceVersion": "12.6", - "dhost": "dev1.domain.com", - "dst": "2.2.2.2", - "duser": "andy@dev1.domain.com", + "deviceEventClassId": "1", "name": "Suspected credentials theft", "severity": "8", + "suser": "mike2@prod1.domain.com", "shost": "prod1.domain.com", "src": "1.1.1.1", - "suser": "mike2@prod1.domain.com" + "duser": "andy@dev1.domain.com", + "dhost": "dev1.domain.com", + "dst": "2.2.2.2", + "cs1Label": "ExtraData", + "cs1": "None", + "cs2Label": "EventID", + "cs2": "52b06812ec3500ed864c461e", + "deviceCustomDate1Label": "detectionDate", + "deviceCustomDate1": "1388577900000", + "cs3Label": "PTAlink", + "cs3": "https://1.1.1.1/incidents/52b06812ec3500ed864c461e", + "cs4Label": "ExternalLink", + "cs4": "None" } }, { @@ -68,29 +68,29 @@ "source": "parse_cef!(\n \"Sep 29 08:26:10 host CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2 spt=1232\"\n)\n", "return": { "cefVersion": "1", - "deviceEventClassId": "100", - "deviceProduct": "threatmanager", "deviceVendor": "Security", + "deviceProduct": "threatmanager", "deviceVersion": "1.0", - "dst": "2.1.2.2", + "deviceEventClassId": "100", "name": "worm successfully stopped", "severity": "10", - "spt": "1232", - "src": "10.0.0.1" + "src": "10.0.0.1", + "dst": "2.1.2.2", + "spt": "1232" } }, { "title": "Translate custom fields", "source": "parse_cef!(\n \"CEF:0|Dev|firewall|2.2|1|Connection denied|5|c6a1=2345:0425:2CA1:0000:0000:0567:5673:23b5 c6a1Label=Device IPv6 Address\",\n translate_custom_fields: true\n)\n", "return": { - "Device IPv6 Address": "2345:0425:2CA1:0000:0000:0567:5673:23b5", "cefVersion": "0", - "deviceEventClassId": "1", - "deviceProduct": "firewall", "deviceVendor": "Dev", + "deviceProduct": "firewall", "deviceVersion": "2.2", + "deviceEventClassId": "1", "name": "Connection denied", - "severity": "5" + "severity": "5", + "Device IPv6 Address": "2345:0425:2CA1:0000:0000:0567:5673:23b5" } }, { @@ -98,10 +98,10 @@ "source": "parse_cef!(\"CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|\")", "return": { "cefVersion": "1", - "deviceEventClassId": "100", - "deviceProduct": "threatmanager", "deviceVendor": "Security", + "deviceProduct": "threatmanager", "deviceVersion": "1.0", + "deviceEventClassId": "100", "name": "worm successfully stopped", "severity": "10" } @@ -111,32 +111,32 @@ "source": "parse_cef!(\"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft||suser=mike2@prod1.domain.com shost= src=1.1.1.1\")", "return": { "cefVersion": "0", - "deviceEventClassId": "1", - "deviceProduct": "PTA", "deviceVendor": "CyberArk", + "deviceProduct": "PTA", "deviceVersion": "12.6", + "deviceEventClassId": "1", "name": "Suspected credentials theft", "severity": "", + "suser": "mike2@prod1.domain.com", "shost": "", - "src": "1.1.1.1", - "suser": "mike2@prod1.domain.com" + "src": "1.1.1.1" } }, { "title": "Parse CEF with escapes", "source": "parse_cef!(s'CEF:0|security|threatmanager|1.0|100|Detected a \\| in message. No action needed.|10|src=10.0.0.1 msg=Detected a threat.\\n No action needed act=blocked a \\= dst=1.1.1.1')", "return": { - "act": "blocked a =", "cefVersion": "0", - "deviceEventClassId": "100", - "deviceProduct": "threatmanager", "deviceVendor": "security", + "deviceProduct": "threatmanager", "deviceVersion": "1.0", - "dst": "1.1.1.1", - "msg": "Detected a threat.\n No action needed", + "deviceEventClassId": "100", "name": "Detected a | in message. No action needed.", "severity": "10", - "src": "10.0.0.1" + "src": "10.0.0.1", + "msg": "Detected a threat.\n No action needed", + "act": "blocked a =", + "dst": "1.1.1.1" } } ], @@ -147,4 +147,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_common_log.cue b/website/cue/reference/remap/functions/parse_common_log.cue index d03d8476a19c1..16fe24074f688 100644 --- a/website/cue/reference/remap/functions/parse_common_log.cue +++ b/website/cue/reference/remap/functions/parse_common_log.cue @@ -76,4 +76,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_csv.cue b/website/cue/reference/remap/functions/parse_csv.cue index b5b2b1ad8fc45..42267e802285d 100644 --- a/website/cue/reference/remap/functions/parse_csv.cue +++ b/website/cue/reference/remap/functions/parse_csv.cue @@ -60,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_dnstap.cue b/website/cue/reference/remap/functions/parse_dnstap.cue index b30edc7cc3f14..8ba18850083e7 100644 --- a/website/cue/reference/remap/functions/parse_dnstap.cue +++ b/website/cue/reference/remap/functions/parse_dnstap.cue @@ -86,7 +86,6 @@ ], "rcodeName": "NoError" }, - "responseAddress": "2001:502:7094::30", "responseData": { "fullRcode": 16, "header": { @@ -107,6 +106,8 @@ }, "opt": { "do": false, + "ednsVersion": 1, + "extendedRcode": 1, "ede": [ { "extraText": "no SEP matching the DS found for dnssec-failed.org.", @@ -114,8 +115,6 @@ "purpose": "DNSKEY Missing" } ], - "ednsVersion": 1, - "extendedRcode": 1, "udpPayloadSize": 1232 }, "question": [ @@ -128,6 +127,7 @@ ], "rcodeName": "BADVERS" }, + "responseAddress": "2001:502:7094::30", "responsePort": 53, "serverId": "james-Virtual-Machine", "serverVersion": "BIND 9.16.3", @@ -145,4 +145,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_duration.cue b/website/cue/reference/remap/functions/parse_duration.cue index 3c730f1195389..681a2e2fea5ea 100644 --- a/website/cue/reference/remap/functions/parse_duration.cue +++ b/website/cue/reference/remap/functions/parse_duration.cue @@ -23,16 +23,16 @@ "string" ], "enum": { - "ms": "Milliseconds (1 thousand microseconds in a second)", - "ds": "Deciseconds (10 deciseconds in a second)", - "d": "Days (24 hours in a day)", "m": "Minutes (60 seconds in a minute)", - "h": "Hours (60 minutes in an hour)", - "cs": "Centiseconds (100 centiseconds in a second)", + "ms": "Milliseconds (1 thousand microseconds in a second)", "s": "Seconds", + "h": "Hours (60 minutes in an hour)", + "d": "Days (24 hours in a day)", "ns": "Nanoseconds (1 billion nanoseconds in a second)", + "cs": "Centiseconds (100 centiseconds in a second)", + "µs": "Microseconds (1 million microseconds in a second)", "us": "Microseconds (1 million microseconds in a second)", - "µs": "Microseconds (1 million microseconds in a second)" + "ds": "Deciseconds (10 deciseconds in a second)" } } ], @@ -60,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_etld.cue b/website/cue/reference/remap/functions/parse_etld.cue index ddc7fb55b47c4..cad0880954498 100644 --- a/website/cue/reference/remap/functions/parse_etld.cue +++ b/website/cue/reference/remap/functions/parse_etld.cue @@ -83,4 +83,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_float.cue b/website/cue/reference/remap/functions/parse_float.cue index 4bc2196b2ed38..516a45929ebdc 100644 --- a/website/cue/reference/remap/functions/parse_float.cue +++ b/website/cue/reference/remap/functions/parse_float.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_glog.cue b/website/cue/reference/remap/functions/parse_glog.cue index 05ffc12651e6f..51343d8678782 100644 --- a/website/cue/reference/remap/functions/parse_glog.cue +++ b/website/cue/reference/remap/functions/parse_glog.cue @@ -42,4 +42,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_grok.cue b/website/cue/reference/remap/functions/parse_grok.cue index 9281c8acc1f65..4f275aea9adf2 100644 --- a/website/cue/reference/remap/functions/parse_grok.cue +++ b/website/cue/reference/remap/functions/parse_grok.cue @@ -37,9 +37,9 @@ "title": "Parse using Grok", "source": "value = \"2020-10-02T23:22:12.223222Z info Hello world\"\npattern = \"%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:message}\"\n\nparse_grok!(value, pattern)\n", "return": { + "timestamp": "2020-10-02T23:22:12.223222Z", "level": "info", - "message": "Hello world", - "timestamp": "2020-10-02T23:22:12.223222Z" + "message": "Hello world" } } ], @@ -50,4 +50,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_groks.cue b/website/cue/reference/remap/functions/parse_groks.cue index 4a09e4480e8bf..7d24d7d6721a1 100644 --- a/website/cue/reference/remap/functions/parse_groks.cue +++ b/website/cue/reference/remap/functions/parse_groks.cue @@ -58,9 +58,9 @@ "title": "Parse using multiple Grok patterns", "source": "parse_groks!(\n \"2020-10-02T23:22:12.223222Z info Hello world\",\n patterns: [\n \"%{common_prefix} %{_status} %{_message}\",\n \"%{common_prefix} %{_message}\",\n ],\n aliases: {\n \"common_prefix\": \"%{_timestamp} %{_loglevel}\",\n \"_timestamp\": \"%{TIMESTAMP_ISO8601:timestamp}\",\n \"_loglevel\": \"%{LOGLEVEL:level}\",\n \"_status\": \"%{POSINT:status}\",\n \"_message\": \"%{GREEDYDATA:message}\"\n }\n)\n", "return": { + "timestamp": "2020-10-02T23:22:12.223222Z", "level": "info", - "message": "Hello world", - "timestamp": "2020-10-02T23:22:12.223222Z" + "message": "Hello world" } }, { @@ -78,4 +78,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_influxdb.cue b/website/cue/reference/remap/functions/parse_influxdb.cue index 862076383fa8b..d2a9859a1120d 100644 --- a/website/cue/reference/remap/functions/parse_influxdb.cue +++ b/website/cue/reference/remap/functions/parse_influxdb.cue @@ -32,64 +32,64 @@ "source": "parse_influxdb!(\"cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000\")", "return": [ { - "gauge": { - "value": 64.0 - }, - "kind": "absolute", "name": "cpu_usage_system", "tags": { "host": "A", "region": "us-west" }, - "timestamp": "2020-05-26T10:26:13.254420Z" + "timestamp": "2020-05-26T10:26:13.254420Z", + "kind": "absolute", + "gauge": { + "value": 64.0 + } }, { - "gauge": { - "value": 10.0 - }, - "kind": "absolute", "name": "cpu_usage_user", "tags": { "host": "A", "region": "us-west" }, - "timestamp": "2020-05-26T10:26:13.254420Z" + "timestamp": "2020-05-26T10:26:13.254420Z", + "kind": "absolute", + "gauge": { + "value": 10.0 + } }, { - "gauge": { - "value": 50.5 - }, - "kind": "absolute", "name": "cpu_temperature", "tags": { "host": "A", "region": "us-west" }, - "timestamp": "2020-05-26T10:26:13.254420Z" + "timestamp": "2020-05-26T10:26:13.254420Z", + "kind": "absolute", + "gauge": { + "value": 50.5 + } }, { - "gauge": { - "value": 1.0 - }, - "kind": "absolute", "name": "cpu_on", "tags": { "host": "A", "region": "us-west" }, - "timestamp": "2020-05-26T10:26:13.254420Z" + "timestamp": "2020-05-26T10:26:13.254420Z", + "kind": "absolute", + "gauge": { + "value": 1.0 + } }, { - "gauge": { - "value": 0.0 - }, - "kind": "absolute", "name": "cpu_sleep", "tags": { "host": "A", "region": "us-west" }, - "timestamp": "2020-05-26T10:26:13.254420Z" + "timestamp": "2020-05-26T10:26:13.254420Z", + "kind": "absolute", + "gauge": { + "value": 0.0 + } } ] } @@ -103,4 +103,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_int.cue b/website/cue/reference/remap/functions/parse_int.cue index e01bfa37c9cde..f6c04302bb09f 100644 --- a/website/cue/reference/remap/functions/parse_int.cue +++ b/website/cue/reference/remap/functions/parse_int.cue @@ -64,4 +64,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_json.cue b/website/cue/reference/remap/functions/parse_json.cue index e19029f24789c..a7130caffe730 100644 --- a/website/cue/reference/remap/functions/parse_json.cue +++ b/website/cue/reference/remap/functions/parse_json.cue @@ -103,4 +103,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_key_value.cue b/website/cue/reference/remap/functions/parse_key_value.cue index ac047e5587fdf..5ae24b41d6c02 100644 --- a/website/cue/reference/remap/functions/parse_key_value.cue +++ b/website/cue/reference/remap/functions/parse_key_value.cue @@ -69,8 +69,8 @@ "title": "Parse simple key value pairs", "source": "parse_key_value!(\"zork=zook zonk=nork\")", "return": { - "zonk": "nork", - "zork": "zook" + "zork": "zook", + "zonk": "nork" } }, { @@ -78,36 +78,36 @@ "source": "parse_key_value!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", "return": { "@timestamp": "Sun Jan 10 16:47:39 EST 2021", - "id": "ConsumerFetcherManager-1382721708341", "level": "info", - "module": "kafka.consumer.ConsumerFetcherManager", "msg": "Stopping all fetchers", - "tag#production": "stopping_fetchers" + "tag#production": "stopping_fetchers", + "id": "ConsumerFetcherManager-1382721708341", + "module": "kafka.consumer.ConsumerFetcherManager" } }, { "title": "Parse comma delimited log", "source": "parse_key_value!(\n \"path:\\\"/cart_link\\\", host:store.app.com, fwd: \\\"102.30.171.16\\\", dyno: web.1, connect:0ms, service:87ms, status:304, bytes:632, protocol:https\",\n field_delimiter: \",\",\n key_value_delimiter: \":\"\n)\n", "return": { - "bytes": "632", - "connect": "0ms", - "dyno": "web.1", - "fwd": "102.30.171.16", - "host": "store.app.com", "path": "/cart_link", - "protocol": "https", + "host": "store.app.com", + "fwd": "102.30.171.16", + "dyno": "web.1", + "connect": "0ms", "service": "87ms", - "status": "304" + "status": "304", + "bytes": "632", + "protocol": "https" } }, { "title": "Parse comma delimited log with standalone keys", "source": "parse_key_value!(\n \"env:prod,service:backend,region:eu-east1,beta\",\n field_delimiter: \",\",\n key_value_delimiter: \":\",\n)\n", "return": { - "beta": true, "env": "prod", + "service": "backend", "region": "eu-east1", - "service": "backend" + "beta": true } }, { @@ -130,8 +130,8 @@ "return": { "app": "my-app", "ip": "1.2.3.4", - "msg": "hello-world", - "user": "" + "user": "", + "msg": "hello-world" } } ], @@ -142,4 +142,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_klog.cue b/website/cue/reference/remap/functions/parse_klog.cue index 2ae9a9ce944f0..91acbd1e20871 100644 --- a/website/cue/reference/remap/functions/parse_klog.cue +++ b/website/cue/reference/remap/functions/parse_klog.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_linux_authorization.cue b/website/cue/reference/remap/functions/parse_linux_authorization.cue index 5492b2f8e37f7..f1a9b8db8bf78 100644 --- a/website/cue/reference/remap/functions/parse_linux_authorization.cue +++ b/website/cue/reference/remap/functions/parse_linux_authorization.cue @@ -44,4 +44,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_logfmt.cue b/website/cue/reference/remap/functions/parse_logfmt.cue index 7c77bba7ad370..0e6547561afcd 100644 --- a/website/cue/reference/remap/functions/parse_logfmt.cue +++ b/website/cue/reference/remap/functions/parse_logfmt.cue @@ -29,8 +29,8 @@ "title": "Parse simple logfmt log", "source": "parse_logfmt!(\"zork=zook zonk=nork\")", "return": { - "zonk": "nork", - "zork": "zook" + "zork": "zook", + "zonk": "nork" } }, { @@ -38,11 +38,11 @@ "source": "parse_logfmt!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", "return": { "@timestamp": "Sun Jan 10 16:47:39 EST 2021", - "id": "ConsumerFetcherManager-1382721708341", "level": "info", - "module": "kafka.consumer.ConsumerFetcherManager", "msg": "Stopping all fetchers", - "tag#production": "stopping_fetchers" + "tag#production": "stopping_fetchers", + "id": "ConsumerFetcherManager-1382721708341", + "module": "kafka.consumer.ConsumerFetcherManager" } }, { @@ -50,8 +50,8 @@ "source": "parse_logfmt!(\"zork=zook plonk zonk=nork\")", "return": { "plonk": true, - "zonk": "nork", - "zork": "zook" + "zork": "zook", + "zonk": "nork" } } ], @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_nginx_log.cue b/website/cue/reference/remap/functions/parse_nginx_log.cue index c8a19e2ac8092..88a9437fdfd7e 100644 --- a/website/cue/reference/remap/functions/parse_nginx_log.cue +++ b/website/cue/reference/remap/functions/parse_nginx_log.cue @@ -23,10 +23,10 @@ "string" ], "enum": { + "main": "Nginx main format used by Docker images", "combined": "Nginx combined format", "error": "Default Nginx error format", - "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)", - "main": "Nginx main format used by Docker images" + "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)" } }, { @@ -128,4 +128,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_proto.cue b/website/cue/reference/remap/functions/parse_proto.cue index de13960774632..8dbe92f9b1dd4 100644 --- a/website/cue/reference/remap/functions/parse_proto.cue +++ b/website/cue/reference/remap/functions/parse_proto.cue @@ -63,4 +63,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_query_string.cue b/website/cue/reference/remap/functions/parse_query_string.cue index 80cffe2491d6c..760f59ea0c599 100644 --- a/website/cue/reference/remap/functions/parse_query_string.cue +++ b/website/cue/reference/remap/functions/parse_query_string.cue @@ -26,8 +26,8 @@ "title": "Parse simple query string", "source": "parse_query_string(\"foo=1&bar=2\")", "return": { - "bar": "2", - "foo": "1" + "foo": "1", + "bar": "2" } }, { @@ -60,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_regex.cue b/website/cue/reference/remap/functions/parse_regex.cue index 02de82c715a8d..9fa91d1018210 100644 --- a/website/cue/reference/remap/functions/parse_regex.cue +++ b/website/cue/reference/remap/functions/parse_regex.cue @@ -97,4 +97,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_regex_all.cue b/website/cue/reference/remap/functions/parse_regex_all.cue index 9cd255bc66463..cba6e4f52dfd9 100644 --- a/website/cue/reference/remap/functions/parse_regex_all.cue +++ b/website/cue/reference/remap/functions/parse_regex_all.cue @@ -52,14 +52,14 @@ "source": "parse_regex_all!(\"first group and second group.\", r'(?P\\w+) group', numeric_groups: true)", "return": [ { + "number": "first", "0": "first group", - "1": "first", - "number": "first" + "1": "first" }, { + "number": "second", "0": "second group", - "1": "second", - "number": "second" + "1": "second" } ] }, @@ -82,18 +82,18 @@ "source": "parse_regex_all!(\"apples and carrots, peaches and peas\", r'(?P[\\w\\.]+) and (?P[\\w]+)', numeric_groups: true)", "return": [ { + "fruit": "apples", + "veg": "carrots", "0": "apples and carrots", "1": "apples", - "2": "carrots", - "fruit": "apples", - "veg": "carrots" + "2": "carrots" }, { + "fruit": "peaches", + "veg": "peas", "0": "peaches and peas", "1": "peaches", - "2": "peas", - "fruit": "peaches", - "veg": "peas" + "2": "peas" } ] }, @@ -120,4 +120,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_ruby_hash.cue b/website/cue/reference/remap/functions/parse_ruby_hash.cue index b4e0132aa7275..327c6a0edacae 100644 --- a/website/cue/reference/remap/functions/parse_ruby_hash.cue +++ b/website/cue/reference/remap/functions/parse_ruby_hash.cue @@ -45,4 +45,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_syslog.cue b/website/cue/reference/remap/functions/parse_syslog.cue index 8bc1d307b6a1a..900d7b7419242 100644 --- a/website/cue/reference/remap/functions/parse_syslog.cue +++ b/website/cue/reference/remap/functions/parse_syslog.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_timestamp.cue b/website/cue/reference/remap/functions/parse_timestamp.cue index 846f17b9c15b6..b51702e8c5a05 100644 --- a/website/cue/reference/remap/functions/parse_timestamp.cue +++ b/website/cue/reference/remap/functions/parse_timestamp.cue @@ -58,4 +58,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_tokens.cue b/website/cue/reference/remap/functions/parse_tokens.cue index 25c34796dd21d..126261d0f1c97 100644 --- a/website/cue/reference/remap/functions/parse_tokens.cue +++ b/website/cue/reference/remap/functions/parse_tokens.cue @@ -44,4 +44,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_url.cue b/website/cue/reference/remap/functions/parse_url.cue index eb4c6a2152dba..3014441fba4ed 100644 --- a/website/cue/reference/remap/functions/parse_url.cue +++ b/website/cue/reference/remap/functions/parse_url.cue @@ -69,4 +69,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_user_agent.cue b/website/cue/reference/remap/functions/parse_user_agent.cue index c13ba770546d4..a1cf6fdd5b879 100644 --- a/website/cue/reference/remap/functions/parse_user_agent.cue +++ b/website/cue/reference/remap/functions/parse_user_agent.cue @@ -24,8 +24,8 @@ ], "enum": { "fast": "Fastest mode but most unreliable. Uses parser from project [Woothee](https://github.com/woothee/woothee).", - "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n", - "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n" + "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n", + "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n" }, "default": "fast" } @@ -107,4 +107,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/parse_xml.cue b/website/cue/reference/remap/functions/parse_xml.cue index 00f6d6c0fc0f9..19c793edff73f 100644 --- a/website/cue/reference/remap/functions/parse_xml.cue +++ b/website/cue/reference/remap/functions/parse_xml.cue @@ -120,4 +120,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/pascalcase.cue b/website/cue/reference/remap/functions/pascalcase.cue index 35ac7d989f803..2ce025c640c09 100644 --- a/website/cue/reference/remap/functions/pascalcase.cue +++ b/website/cue/reference/remap/functions/pascalcase.cue @@ -24,10 +24,10 @@ ], "enum": { "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)" } } ], @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/pop.cue b/website/cue/reference/remap/functions/pop.cue index 48e3ca5a5d4ee..938735847dda2 100644 --- a/website/cue/reference/remap/functions/pop.cue +++ b/website/cue/reference/remap/functions/pop.cue @@ -38,4 +38,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/push.cue b/website/cue/reference/remap/functions/push.cue index 1c2da7fbe5a04..65b08e3f43ca9 100644 --- a/website/cue/reference/remap/functions/push.cue +++ b/website/cue/reference/remap/functions/push.cue @@ -54,4 +54,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/random_bool.cue b/website/cue/reference/remap/functions/random_bool.cue index b815a9fa98b98..fc881cf0b0cb5 100644 --- a/website/cue/reference/remap/functions/random_bool.cue +++ b/website/cue/reference/remap/functions/random_bool.cue @@ -23,4 +23,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/random_bytes.cue b/website/cue/reference/remap/functions/random_bytes.cue index ecbcd7bcdbd44..c86937d9bfa26 100644 --- a/website/cue/reference/remap/functions/random_bytes.cue +++ b/website/cue/reference/remap/functions/random_bytes.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/random_float.cue b/website/cue/reference/remap/functions/random_float.cue index 9ccca67dc089c..442bd341e481d 100644 --- a/website/cue/reference/remap/functions/random_float.cue +++ b/website/cue/reference/remap/functions/random_float.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/random_int.cue b/website/cue/reference/remap/functions/random_int.cue index 3d950b5b56b4b..785eec58b5c18 100644 --- a/website/cue/reference/remap/functions/random_int.cue +++ b/website/cue/reference/remap/functions/random_int.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/redact.cue b/website/cue/reference/remap/functions/redact.cue index 3df3ac6a03f02..5e9076a1d2543 100644 --- a/website/cue/reference/remap/functions/redact.cue +++ b/website/cue/reference/remap/functions/redact.cue @@ -81,4 +81,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/remove.cue b/website/cue/reference/remap/functions/remove.cue index b98e0199a87ec..fadddb6dac360 100644 --- a/website/cue/reference/remap/functions/remove.cue +++ b/website/cue/reference/remap/functions/remove.cue @@ -94,7 +94,8 @@ }, { "title": "External target", - "source": ". = { \"foo\": true }\nremove!(value: ., path: [\"foo\"])\n", + "source": "remove!(value: ., path: [\"foo\"])", + "input": "{ \"foo\": true }", "return": {} }, { @@ -131,4 +132,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/remove_secret.cue b/website/cue/reference/remap/functions/remove_secret.cue index 028071847adcc..7d274ef5e96d3 100644 --- a/website/cue/reference/remap/functions/remove_secret.cue +++ b/website/cue/reference/remap/functions/remove_secret.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/replace.cue b/website/cue/reference/remap/functions/replace.cue index 85f559bd881f6..ca0956c2ff9a9 100644 --- a/website/cue/reference/remap/functions/replace.cue +++ b/website/cue/reference/remap/functions/replace.cue @@ -78,4 +78,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/replace_with.cue b/website/cue/reference/remap/functions/replace_with.cue index 027622ba031c1..a6e506a18a4a8 100644 --- a/website/cue/reference/remap/functions/replace_with.cue +++ b/website/cue/reference/remap/functions/replace_with.cue @@ -74,4 +74,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/reverse_dns.cue b/website/cue/reference/remap/functions/reverse_dns.cue index 81a356c9dbfa6..00777d4ea6af1 100644 --- a/website/cue/reference/remap/functions/reverse_dns.cue +++ b/website/cue/reference/remap/functions/reverse_dns.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/round.cue b/website/cue/reference/remap/functions/round.cue index 45c730ab2bd1b..76508c132c214 100644 --- a/website/cue/reference/remap/functions/round.cue +++ b/website/cue/reference/remap/functions/round.cue @@ -61,4 +61,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/screamingsnakecase.cue b/website/cue/reference/remap/functions/screamingsnakecase.cue index 30f586116a220..1f00d7d72a9ce 100644 --- a/website/cue/reference/remap/functions/screamingsnakecase.cue +++ b/website/cue/reference/remap/functions/screamingsnakecase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)" + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)" } } ], @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/seahash.cue b/website/cue/reference/remap/functions/seahash.cue index e6947ac147efb..57967f696f9a0 100644 --- a/website/cue/reference/remap/functions/seahash.cue +++ b/website/cue/reference/remap/functions/seahash.cue @@ -37,4 +37,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/set.cue b/website/cue/reference/remap/functions/set.cue index acc592b6faccf..a32fb8b10f168 100644 --- a/website/cue/reference/remap/functions/set.cue +++ b/website/cue/reference/remap/functions/set.cue @@ -91,18 +91,19 @@ }, { "title": "External target", - "source": ". = { \"foo\": true }\nset!(value: ., path: [\"bar\"], data: \"baz\")\n", + "source": "set!(value: ., path: [\"bar\"], data: \"baz\")", + "input": "{ \"foo\": true }", "return": { - "bar": "baz", - "foo": true + "foo": true, + "bar": "baz" } }, { "title": "Variable", "source": "var = { \"foo\": true }\nset!(value: var, path: [\"bar\"], data: \"baz\")\n", "return": { - "bar": "baz", - "foo": true + "foo": true, + "bar": "baz" } }, { @@ -122,4 +123,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/set_secret.cue b/website/cue/reference/remap/functions/set_secret.cue index 7dd6a119a1bed..e6a263db96ea3 100644 --- a/website/cue/reference/remap/functions/set_secret.cue +++ b/website/cue/reference/remap/functions/set_secret.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/set_semantic_meaning.cue b/website/cue/reference/remap/functions/set_semantic_meaning.cue index 65626754392c3..77d120d630cb6 100644 --- a/website/cue/reference/remap/functions/set_semantic_meaning.cue +++ b/website/cue/reference/remap/functions/set_semantic_meaning.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/sha1.cue b/website/cue/reference/remap/functions/sha1.cue index 14c0f2e3a4fc1..5be47941e74fb 100644 --- a/website/cue/reference/remap/functions/sha1.cue +++ b/website/cue/reference/remap/functions/sha1.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/sha2.cue b/website/cue/reference/remap/functions/sha2.cue index a01e3bf2d15c9..981ac43124246 100644 --- a/website/cue/reference/remap/functions/sha2.cue +++ b/website/cue/reference/remap/functions/sha2.cue @@ -23,12 +23,12 @@ "string" ], "enum": { - "SHA-512": "SHA-512 algorithm", + "SHA-512/256": "SHA-512/256 algorithm", "SHA-256": "SHA-256 algorithm", - "SHA-384": "SHA-384 algorithm", + "SHA-224": "SHA-224 algorithm", "SHA-512/224": "SHA-512/224 algorithm", - "SHA-512/256": "SHA-512/256 algorithm", - "SHA-224": "SHA-224 algorithm" + "SHA-384": "SHA-384 algorithm", + "SHA-512": "SHA-512 algorithm" }, "default": "SHA-512/256" } @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/sha3.cue b/website/cue/reference/remap/functions/sha3.cue index 211f05972b1c9..b8bf405a39a59 100644 --- a/website/cue/reference/remap/functions/sha3.cue +++ b/website/cue/reference/remap/functions/sha3.cue @@ -23,10 +23,10 @@ "string" ], "enum": { - "SHA3-224": "SHA3-224 algorithm", "SHA3-512": "SHA3-512 algorithm", "SHA3-256": "SHA3-256 algorithm", - "SHA3-384": "SHA3-384 algorithm" + "SHA3-384": "SHA3-384 algorithm", + "SHA3-224": "SHA3-224 algorithm" }, "default": "SHA3-512" } @@ -57,4 +57,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/shannon_entropy.cue b/website/cue/reference/remap/functions/shannon_entropy.cue index 134c166063525..95fa2201f288d 100644 --- a/website/cue/reference/remap/functions/shannon_entropy.cue +++ b/website/cue/reference/remap/functions/shannon_entropy.cue @@ -24,8 +24,8 @@ ], "enum": { "grapheme": "Considers graphemes when calculating entropy", - "byte": "Considers individual bytes when calculating entropy", - "codepoint": "Considers codepoints when calculating entropy" + "codepoint": "Considers codepoints when calculating entropy", + "byte": "Considers individual bytes when calculating entropy" }, "default": "byte" } @@ -61,4 +61,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/sieve.cue b/website/cue/reference/remap/functions/sieve.cue index 86d25c0e1d97a..e6349907ecfef 100644 --- a/website/cue/reference/remap/functions/sieve.cue +++ b/website/cue/reference/remap/functions/sieve.cue @@ -68,4 +68,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/slice.cue b/website/cue/reference/remap/functions/slice.cue index 84b976f1ecc3a..87207adc893b7 100644 --- a/website/cue/reference/remap/functions/slice.cue +++ b/website/cue/reference/remap/functions/slice.cue @@ -69,4 +69,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/snakecase.cue b/website/cue/reference/remap/functions/snakecase.cue index 34334ec22a2d7..1cc3b7e8bfd82 100644 --- a/website/cue/reference/remap/functions/snakecase.cue +++ b/website/cue/reference/remap/functions/snakecase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", + "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)" + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)" } }, { @@ -38,13 +38,13 @@ "array" ], "enum": { + "lower_upper": "Lowercase to uppercase transitions (e.g., 'camelCase' → 'camel' + 'case')", + "lower_digit": "Lowercase to digit transitions (e.g., 'foo2bar' → 'foo2_bar')", "digit_lower": "Digit to lowercase transitions (e.g., 'Foo123barBaz' → 'foo' + '123bar' + 'baz')", "digit_upper": "Digit to uppercase transitions (e.g., 'Version123Test' → 'version' + '123test')", - "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')", + "upper_digit": "Uppercase to digit transitions (e.g., 'versionV2' → 'version_v2')", "upper_lower": "Uppercase to lowercase transitions (e.g., 'CamelCase' → 'Camel' + 'Case')", - "lower_digit": "Lowercase to digit transitions (e.g., 'foo2bar' → 'foo2_bar')", - "lower_upper": "Lowercase to uppercase transitions (e.g., 'camelCase' → 'camel' + 'case')", - "upper_digit": "Uppercase to digit transitions (e.g., 'versionV2' → 'version_v2')" + "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')" } } ], @@ -74,4 +74,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/split.cue b/website/cue/reference/remap/functions/split.cue index fb8ffccd86496..d61906700e347 100644 --- a/website/cue/reference/remap/functions/split.cue +++ b/website/cue/reference/remap/functions/split.cue @@ -81,4 +81,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/split_path.cue b/website/cue/reference/remap/functions/split_path.cue index 8ee1d2b2106e5..eb15748b81478 100644 --- a/website/cue/reference/remap/functions/split_path.cue +++ b/website/cue/reference/remap/functions/split_path.cue @@ -60,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/starts_with.cue b/website/cue/reference/remap/functions/starts_with.cue index 3f6e3a4c96e39..8c9d877cda650 100644 --- a/website/cue/reference/remap/functions/starts_with.cue +++ b/website/cue/reference/remap/functions/starts_with.cue @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/string.cue b/website/cue/reference/remap/functions/string.cue index 8b8ed4745e0c5..64d22a4a55f1d 100644 --- a/website/cue/reference/remap/functions/string.cue +++ b/website/cue/reference/remap/functions/string.cue @@ -44,4 +44,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue b/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue index a72c5daefb99c..faaadd3549bb6 100644 --- a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue +++ b/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue @@ -25,4 +25,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/strip_whitespace.cue b/website/cue/reference/remap/functions/strip_whitespace.cue index a88aff32dca6f..b66163e0ee6d2 100644 --- a/website/cue/reference/remap/functions/strip_whitespace.cue +++ b/website/cue/reference/remap/functions/strip_whitespace.cue @@ -47,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/strlen.cue b/website/cue/reference/remap/functions/strlen.cue index ecc3e29b61f57..bb24107deaa62 100644 --- a/website/cue/reference/remap/functions/strlen.cue +++ b/website/cue/reference/remap/functions/strlen.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/tag_types_externally.cue b/website/cue/reference/remap/functions/tag_types_externally.cue index d2e3cf20ed122..237bf7f442bf4 100644 --- a/website/cue/reference/remap/functions/tag_types_externally.cue +++ b/website/cue/reference/remap/functions/tag_types_externally.cue @@ -67,4 +67,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/tally.cue b/website/cue/reference/remap/functions/tally.cue index 64a05e6e24e80..9038246e3a84f 100644 --- a/website/cue/reference/remap/functions/tally.cue +++ b/website/cue/reference/remap/functions/tally.cue @@ -26,9 +26,9 @@ "title": "tally", "source": "tally!([\"foo\", \"bar\", \"foo\", \"baz\"])", "return": { + "foo": 2, "bar": 1, - "baz": 1, - "foo": 2 + "baz": 1 } } ], @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/tally_value.cue b/website/cue/reference/remap/functions/tally_value.cue index a037b3bbf5a8a..d4349fcd1efb0 100644 --- a/website/cue/reference/remap/functions/tally_value.cue +++ b/website/cue/reference/remap/functions/tally_value.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/timestamp.cue b/website/cue/reference/remap/functions/timestamp.cue index 6adea2d8ecd7b..740dc5e4d6909 100644 --- a/website/cue/reference/remap/functions/timestamp.cue +++ b/website/cue/reference/remap/functions/timestamp.cue @@ -44,4 +44,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_bool.cue b/website/cue/reference/remap/functions/to_bool.cue index c1ed036445822..dd473e3c7c5f3 100644 --- a/website/cue/reference/remap/functions/to_bool.cue +++ b/website/cue/reference/remap/functions/to_bool.cue @@ -133,4 +133,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_float.cue b/website/cue/reference/remap/functions/to_float.cue index ceae764f9c92d..99a74d4fdee34 100644 --- a/website/cue/reference/remap/functions/to_float.cue +++ b/website/cue/reference/remap/functions/to_float.cue @@ -92,4 +92,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_int.cue b/website/cue/reference/remap/functions/to_int.cue index 978b79e36c3a2..1e2236b81849e 100644 --- a/website/cue/reference/remap/functions/to_int.cue +++ b/website/cue/reference/remap/functions/to_int.cue @@ -94,4 +94,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_regex.cue b/website/cue/reference/remap/functions/to_regex.cue index 907c6a12315c7..850eb2148ff14 100644 --- a/website/cue/reference/remap/functions/to_regex.cue +++ b/website/cue/reference/remap/functions/to_regex.cue @@ -41,4 +41,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_string.cue b/website/cue/reference/remap/functions/to_string.cue index 7de9823460999..80a79e9a72005 100644 --- a/website/cue/reference/remap/functions/to_string.cue +++ b/website/cue/reference/remap/functions/to_string.cue @@ -86,4 +86,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_syslog_facility.cue b/website/cue/reference/remap/functions/to_syslog_facility.cue index 5559fc77d56df..ea49fd0b9971a 100644 --- a/website/cue/reference/remap/functions/to_syslog_facility.cue +++ b/website/cue/reference/remap/functions/to_syslog_facility.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_syslog_facility_code.cue b/website/cue/reference/remap/functions/to_syslog_facility_code.cue index 1d560a64a659a..2d886a893e0aa 100644 --- a/website/cue/reference/remap/functions/to_syslog_facility_code.cue +++ b/website/cue/reference/remap/functions/to_syslog_facility_code.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_syslog_level.cue b/website/cue/reference/remap/functions/to_syslog_level.cue index c8465cb27422b..4d7e3fa894a66 100644 --- a/website/cue/reference/remap/functions/to_syslog_level.cue +++ b/website/cue/reference/remap/functions/to_syslog_level.cue @@ -40,4 +40,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_syslog_severity.cue b/website/cue/reference/remap/functions/to_syslog_severity.cue index 037db2f1c5336..e30006ce6b201 100644 --- a/website/cue/reference/remap/functions/to_syslog_severity.cue +++ b/website/cue/reference/remap/functions/to_syslog_severity.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/to_unix_timestamp.cue b/website/cue/reference/remap/functions/to_unix_timestamp.cue index 5dca78d2d6892..e9debacb3411a 100644 --- a/website/cue/reference/remap/functions/to_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/to_unix_timestamp.cue @@ -64,4 +64,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/truncate.cue b/website/cue/reference/remap/functions/truncate.cue index ad3901b19b87d..494ba1c1d10aa 100644 --- a/website/cue/reference/remap/functions/truncate.cue +++ b/website/cue/reference/remap/functions/truncate.cue @@ -61,4 +61,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/type_def.cue b/website/cue/reference/remap/functions/type_def.cue index 548002d7df458..63df82e44e916 100644 --- a/website/cue/reference/remap/functions/type_def.cue +++ b/website/cue/reference/remap/functions/type_def.cue @@ -34,4 +34,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/unflatten.cue b/website/cue/reference/remap/functions/unflatten.cue index e336607d6d3b3..bd7f8933cf395 100644 --- a/website/cue/reference/remap/functions/unflatten.cue +++ b/website/cue/reference/remap/functions/unflatten.cue @@ -103,4 +103,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/unique.cue b/website/cue/reference/remap/functions/unique.cue index 9c13102655144..1bd60b66c86fa 100644 --- a/website/cue/reference/remap/functions/unique.cue +++ b/website/cue/reference/remap/functions/unique.cue @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/unnest.cue b/website/cue/reference/remap/functions/unnest.cue index 6c77f1fbd6d1c..7fce74904195e 100644 --- a/website/cue/reference/remap/functions/unnest.cue +++ b/website/cue/reference/remap/functions/unnest.cue @@ -47,16 +47,16 @@ "source": ". = {\"hostname\": \"localhost\", \"event\": {\"messages\": [\"message 1\", \"message 2\"]}}\n. = unnest(.event.messages)\n", "return": [ { + "hostname": "localhost", "event": { "messages": "message 1" - }, - "hostname": "localhost" + } }, { + "hostname": "localhost", "event": { "messages": "message 2" - }, - "hostname": "localhost" + } } ] } @@ -65,4 +65,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/upcase.cue b/website/cue/reference/remap/functions/upcase.cue index afa2b85f3ee08..510f9b527a149 100644 --- a/website/cue/reference/remap/functions/upcase.cue +++ b/website/cue/reference/remap/functions/upcase.cue @@ -32,4 +32,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue b/website/cue/reference/remap/functions/uuid_from_friendly_id.cue index f51de47fe076e..4863b3ad4826c 100644 --- a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue +++ b/website/cue/reference/remap/functions/uuid_from_friendly_id.cue @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/uuid_v4.cue b/website/cue/reference/remap/functions/uuid_v4.cue index 1f142b0d4ed05..df34c565252a9 100644 --- a/website/cue/reference/remap/functions/uuid_v4.cue +++ b/website/cue/reference/remap/functions/uuid_v4.cue @@ -23,4 +23,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/uuid_v7.cue b/website/cue/reference/remap/functions/uuid_v7.cue index 74602505d9dd4..76df69cb4d665 100644 --- a/website/cue/reference/remap/functions/uuid_v7.cue +++ b/website/cue/reference/remap/functions/uuid_v7.cue @@ -43,4 +43,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/validate_json_schema.cue b/website/cue/reference/remap/functions/validate_json_schema.cue index c11683d9ed597..f4f5d3a334e36 100644 --- a/website/cue/reference/remap/functions/validate_json_schema.cue +++ b/website/cue/reference/remap/functions/validate_json_schema.cue @@ -76,4 +76,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/values.cue b/website/cue/reference/remap/functions/values.cue index 16a056ba64a8e..46a6239edc762 100644 --- a/website/cue/reference/remap/functions/values.cue +++ b/website/cue/reference/remap/functions/values.cue @@ -53,4 +53,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/xxhash.cue b/website/cue/reference/remap/functions/xxhash.cue index d3dc5a0a40220..ee46ff686fad2 100644 --- a/website/cue/reference/remap/functions/xxhash.cue +++ b/website/cue/reference/remap/functions/xxhash.cue @@ -65,4 +65,4 @@ } } } -} \ No newline at end of file +} diff --git a/website/cue/reference/remap/functions/zip.cue b/website/cue/reference/remap/functions/zip.cue index 36bf480d9df5c..0bc1c1fe7496a 100644 --- a/website/cue/reference/remap/functions/zip.cue +++ b/website/cue/reference/remap/functions/zip.cue @@ -114,4 +114,4 @@ } } } -} \ No newline at end of file +} From d6cbadc01993ab8f926c9eadb01aaacdc3216cae Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:17:24 -0500 Subject: [PATCH 31/44] Use IndexMap to preserve enum ordering --- vdev/src/commands/build/vrl_docs.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index d2193220c4d66..2d1fa6a987e5a 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -1,6 +1,7 @@ use anyhow::Result; +use indexmap::IndexMap; use serde::Serialize; -use std::{collections::HashMap, fs, path::PathBuf}; +use std::{fs, path::PathBuf}; use vrl::compiler::Function; use vrl::compiler::value::kind; use vrl::core::Value; @@ -53,8 +54,8 @@ struct ArgumentDoc { description: String, required: bool, r#type: Vec, - #[serde(skip_serializing_if = "HashMap::is_empty")] - r#enum: HashMap, + #[serde(skip_serializing_if = "IndexMap::is_empty")] + r#enum: IndexMap, #[serde(skip_serializing_if = "Option::is_none")] default: Option, } From b51bc761e2b8c97a9ffa851ec8b6053548a392cd Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:18:59 -0500 Subject: [PATCH 32/44] Regenerate docs with enum ordering --- .../functions/aggregate_vector_metrics.cue | 6 +- .../reference/remap/functions/camelcase.cue | 6 +- website/cue/reference/remap/functions/crc.cue | 184 +++++++++--------- .../remap/functions/encode_percent.cue | 6 +- .../remap/functions/from_unix_timestamp.cue | 6 +- .../cue/reference/remap/functions/hmac.cue | 6 +- .../cue/reference/remap/functions/is_json.cue | 6 +- .../reference/remap/functions/kebabcase.cue | 6 +- website/cue/reference/remap/functions/log.cue | 6 +- .../remap/functions/parse_apache_log.cue | 4 +- .../reference/remap/functions/parse_bytes.cue | 18 +- .../remap/functions/parse_duration.cue | 14 +- .../remap/functions/parse_nginx_log.cue | 4 +- .../remap/functions/parse_user_agent.cue | 4 +- .../reference/remap/functions/pascalcase.cue | 6 +- .../remap/functions/screamingsnakecase.cue | 6 +- .../cue/reference/remap/functions/sha2.cue | 8 +- .../cue/reference/remap/functions/sha3.cue | 4 +- .../remap/functions/shannon_entropy.cue | 4 +- .../reference/remap/functions/snakecase.cue | 14 +- .../remap/functions/to_unix_timestamp.cue | 4 +- 21 files changed, 161 insertions(+), 161 deletions(-) diff --git a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue index 18221b26fd2c9..2734094b86000 100644 --- a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue +++ b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue @@ -15,10 +15,10 @@ "string" ], "enum": { - "max": "Find the highest metric value of all the matched metrics.", "sum": "Sum the values of all the matched metrics.", - "min": "Find the lowest metric value of all the matched metrics.", - "avg": "Find the average of the values of all the matched metrics." + "avg": "Find the average of the values of all the matched metrics.", + "max": "Find the highest metric value of all the matched metrics.", + "min": "Find the lowest metric value of all the matched metrics." } }, { diff --git a/website/cue/reference/remap/functions/camelcase.cue b/website/cue/reference/remap/functions/camelcase.cue index 77da51e416384..581b4f2c21d29 100644 --- a/website/cue/reference/remap/functions/camelcase.cue +++ b/website/cue/reference/remap/functions/camelcase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)" + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" } } ], diff --git a/website/cue/reference/remap/functions/crc.cue b/website/cue/reference/remap/functions/crc.cue index a912420ee832e..e0dc3be7e067a 100644 --- a/website/cue/reference/remap/functions/crc.cue +++ b/website/cue/reference/remap/functions/crc.cue @@ -23,118 +23,118 @@ "string" ], "enum": { + "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", + "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", + "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", + "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", + "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols", - "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", + "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", + "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", + "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", + "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", + "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", + "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", + "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", + "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", + "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", + "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications", + "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", + "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard", "CRC_8_I_CODE": "8-bit CRC used in I-CODE RFID systems", - "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", - "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", - "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication", - "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", + "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", + "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", + "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", - "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", - "CRC_64_WE": "64-bit CRC variant for wide-area error detection", - "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication", + "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_16_USB": "16-bit CRC used in USB communication for error detection", - "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol", - "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication", - "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", - "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", - "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks", - "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", - "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity", - "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", - "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", - "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard", - "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication", - "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", - "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format", - "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", - "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", - "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", - "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", - "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", - "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", - "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", - "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", - "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", - "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", + "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks", - "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", + "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", + "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", + "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", + "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards", + "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", + "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", + "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications", - "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", - "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", - "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", + "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", + "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", "CRC_16_ARC": "16-bit CRC used in ARC (Adaptive Routing Code) communication", - "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", - "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", - "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", - "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", - "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", - "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", - "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)", - "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems", - "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications", - "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", - "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", - "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", + "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", + "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity", "CRC_16_DDS_110": "16-bit CRC used in DDS (Digital Data Storage) standard", - "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity", - "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems", - "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications", + "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication", + "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities", - "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", - "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", - "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", - "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", - "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", - "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", - "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", - "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", - "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", - "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", - "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication", - "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", - "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", - "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", - "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", - "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", - "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", - "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", + "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", + "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", "CRC_16_IBM_SDLC": "16-bit CRC used in IBM SDLC (Synchronous Data Link Control)", + "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", + "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", + "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", + "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", + "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", + "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems", + "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", + "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", + "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication", + "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", + "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", + "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", + "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard", + "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format", + "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", + "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", + "CRC_16_USB": "16-bit CRC used in USB communication for error detection", + "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", + "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", + "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", + "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", + "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol", - "CRC_32_XFER": "32-bit CRC used in data transfer protocols", - "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", - "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", - "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", - "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", - "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", - "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", - "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", + "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", + "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", + "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks", + "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", + "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", "CRC_30_CDMA": "30-bit CRC used in CDMA (Code Division Multiple Access) communication standard", + "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", + "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)", "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", + "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", + "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", + "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems", + "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity", + "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)", - "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", - "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", - "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", - "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection", - "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards" + "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards", + "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", + "CRC_32_XFER": "32-bit CRC used in data transfer protocols", + "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications", + "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", + "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", + "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", + "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", + "CRC_64_WE": "64-bit CRC variant for wide-area error detection", + "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", + "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication" }, "default": "CRC_32_ISO_HDLC" } diff --git a/website/cue/reference/remap/functions/encode_percent.cue b/website/cue/reference/remap/functions/encode_percent.cue index f979842544d45..75907a70a1aa5 100644 --- a/website/cue/reference/remap/functions/encode_percent.cue +++ b/website/cue/reference/remap/functions/encode_percent.cue @@ -23,15 +23,15 @@ "string" ], "enum": { + "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option.", "CONTROLS": "Encode only [control characters](https://infra.spec.whatwg.org/#c0-control).", + "FRAGMENT": "Encode only [fragment characters](https://url.spec.whatwg.org/#fragment-percent-encode-set)", "QUERY": "Encode only [query characters](https://url.spec.whatwg.org/#query-percent-encode-set)", "SPECIAL": "Encode only [special characters](https://url.spec.whatwg.org/#special-percent-encode-set)", - "FRAGMENT": "Encode only [fragment characters](https://url.spec.whatwg.org/#fragment-percent-encode-set)", "PATH": "Encode only [path characters](https://url.spec.whatwg.org/#path-percent-encode-set)", "USERINFO": "Encode only [userinfo characters](https://url.spec.whatwg.org/#userinfo-percent-encode-set)", "COMPONENT": "Encode only [component characters](https://url.spec.whatwg.org/#component-percent-encode-set)", - "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)", - "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option." + "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)" }, "default": "NON_ALPHANUMERIC" } diff --git a/website/cue/reference/remap/functions/from_unix_timestamp.cue b/website/cue/reference/remap/functions/from_unix_timestamp.cue index d472c62f9892d..4e29934d47f69 100644 --- a/website/cue/reference/remap/functions/from_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/from_unix_timestamp.cue @@ -23,10 +23,10 @@ "string" ], "enum": { - "milliseconds": "Express Unix time in milliseconds", - "microseconds": "Express Unix time in microseconds", "seconds": "Express Unix time in seconds", - "nanoseconds": "Express Unix time in nanoseconds" + "milliseconds": "Express Unix time in milliseconds", + "nanoseconds": "Express Unix time in nanoseconds", + "microseconds": "Express Unix time in microseconds" }, "default": "seconds" } diff --git a/website/cue/reference/remap/functions/hmac.cue b/website/cue/reference/remap/functions/hmac.cue index 47d29c8c035c4..ccd857adb34dc 100644 --- a/website/cue/reference/remap/functions/hmac.cue +++ b/website/cue/reference/remap/functions/hmac.cue @@ -31,11 +31,11 @@ "string" ], "enum": { + "SHA1": "SHA1 algorithm", "SHA-224": "SHA-224 algorithm", "SHA-256": "SHA-256 algorithm", - "SHA-512": "SHA-512 algorithm", - "SHA1": "SHA1 algorithm", - "SHA-384": "SHA-384 algorithm" + "SHA-384": "SHA-384 algorithm", + "SHA-512": "SHA-512 algorithm" }, "default": "SHA-256" } diff --git a/website/cue/reference/remap/functions/is_json.cue b/website/cue/reference/remap/functions/is_json.cue index 187d20fbb0ff7..7db9e56fd7c86 100644 --- a/website/cue/reference/remap/functions/is_json.cue +++ b/website/cue/reference/remap/functions/is_json.cue @@ -23,12 +23,12 @@ "string" ], "enum": { - "null": "Exact null value", "object": "JSON object - {}", + "array": "JSON array - []", "string": "JSON-formatted string values wrapped with quote marks", + "number": "Integer or float numbers", "bool": "True or false", - "array": "JSON array - []", - "number": "Integer or float numbers" + "null": "Exact null value" } } ], diff --git a/website/cue/reference/remap/functions/kebabcase.cue b/website/cue/reference/remap/functions/kebabcase.cue index 5f0fa7f54d861..8565d5e0d5a74 100644 --- a/website/cue/reference/remap/functions/kebabcase.cue +++ b/website/cue/reference/remap/functions/kebabcase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)" + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" } } ], diff --git a/website/cue/reference/remap/functions/log.cue b/website/cue/reference/remap/functions/log.cue index d44be9cdd4e52..2b7f3b1af287f 100644 --- a/website/cue/reference/remap/functions/log.cue +++ b/website/cue/reference/remap/functions/log.cue @@ -23,10 +23,10 @@ "string" ], "enum": { - "warn": "Log at the `warn` level.", - "info": "Log at the `info` level.", - "debug": "Log at the `debug` level.", "trace": "Log at the `trace` level.", + "debug": "Log at the `debug` level.", + "info": "Log at the `info` level.", + "warn": "Log at the `warn` level.", "error": "Log at the `error` level." }, "default": "info" diff --git a/website/cue/reference/remap/functions/parse_apache_log.cue b/website/cue/reference/remap/functions/parse_apache_log.cue index 1cfd889f54054..7d1ab4216ba32 100644 --- a/website/cue/reference/remap/functions/parse_apache_log.cue +++ b/website/cue/reference/remap/functions/parse_apache_log.cue @@ -23,9 +23,9 @@ "string" ], "enum": { + "common": "Common format", "combined": "Apache combined format", - "error": "Default Apache error format", - "common": "Common format" + "error": "Default Apache error format" } }, { diff --git a/website/cue/reference/remap/functions/parse_bytes.cue b/website/cue/reference/remap/functions/parse_bytes.cue index 743d7dedcafdb..d68639e420b8c 100644 --- a/website/cue/reference/remap/functions/parse_bytes.cue +++ b/website/cue/reference/remap/functions/parse_bytes.cue @@ -23,19 +23,19 @@ "string" ], "enum": { - "TB": "Terabytes (1 thousand gigabytes in SI)", - "GB": "Gigabytes (1 billion bytes in SI)", "B": "Bytes", - "MB": "Megabytes (1 million bytes in SI)", - "PB": "Petabytes (1 million gigabytes in SI)", - "EB": "Exabytes (1 billion gigabytes in SI)", "kiB": "Kilobytes (1024 bytes)", - "PiB": "Petabytes (1024 ** 2 gigabytes)", - "kB": "Kilobytes (1 thousand bytes in SI)", - "EiB": "Exabytes (1024 ** 3 gigabytes)", "MiB": "Megabytes (1024 ** 2 bytes)", "GiB": "Gigabytes (1024 ** 3 bytes)", - "TiB": "Terabytes (1024 gigabytes)" + "TiB": "Terabytes (1024 gigabytes)", + "PiB": "Petabytes (1024 ** 2 gigabytes)", + "EiB": "Exabytes (1024 ** 3 gigabytes)", + "kB": "Kilobytes (1 thousand bytes in SI)", + "MB": "Megabytes (1 million bytes in SI)", + "GB": "Gigabytes (1 billion bytes in SI)", + "TB": "Terabytes (1 thousand gigabytes in SI)", + "PB": "Petabytes (1 million gigabytes in SI)", + "EB": "Exabytes (1 billion gigabytes in SI)" } }, { diff --git a/website/cue/reference/remap/functions/parse_duration.cue b/website/cue/reference/remap/functions/parse_duration.cue index 681a2e2fea5ea..f9aaac0ab2d96 100644 --- a/website/cue/reference/remap/functions/parse_duration.cue +++ b/website/cue/reference/remap/functions/parse_duration.cue @@ -23,16 +23,16 @@ "string" ], "enum": { - "m": "Minutes (60 seconds in a minute)", + "ns": "Nanoseconds (1 billion nanoseconds in a second)", + "us": "Microseconds (1 million microseconds in a second)", + "µs": "Microseconds (1 million microseconds in a second)", "ms": "Milliseconds (1 thousand microseconds in a second)", + "cs": "Centiseconds (100 centiseconds in a second)", + "ds": "Deciseconds (10 deciseconds in a second)", "s": "Seconds", + "m": "Minutes (60 seconds in a minute)", "h": "Hours (60 minutes in an hour)", - "d": "Days (24 hours in a day)", - "ns": "Nanoseconds (1 billion nanoseconds in a second)", - "cs": "Centiseconds (100 centiseconds in a second)", - "µs": "Microseconds (1 million microseconds in a second)", - "us": "Microseconds (1 million microseconds in a second)", - "ds": "Deciseconds (10 deciseconds in a second)" + "d": "Days (24 hours in a day)" } } ], diff --git a/website/cue/reference/remap/functions/parse_nginx_log.cue b/website/cue/reference/remap/functions/parse_nginx_log.cue index 88a9437fdfd7e..c57ffd8b3135f 100644 --- a/website/cue/reference/remap/functions/parse_nginx_log.cue +++ b/website/cue/reference/remap/functions/parse_nginx_log.cue @@ -23,10 +23,10 @@ "string" ], "enum": { - "main": "Nginx main format used by Docker images", "combined": "Nginx combined format", "error": "Default Nginx error format", - "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)" + "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)", + "main": "Nginx main format used by Docker images" } }, { diff --git a/website/cue/reference/remap/functions/parse_user_agent.cue b/website/cue/reference/remap/functions/parse_user_agent.cue index a1cf6fdd5b879..92c8ce01d640d 100644 --- a/website/cue/reference/remap/functions/parse_user_agent.cue +++ b/website/cue/reference/remap/functions/parse_user_agent.cue @@ -24,8 +24,8 @@ ], "enum": { "fast": "Fastest mode but most unreliable. Uses parser from project [Woothee](https://github.com/woothee/woothee).", - "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n", - "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n" + "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n", + "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n" }, "default": "fast" } diff --git a/website/cue/reference/remap/functions/pascalcase.cue b/website/cue/reference/remap/functions/pascalcase.cue index 2ce025c640c09..ed70ec52f2307 100644 --- a/website/cue/reference/remap/functions/pascalcase.cue +++ b/website/cue/reference/remap/functions/pascalcase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)" + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" } } ], diff --git a/website/cue/reference/remap/functions/screamingsnakecase.cue b/website/cue/reference/remap/functions/screamingsnakecase.cue index 1f00d7d72a9ce..81cb29c9dd768 100644 --- a/website/cue/reference/remap/functions/screamingsnakecase.cue +++ b/website/cue/reference/remap/functions/screamingsnakecase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", + "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)" + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" } } ], diff --git a/website/cue/reference/remap/functions/sha2.cue b/website/cue/reference/remap/functions/sha2.cue index 981ac43124246..5a29325454060 100644 --- a/website/cue/reference/remap/functions/sha2.cue +++ b/website/cue/reference/remap/functions/sha2.cue @@ -23,12 +23,12 @@ "string" ], "enum": { - "SHA-512/256": "SHA-512/256 algorithm", - "SHA-256": "SHA-256 algorithm", "SHA-224": "SHA-224 algorithm", - "SHA-512/224": "SHA-512/224 algorithm", + "SHA-256": "SHA-256 algorithm", "SHA-384": "SHA-384 algorithm", - "SHA-512": "SHA-512 algorithm" + "SHA-512": "SHA-512 algorithm", + "SHA-512/224": "SHA-512/224 algorithm", + "SHA-512/256": "SHA-512/256 algorithm" }, "default": "SHA-512/256" } diff --git a/website/cue/reference/remap/functions/sha3.cue b/website/cue/reference/remap/functions/sha3.cue index b8bf405a39a59..939aeb8784e0b 100644 --- a/website/cue/reference/remap/functions/sha3.cue +++ b/website/cue/reference/remap/functions/sha3.cue @@ -23,10 +23,10 @@ "string" ], "enum": { - "SHA3-512": "SHA3-512 algorithm", + "SHA3-224": "SHA3-224 algorithm", "SHA3-256": "SHA3-256 algorithm", "SHA3-384": "SHA3-384 algorithm", - "SHA3-224": "SHA3-224 algorithm" + "SHA3-512": "SHA3-512 algorithm" }, "default": "SHA3-512" } diff --git a/website/cue/reference/remap/functions/shannon_entropy.cue b/website/cue/reference/remap/functions/shannon_entropy.cue index 95fa2201f288d..edf23df5ba6c6 100644 --- a/website/cue/reference/remap/functions/shannon_entropy.cue +++ b/website/cue/reference/remap/functions/shannon_entropy.cue @@ -23,9 +23,9 @@ "string" ], "enum": { - "grapheme": "Considers graphemes when calculating entropy", + "byte": "Considers individual bytes when calculating entropy", "codepoint": "Considers codepoints when calculating entropy", - "byte": "Considers individual bytes when calculating entropy" + "grapheme": "Considers graphemes when calculating entropy" }, "default": "byte" } diff --git a/website/cue/reference/remap/functions/snakecase.cue b/website/cue/reference/remap/functions/snakecase.cue index 1cc3b7e8bfd82..fcb10bdcc7979 100644 --- a/website/cue/reference/remap/functions/snakecase.cue +++ b/website/cue/reference/remap/functions/snakecase.cue @@ -23,11 +23,11 @@ "string" ], "enum": { - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)", "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)" + "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", + "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", + "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" } }, { @@ -39,12 +39,12 @@ ], "enum": { "lower_upper": "Lowercase to uppercase transitions (e.g., 'camelCase' → 'camel' + 'case')", + "upper_lower": "Uppercase to lowercase transitions (e.g., 'CamelCase' → 'Camel' + 'Case')", + "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')", "lower_digit": "Lowercase to digit transitions (e.g., 'foo2bar' → 'foo2_bar')", - "digit_lower": "Digit to lowercase transitions (e.g., 'Foo123barBaz' → 'foo' + '123bar' + 'baz')", - "digit_upper": "Digit to uppercase transitions (e.g., 'Version123Test' → 'version' + '123test')", "upper_digit": "Uppercase to digit transitions (e.g., 'versionV2' → 'version_v2')", - "upper_lower": "Uppercase to lowercase transitions (e.g., 'CamelCase' → 'Camel' + 'Case')", - "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')" + "digit_lower": "Digit to lowercase transitions (e.g., 'Foo123barBaz' → 'foo' + '123bar' + 'baz')", + "digit_upper": "Digit to uppercase transitions (e.g., 'Version123Test' → 'version' + '123test')" } } ], diff --git a/website/cue/reference/remap/functions/to_unix_timestamp.cue b/website/cue/reference/remap/functions/to_unix_timestamp.cue index e9debacb3411a..5d1e402d88c52 100644 --- a/website/cue/reference/remap/functions/to_unix_timestamp.cue +++ b/website/cue/reference/remap/functions/to_unix_timestamp.cue @@ -24,8 +24,8 @@ ], "enum": { "seconds": "Express Unix time in seconds", - "nanoseconds": "Express Unix time in nanoseconds", - "milliseconds": "Express Unix time in milliseconds" + "milliseconds": "Express Unix time in milliseconds", + "nanoseconds": "Express Unix time in nanoseconds" }, "default": "seconds" } From 5cf0e1c8bfce50bcd1079859b9434922572a8cad Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:46:47 -0500 Subject: [PATCH 33/44] Fix cue schema --- website/cue/reference/remap.cue | 15 ++++++++++++--- website/cue/reference/remap/functions.cue | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/website/cue/reference/remap.cue b/website/cue/reference/remap.cue index 93aa2e0d074af..94203257171f7 100644 --- a/website/cue/reference/remap.cue +++ b/website/cue/reference/remap.cue @@ -13,13 +13,11 @@ package metadata name: Name } - #Example: { + #BaseExample: { title: string - input?: #Event source: string diff?: string return?: _ - output?: #Event | [#Event, ...#Event] raises?: _ notes?: [string, ...string] @@ -29,6 +27,17 @@ package metadata skip_test?: bool } + #Example: { + #BaseExample + input?: #Event + output?: #Event | [#Event, ...#Event] + } + + #FunctionExample: { + #BaseExample + input?: string + } + #Type: "any" | "array" | "boolean" | "float" | "integer" | "object" | "null" | "path" | "string" | "regex" | "timestamp" concepts: _ diff --git a/website/cue/reference/remap/functions.cue b/website/cue/reference/remap/functions.cue index 62df2d555f883..4bb2eb207c83a 100644 --- a/website/cue/reference/remap/functions.cue +++ b/website/cue/reference/remap/functions.cue @@ -23,7 +23,7 @@ remap: { rules?: [string, ...string] } internal_failure_reasons: [...string] - examples?: [remap.#Example, ...remap.#Example] + examples?: [remap.#FunctionExample, ...remap.#FunctionExample] deprecated: bool | *false pure: bool | *true } From 3335605e0408bc4dfbf47e59e1d12b615d63e79d Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 15:49:48 -0500 Subject: [PATCH 34/44] Remove .log when rendering VRL examples' input --- website/layouts/partials/data.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/layouts/partials/data.html b/website/layouts/partials/data.html index 6ba725e5048cb..9252b6af3f414 100644 --- a/website/layouts/partials/data.html +++ b/website/layouts/partials/data.html @@ -1788,7 +1788,7 @@

Input
- {{ template "code" .log }} + {{ template "code" . }}
{{ end }} From 2c5806fefb6a42ad97b96dc4ec20797a71daa2f5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 17:27:17 -0500 Subject: [PATCH 35/44] Fix clippy --- vdev/src/commands/build/vrl_docs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 2d1fa6a987e5a..215d958d16f1a 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -101,7 +101,7 @@ impl Cli { }; let mut json = serde_json::to_string_pretty(&wrapper)?; - json.push_str("\n"); + json.push('\n'); fs::write(&filepath, json)?; From 2b21351b1b5145caf7e775b97f0ccec252dbdcbe Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 17:27:32 -0500 Subject: [PATCH 36/44] Format cue --- website/cue/reference/remap.cue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/cue/reference/remap.cue b/website/cue/reference/remap.cue index 94203257171f7..9b4f92638b8d1 100644 --- a/website/cue/reference/remap.cue +++ b/website/cue/reference/remap.cue @@ -29,7 +29,7 @@ package metadata #Example: { #BaseExample - input?: #Event + input?: #Event output?: #Event | [#Event, ...#Event] } From 23cde3c810f8223599ddd0b8c665a47869290e15 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 17:35:57 -0500 Subject: [PATCH 37/44] Add base64 encoded letters to spellcheck ignore --- .github/actions/spelling/expect.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index edc77d73e5612..77435927aeb5f 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -677,3 +677,28 @@ zork zorp zsherman zulip +QAAAA +LAAAAPAd +VGhl +FAJs +VISU +ISU +Ayv +Bym +MGkzw +TLp +LOk +vsiz +Bpd +Glu +Nvb +ZWVs +CBm +Fyd +Uge +Nhbid +Qgb +IGRI +Vzc +Ugc +IGhhdm From c43139e83658ca693135b02613fff24a3cabcb29 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 24 Feb 2026 17:43:58 -0500 Subject: [PATCH 38/44] Add all unrecognized words to expect.txt --- .github/actions/spelling/expect.txt | 167 +++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 18 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 77435927aeb5f..f9150d1f833fa 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -677,28 +677,159 @@ zork zorp zsherman zulip -QAAAA -LAAAAPAd -VGhl -FAJs -VISU -ISU +AAAAA +AAAAAAAAAAAADAw +AAAAAQAAAAAAAQJo +AAAEAAQAAKQIAAACAAAAMAAo +AAIBUa +AAQ +AAluby +ABAAAp +ACGAEi +ADw +AGAAb +Agb +Agiw Ayv -Bym -MGkzw -TLp -LOk -vsiz +BCJNGGB +BFEKPXCj +BNABAUAAADk +BTRV +Bkbn Bpd -Glu -Nvb -ZWVs +Bvdm +Bym +Bzd CBm +CBqd +CODVA +CRW +Cgdzb +Clb +EAAAAAAAAAAAAAAAAAAAAAAq +ECABBQ +EIAx +Evnmki +FABI +FAJs +FOOBARBAZ +Fpb +Fsd +Fworld Fyd -Uge +GCo +GFk +GFtc +GUgc +GVk +Ghl +Glu +Gxl +Gxv +HJpbmcgdm +Hsj +IAAAAAAAA +IAAAABAAAAAAABCWZh +IAENu +IDEz +IERTIG +IFdvcmxk +IGRI +IGRl +IGVu +IGhhdm +IGp +IGxhenkg +IHF +IOA +ISU +IWj +Igg +Iicz +JJTk +JVch +Jvd +Jwl +Jwry +Jyb +KBj +KLUv +Kqhcf +LAAAAPAd +LGcu +LKx +LOk +Lzk +MGkzw +Mgb +NBQA +NQdle Nhbid +Njb +Nvb +Nxaarsyx +Oxj +PFj +Pfm +QAAAA +QAAAABy +QAABg +QBY +QBedq +QEAYs +QOFK Qgb -IGRI -Vzc +RQA +RQX +SBkb +TLp +UDY Ugc -IGhhdm +Uge +VEIRk +VGhl +VHdzs +VISU +VNMU +VSM +Vgz +Vib +Vsb +Vzc +WFs +WNl +WNr +WVma +WVs +XBz +XVp +Xsb +YWx +YXNl +ZGlu +ZLM +ZSBt +ZSwgbm +ZWMt +ZWVs +ZWhlb +ZXIg +Zvci +Zvd +Zve +barbaz +bwwc +ecom +fiibar +hpbm +hpbmcgd +httpbin +ndots +nfoo +qtype +tbar +vectordevlower +vsiz +wcy +xmlhttp +zook From 21fc3bbdf26f9ab783ab0c8a7fabc7137857989b Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 26 Feb 2026 15:46:38 -0500 Subject: [PATCH 39/44] Update input to json value --- vdev/src/commands/build/vrl_docs.rs | 7 +++++-- website/cue/reference/remap.cue | 2 +- website/cue/reference/remap/functions/array.cue | 8 +++++++- website/cue/reference/remap/functions/bool.cue | 4 +++- website/cue/reference/remap/functions/get.cue | 4 +++- website/cue/reference/remap/functions/remove.cue | 4 +++- website/cue/reference/remap/functions/set.cue | 4 +++- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 215d958d16f1a..09b39d4b1a0eb 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -72,7 +72,7 @@ struct ExampleDoc { title: String, source: String, #[serde(skip_serializing_if = "Option::is_none")] - input: Option, + input: Option, #[serde(skip_serializing_if = "Option::is_none")] r#return: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -177,7 +177,10 @@ fn build_function_doc(func: &dyn Function) -> FunctionDoc { let source = source.to_string(); let title = title.to_string(); - let input = input.map(String::from); + let input = input.map(|s| { + serde_json::from_str(s) + .expect("VRL example input must be valid JSON") + }); ExampleDoc { title, source, diff --git a/website/cue/reference/remap.cue b/website/cue/reference/remap.cue index 9b4f92638b8d1..fdbf88a259e48 100644 --- a/website/cue/reference/remap.cue +++ b/website/cue/reference/remap.cue @@ -35,7 +35,7 @@ package metadata #FunctionExample: { #BaseExample - input?: string + input?: {...} } #Type: "any" | "array" | "boolean" | "float" | "integer" | "object" | "null" | "path" | "string" | "regex" | "timestamp" diff --git a/website/cue/reference/remap/functions/array.cue b/website/cue/reference/remap/functions/array.cue index bfe95f1a9635b..f2638eae73eca 100644 --- a/website/cue/reference/remap/functions/array.cue +++ b/website/cue/reference/remap/functions/array.cue @@ -32,7 +32,13 @@ { "title": "Declare an array type", "source": "array!(.value)", - "input": "{\"value\": [1, 2, 3]}", + "input": { + "value": [ + 1, + 2, + 3 + ] + }, "return": [ 1, 2, diff --git a/website/cue/reference/remap/functions/bool.cue b/website/cue/reference/remap/functions/bool.cue index d5793bce12b72..861976dc23bc9 100644 --- a/website/cue/reference/remap/functions/bool.cue +++ b/website/cue/reference/remap/functions/bool.cue @@ -42,7 +42,9 @@ { "title": "Valid Boolean from path", "source": "bool!(.value)", - "input": "{ \"value\": true }", + "input": { + "value": true + }, "return": true } ], diff --git a/website/cue/reference/remap/functions/get.cue b/website/cue/reference/remap/functions/get.cue index 58b7099ae0cc5..be16483ee2c3e 100644 --- a/website/cue/reference/remap/functions/get.cue +++ b/website/cue/reference/remap/functions/get.cue @@ -67,7 +67,9 @@ { "title": "External target", "source": "get!(value: ., path: [\"foo\"])", - "input": "{ \"foo\": true }", + "input": { + "foo": true + }, "return": true }, { diff --git a/website/cue/reference/remap/functions/remove.cue b/website/cue/reference/remap/functions/remove.cue index fadddb6dac360..bd6d0082d39dd 100644 --- a/website/cue/reference/remap/functions/remove.cue +++ b/website/cue/reference/remap/functions/remove.cue @@ -95,7 +95,9 @@ { "title": "External target", "source": "remove!(value: ., path: [\"foo\"])", - "input": "{ \"foo\": true }", + "input": { + "foo": true + }, "return": {} }, { diff --git a/website/cue/reference/remap/functions/set.cue b/website/cue/reference/remap/functions/set.cue index a32fb8b10f168..f4cc64e9c8043 100644 --- a/website/cue/reference/remap/functions/set.cue +++ b/website/cue/reference/remap/functions/set.cue @@ -92,7 +92,9 @@ { "title": "External target", "source": "set!(value: ., path: [\"bar\"], data: \"baz\")", - "input": "{ \"foo\": true }", + "input": { + "foo": true + }, "return": { "foo": true, "bar": "baz" From a75174c3eae1dcefce581380ee3421cc5f97b57a Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 26 Feb 2026 19:18:39 -0500 Subject: [PATCH 40/44] Use branch VRL and use VRL generation code --- Cargo.lock | 2 +- Cargo.toml | 2 +- vdev/src/commands/build/vrl_docs.rs | 250 ++--------------- .../cue/reference/remap/functions/.gitignore | 1 + website/cue/reference/remap/functions/abs.cue | 50 ---- .../functions/aggregate_vector_metrics.cue | 79 ------ .../cue/reference/remap/functions/append.cue | 48 ---- .../cue/reference/remap/functions/array.cue | 67 ----- .../cue/reference/remap/functions/assert.cue | 59 ---- .../reference/remap/functions/assert_eq.cue | 64 ----- .../reference/remap/functions/basename.cue | 54 ---- .../cue/reference/remap/functions/bool.cue | 55 ---- .../reference/remap/functions/camelcase.cue | 60 ---- .../cue/reference/remap/functions/ceil.cue | 59 ---- .../cue/reference/remap/functions/chunks.cue | 61 ---- .../remap/functions/community_id.cue | 90 ------ .../cue/reference/remap/functions/compact.cue | 132 --------- .../reference/remap/functions/contains.cue | 57 ---- .../remap/functions/contains_all.cue | 61 ---- website/cue/reference/remap/functions/crc.cue | 167 ----------- .../remap/functions/decode_base16.cue | 43 --- .../remap/functions/decode_base64.cue | 56 ---- .../remap/functions/decode_charset.cue | 56 ---- .../reference/remap/functions/decode_gzip.cue | 38 --- .../reference/remap/functions/decode_lz4.cue | 64 ----- .../remap/functions/decode_mime_q.cue | 48 ---- .../remap/functions/decode_percent.cue | 35 --- .../remap/functions/decode_punycode.cue | 57 ---- .../remap/functions/decode_snappy.cue | 38 --- .../reference/remap/functions/decode_zlib.cue | 38 --- .../reference/remap/functions/decode_zstd.cue | 38 --- .../cue/reference/remap/functions/decrypt.cue | 69 ----- .../reference/remap/functions/decrypt_ip.cue | 79 ------ website/cue/reference/remap/functions/del.cue | 91 ------ .../cue/reference/remap/functions/dirname.cue | 58 ---- .../reference/remap/functions/dns_lookup.cue | 264 ------------------ .../reference/remap/functions/downcase.cue | 40 --- .../remap/functions/encode_base16.cue | 35 --- .../remap/functions/encode_base64.cue | 72 ----- .../remap/functions/encode_charset.cue | 56 ---- .../reference/remap/functions/encode_gzip.cue | 44 --- .../reference/remap/functions/encode_json.cue | 49 ---- .../remap/functions/encode_key_value.cue | 102 ------- .../remap/functions/encode_logfmt.cue | 65 ----- .../reference/remap/functions/encode_lz4.cue | 44 --- .../remap/functions/encode_percent.cue | 65 ----- .../remap/functions/encode_proto.cue | 55 ---- .../remap/functions/encode_punycode.cue | 62 ---- .../remap/functions/encode_snappy.cue | 38 --- .../reference/remap/functions/encode_zlib.cue | 44 --- .../reference/remap/functions/encode_zstd.cue | 44 --- .../cue/reference/remap/functions/encrypt.cue | 69 ----- .../reference/remap/functions/encrypt_ip.cue | 74 ----- .../reference/remap/functions/ends_with.cue | 62 ---- .../cue/reference/remap/functions/exists.cue | 45 --- .../cue/reference/remap/functions/filter.cue | 54 ---- .../cue/reference/remap/functions/find.cue | 73 ----- .../find_enrichment_table_records.cue | 127 --------- .../remap/functions/find_vector_metrics.cue | 73 ----- .../cue/reference/remap/functions/flatten.cue | 75 ----- .../cue/reference/remap/functions/float.cue | 52 ---- .../cue/reference/remap/functions/floor.cue | 54 ---- .../reference/remap/functions/for_each.cue | 50 ---- .../reference/remap/functions/format_int.cue | 57 ---- .../remap/functions/format_number.cue | 71 ----- .../remap/functions/format_timestamp.cue | 66 ----- .../remap/functions/from_unix_timestamp.cue | 65 ----- website/cue/reference/remap/functions/get.cue | 100 ------- .../functions/get_enrichment_table_record.cue | 94 ------- .../reference/remap/functions/get_env_var.cue | 39 --- .../remap/functions/get_hostname.cue | 29 -- .../reference/remap/functions/get_secret.cue | 41 --- .../remap/functions/get_timezone_name.cue | 29 -- .../remap/functions/get_vector_metric.cue | 70 ----- .../reference/remap/functions/haversine.cue | 82 ------ .../cue/reference/remap/functions/hmac.cue | 74 ----- .../remap/functions/http_request.cue | 112 -------- .../reference/remap/functions/includes.cue | 53 ---- website/cue/reference/remap/functions/int.cue | 52 ---- .../cue/reference/remap/functions/ip_aton.cue | 38 --- .../remap/functions/ip_cidr_contains.cue | 68 ----- .../cue/reference/remap/functions/ip_ntoa.cue | 38 --- .../cue/reference/remap/functions/ip_ntop.cue | 46 --- .../cue/reference/remap/functions/ip_pton.cue | 46 --- .../reference/remap/functions/ip_subnet.cue | 60 ---- .../reference/remap/functions/ip_to_ipv6.cue | 42 --- .../remap/functions/ipv6_to_ipv4.cue | 42 --- .../reference/remap/functions/is_array.cue | 54 ---- .../reference/remap/functions/is_boolean.cue | 49 ---- .../reference/remap/functions/is_empty.cue | 66 ----- .../reference/remap/functions/is_float.cue | 54 ---- .../reference/remap/functions/is_integer.cue | 49 ---- .../cue/reference/remap/functions/is_ipv4.cue | 49 ---- .../cue/reference/remap/functions/is_ipv6.cue | 49 ---- .../cue/reference/remap/functions/is_json.cue | 75 ----- .../cue/reference/remap/functions/is_null.cue | 49 ---- .../reference/remap/functions/is_nullish.cue | 59 ---- .../reference/remap/functions/is_object.cue | 49 ---- .../reference/remap/functions/is_regex.cue | 49 ---- .../reference/remap/functions/is_string.cue | 54 ---- .../remap/functions/is_timestamp.cue | 49 ---- .../cue/reference/remap/functions/join.cue | 48 ---- .../reference/remap/functions/kebabcase.cue | 60 ---- .../cue/reference/remap/functions/keys.cue | 41 --- .../cue/reference/remap/functions/length.cue | 57 ---- website/cue/reference/remap/functions/log.cue | 65 ----- .../reference/remap/functions/map_keys.cue | 77 ----- .../reference/remap/functions/map_values.cue | 67 ----- .../cue/reference/remap/functions/match.cue | 48 ---- .../reference/remap/functions/match_any.cue | 48 ---- .../reference/remap/functions/match_array.cue | 67 ----- .../remap/functions/match_datadog_query.cue | 58 ---- website/cue/reference/remap/functions/md5.cue | 35 --- .../cue/reference/remap/functions/merge.cue | 78 ------ website/cue/reference/remap/functions/mod.cue | 51 ---- website/cue/reference/remap/functions/now.cue | 26 -- .../cue/reference/remap/functions/object.cue | 50 ---- .../remap/functions/object_from_array.cue | 70 ----- .../remap/functions/parse_apache_log.cue | 108 ------- .../remap/functions/parse_aws_alb_log.cue | 118 -------- ...ws_cloudwatch_log_subscription_message.cue | 53 ---- .../functions/parse_aws_vpc_flow_log.cue | 108 ------- .../reference/remap/functions/parse_bytes.cue | 95 ------- .../reference/remap/functions/parse_cbor.cue | 77 ----- .../reference/remap/functions/parse_cef.cue | 150 ---------- .../remap/functions/parse_common_log.cue | 79 ------ .../reference/remap/functions/parse_csv.cue | 63 ----- .../remap/functions/parse_dnstap.cue | 148 ---------- .../remap/functions/parse_duration.cue | 63 ----- .../reference/remap/functions/parse_etld.cue | 86 ------ .../reference/remap/functions/parse_float.cue | 48 ---- .../reference/remap/functions/parse_glog.cue | 45 --- .../reference/remap/functions/parse_grok.cue | 53 ---- .../reference/remap/functions/parse_groks.cue | 81 ------ .../remap/functions/parse_influxdb.cue | 106 ------- .../reference/remap/functions/parse_int.cue | 67 ----- .../reference/remap/functions/parse_json.cue | 106 ------- .../remap/functions/parse_key_value.cue | 145 ---------- .../reference/remap/functions/parse_klog.cue | 48 ---- .../functions/parse_linux_authorization.cue | 47 ---- .../remap/functions/parse_logfmt.cue | 62 ---- .../remap/functions/parse_nginx_log.cue | 131 --------- .../reference/remap/functions/parse_proto.cue | 66 ----- .../remap/functions/parse_query_string.cue | 63 ----- .../reference/remap/functions/parse_regex.cue | 100 ------- .../remap/functions/parse_regex_all.cue | 123 -------- .../remap/functions/parse_ruby_hash.cue | 48 ---- .../remap/functions/parse_syslog.cue | 57 ---- .../remap/functions/parse_timestamp.cue | 61 ---- .../remap/functions/parse_tokens.cue | 47 ---- .../reference/remap/functions/parse_url.cue | 72 ----- .../remap/functions/parse_user_agent.cue | 110 -------- .../reference/remap/functions/parse_xml.cue | 123 -------- .../reference/remap/functions/pascalcase.cue | 60 ---- website/cue/reference/remap/functions/pop.cue | 41 --- .../cue/reference/remap/functions/push.cue | 57 ---- .../reference/remap/functions/random_bool.cue | 26 -- .../remap/functions/random_bytes.cue | 44 --- .../remap/functions/random_float.cue | 46 --- .../reference/remap/functions/random_int.cue | 46 --- .../cue/reference/remap/functions/redact.cue | 84 ------ .../cue/reference/remap/functions/remove.cue | 137 --------- .../remap/functions/remove_secret.cue | 35 --- .../cue/reference/remap/functions/replace.cue | 81 ------ .../remap/functions/replace_with.cue | 77 ----- .../reference/remap/functions/reverse_dns.cue | 35 --- .../cue/reference/remap/functions/round.cue | 64 ----- .../remap/functions/screamingsnakecase.cue | 60 ---- .../cue/reference/remap/functions/seahash.cue | 40 --- website/cue/reference/remap/functions/set.cue | 128 --------- .../reference/remap/functions/set_secret.cue | 43 --- .../remap/functions/set_semantic_meaning.cue | 46 --- .../cue/reference/remap/functions/sha1.cue | 35 --- .../cue/reference/remap/functions/sha2.cue | 62 ---- .../cue/reference/remap/functions/sha3.cue | 60 ---- .../remap/functions/shannon_entropy.cue | 64 ----- .../cue/reference/remap/functions/sieve.cue | 71 ----- .../cue/reference/remap/functions/slice.cue | 72 ----- .../reference/remap/functions/snakecase.cue | 77 ----- .../cue/reference/remap/functions/split.cue | 84 ------ .../reference/remap/functions/split_path.cue | 63 ----- .../reference/remap/functions/starts_with.cue | 62 ---- .../cue/reference/remap/functions/string.cue | 47 ---- .../functions/strip_ansi_escape_codes.cue | 28 -- .../remap/functions/strip_whitespace.cue | 50 ---- .../cue/reference/remap/functions/strlen.cue | 35 --- .../remap/functions/tag_types_externally.cue | 70 ----- .../cue/reference/remap/functions/tally.cue | 39 --- .../reference/remap/functions/tally_value.cue | 43 --- .../reference/remap/functions/timestamp.cue | 47 ---- .../cue/reference/remap/functions/to_bool.cue | 136 --------- .../reference/remap/functions/to_float.cue | 95 ------- .../cue/reference/remap/functions/to_int.cue | 97 ------- .../reference/remap/functions/to_regex.cue | 44 --- .../reference/remap/functions/to_string.cue | 89 ------ .../remap/functions/to_syslog_facility.cue | 43 --- .../functions/to_syslog_facility_code.cue | 43 --- .../remap/functions/to_syslog_level.cue | 43 --- .../remap/functions/to_syslog_severity.cue | 46 --- .../remap/functions/to_unix_timestamp.cue | 67 ----- .../reference/remap/functions/truncate.cue | 64 ----- .../reference/remap/functions/type_def.cue | 37 --- .../reference/remap/functions/unflatten.cue | 106 ------- .../cue/reference/remap/functions/unique.cue | 39 --- .../cue/reference/remap/functions/unnest.cue | 68 ----- .../cue/reference/remap/functions/upcase.cue | 35 --- .../remap/functions/uuid_from_friendly_id.cue | 39 --- .../cue/reference/remap/functions/uuid_v4.cue | 26 -- .../cue/reference/remap/functions/uuid_v7.cue | 46 --- .../remap/functions/validate_json_schema.cue | 79 ------ .../cue/reference/remap/functions/values.cue | 56 ---- .../cue/reference/remap/functions/xxhash.cue | 68 ----- website/cue/reference/remap/functions/zip.cue | 117 -------- 213 files changed, 24 insertions(+), 13802 deletions(-) create mode 100644 website/cue/reference/remap/functions/.gitignore delete mode 100644 website/cue/reference/remap/functions/abs.cue delete mode 100644 website/cue/reference/remap/functions/aggregate_vector_metrics.cue delete mode 100644 website/cue/reference/remap/functions/append.cue delete mode 100644 website/cue/reference/remap/functions/array.cue delete mode 100644 website/cue/reference/remap/functions/assert.cue delete mode 100644 website/cue/reference/remap/functions/assert_eq.cue delete mode 100644 website/cue/reference/remap/functions/basename.cue delete mode 100644 website/cue/reference/remap/functions/bool.cue delete mode 100644 website/cue/reference/remap/functions/camelcase.cue delete mode 100644 website/cue/reference/remap/functions/ceil.cue delete mode 100644 website/cue/reference/remap/functions/chunks.cue delete mode 100644 website/cue/reference/remap/functions/community_id.cue delete mode 100644 website/cue/reference/remap/functions/compact.cue delete mode 100644 website/cue/reference/remap/functions/contains.cue delete mode 100644 website/cue/reference/remap/functions/contains_all.cue delete mode 100644 website/cue/reference/remap/functions/crc.cue delete mode 100644 website/cue/reference/remap/functions/decode_base16.cue delete mode 100644 website/cue/reference/remap/functions/decode_base64.cue delete mode 100644 website/cue/reference/remap/functions/decode_charset.cue delete mode 100644 website/cue/reference/remap/functions/decode_gzip.cue delete mode 100644 website/cue/reference/remap/functions/decode_lz4.cue delete mode 100644 website/cue/reference/remap/functions/decode_mime_q.cue delete mode 100644 website/cue/reference/remap/functions/decode_percent.cue delete mode 100644 website/cue/reference/remap/functions/decode_punycode.cue delete mode 100644 website/cue/reference/remap/functions/decode_snappy.cue delete mode 100644 website/cue/reference/remap/functions/decode_zlib.cue delete mode 100644 website/cue/reference/remap/functions/decode_zstd.cue delete mode 100644 website/cue/reference/remap/functions/decrypt.cue delete mode 100644 website/cue/reference/remap/functions/decrypt_ip.cue delete mode 100644 website/cue/reference/remap/functions/del.cue delete mode 100644 website/cue/reference/remap/functions/dirname.cue delete mode 100644 website/cue/reference/remap/functions/dns_lookup.cue delete mode 100644 website/cue/reference/remap/functions/downcase.cue delete mode 100644 website/cue/reference/remap/functions/encode_base16.cue delete mode 100644 website/cue/reference/remap/functions/encode_base64.cue delete mode 100644 website/cue/reference/remap/functions/encode_charset.cue delete mode 100644 website/cue/reference/remap/functions/encode_gzip.cue delete mode 100644 website/cue/reference/remap/functions/encode_json.cue delete mode 100644 website/cue/reference/remap/functions/encode_key_value.cue delete mode 100644 website/cue/reference/remap/functions/encode_logfmt.cue delete mode 100644 website/cue/reference/remap/functions/encode_lz4.cue delete mode 100644 website/cue/reference/remap/functions/encode_percent.cue delete mode 100644 website/cue/reference/remap/functions/encode_proto.cue delete mode 100644 website/cue/reference/remap/functions/encode_punycode.cue delete mode 100644 website/cue/reference/remap/functions/encode_snappy.cue delete mode 100644 website/cue/reference/remap/functions/encode_zlib.cue delete mode 100644 website/cue/reference/remap/functions/encode_zstd.cue delete mode 100644 website/cue/reference/remap/functions/encrypt.cue delete mode 100644 website/cue/reference/remap/functions/encrypt_ip.cue delete mode 100644 website/cue/reference/remap/functions/ends_with.cue delete mode 100644 website/cue/reference/remap/functions/exists.cue delete mode 100644 website/cue/reference/remap/functions/filter.cue delete mode 100644 website/cue/reference/remap/functions/find.cue delete mode 100644 website/cue/reference/remap/functions/find_enrichment_table_records.cue delete mode 100644 website/cue/reference/remap/functions/find_vector_metrics.cue delete mode 100644 website/cue/reference/remap/functions/flatten.cue delete mode 100644 website/cue/reference/remap/functions/float.cue delete mode 100644 website/cue/reference/remap/functions/floor.cue delete mode 100644 website/cue/reference/remap/functions/for_each.cue delete mode 100644 website/cue/reference/remap/functions/format_int.cue delete mode 100644 website/cue/reference/remap/functions/format_number.cue delete mode 100644 website/cue/reference/remap/functions/format_timestamp.cue delete mode 100644 website/cue/reference/remap/functions/from_unix_timestamp.cue delete mode 100644 website/cue/reference/remap/functions/get.cue delete mode 100644 website/cue/reference/remap/functions/get_enrichment_table_record.cue delete mode 100644 website/cue/reference/remap/functions/get_env_var.cue delete mode 100644 website/cue/reference/remap/functions/get_hostname.cue delete mode 100644 website/cue/reference/remap/functions/get_secret.cue delete mode 100644 website/cue/reference/remap/functions/get_timezone_name.cue delete mode 100644 website/cue/reference/remap/functions/get_vector_metric.cue delete mode 100644 website/cue/reference/remap/functions/haversine.cue delete mode 100644 website/cue/reference/remap/functions/hmac.cue delete mode 100644 website/cue/reference/remap/functions/http_request.cue delete mode 100644 website/cue/reference/remap/functions/includes.cue delete mode 100644 website/cue/reference/remap/functions/int.cue delete mode 100644 website/cue/reference/remap/functions/ip_aton.cue delete mode 100644 website/cue/reference/remap/functions/ip_cidr_contains.cue delete mode 100644 website/cue/reference/remap/functions/ip_ntoa.cue delete mode 100644 website/cue/reference/remap/functions/ip_ntop.cue delete mode 100644 website/cue/reference/remap/functions/ip_pton.cue delete mode 100644 website/cue/reference/remap/functions/ip_subnet.cue delete mode 100644 website/cue/reference/remap/functions/ip_to_ipv6.cue delete mode 100644 website/cue/reference/remap/functions/ipv6_to_ipv4.cue delete mode 100644 website/cue/reference/remap/functions/is_array.cue delete mode 100644 website/cue/reference/remap/functions/is_boolean.cue delete mode 100644 website/cue/reference/remap/functions/is_empty.cue delete mode 100644 website/cue/reference/remap/functions/is_float.cue delete mode 100644 website/cue/reference/remap/functions/is_integer.cue delete mode 100644 website/cue/reference/remap/functions/is_ipv4.cue delete mode 100644 website/cue/reference/remap/functions/is_ipv6.cue delete mode 100644 website/cue/reference/remap/functions/is_json.cue delete mode 100644 website/cue/reference/remap/functions/is_null.cue delete mode 100644 website/cue/reference/remap/functions/is_nullish.cue delete mode 100644 website/cue/reference/remap/functions/is_object.cue delete mode 100644 website/cue/reference/remap/functions/is_regex.cue delete mode 100644 website/cue/reference/remap/functions/is_string.cue delete mode 100644 website/cue/reference/remap/functions/is_timestamp.cue delete mode 100644 website/cue/reference/remap/functions/join.cue delete mode 100644 website/cue/reference/remap/functions/kebabcase.cue delete mode 100644 website/cue/reference/remap/functions/keys.cue delete mode 100644 website/cue/reference/remap/functions/length.cue delete mode 100644 website/cue/reference/remap/functions/log.cue delete mode 100644 website/cue/reference/remap/functions/map_keys.cue delete mode 100644 website/cue/reference/remap/functions/map_values.cue delete mode 100644 website/cue/reference/remap/functions/match.cue delete mode 100644 website/cue/reference/remap/functions/match_any.cue delete mode 100644 website/cue/reference/remap/functions/match_array.cue delete mode 100644 website/cue/reference/remap/functions/match_datadog_query.cue delete mode 100644 website/cue/reference/remap/functions/md5.cue delete mode 100644 website/cue/reference/remap/functions/merge.cue delete mode 100644 website/cue/reference/remap/functions/mod.cue delete mode 100644 website/cue/reference/remap/functions/now.cue delete mode 100644 website/cue/reference/remap/functions/object.cue delete mode 100644 website/cue/reference/remap/functions/object_from_array.cue delete mode 100644 website/cue/reference/remap/functions/parse_apache_log.cue delete mode 100644 website/cue/reference/remap/functions/parse_aws_alb_log.cue delete mode 100644 website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue delete mode 100644 website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue delete mode 100644 website/cue/reference/remap/functions/parse_bytes.cue delete mode 100644 website/cue/reference/remap/functions/parse_cbor.cue delete mode 100644 website/cue/reference/remap/functions/parse_cef.cue delete mode 100644 website/cue/reference/remap/functions/parse_common_log.cue delete mode 100644 website/cue/reference/remap/functions/parse_csv.cue delete mode 100644 website/cue/reference/remap/functions/parse_dnstap.cue delete mode 100644 website/cue/reference/remap/functions/parse_duration.cue delete mode 100644 website/cue/reference/remap/functions/parse_etld.cue delete mode 100644 website/cue/reference/remap/functions/parse_float.cue delete mode 100644 website/cue/reference/remap/functions/parse_glog.cue delete mode 100644 website/cue/reference/remap/functions/parse_grok.cue delete mode 100644 website/cue/reference/remap/functions/parse_groks.cue delete mode 100644 website/cue/reference/remap/functions/parse_influxdb.cue delete mode 100644 website/cue/reference/remap/functions/parse_int.cue delete mode 100644 website/cue/reference/remap/functions/parse_json.cue delete mode 100644 website/cue/reference/remap/functions/parse_key_value.cue delete mode 100644 website/cue/reference/remap/functions/parse_klog.cue delete mode 100644 website/cue/reference/remap/functions/parse_linux_authorization.cue delete mode 100644 website/cue/reference/remap/functions/parse_logfmt.cue delete mode 100644 website/cue/reference/remap/functions/parse_nginx_log.cue delete mode 100644 website/cue/reference/remap/functions/parse_proto.cue delete mode 100644 website/cue/reference/remap/functions/parse_query_string.cue delete mode 100644 website/cue/reference/remap/functions/parse_regex.cue delete mode 100644 website/cue/reference/remap/functions/parse_regex_all.cue delete mode 100644 website/cue/reference/remap/functions/parse_ruby_hash.cue delete mode 100644 website/cue/reference/remap/functions/parse_syslog.cue delete mode 100644 website/cue/reference/remap/functions/parse_timestamp.cue delete mode 100644 website/cue/reference/remap/functions/parse_tokens.cue delete mode 100644 website/cue/reference/remap/functions/parse_url.cue delete mode 100644 website/cue/reference/remap/functions/parse_user_agent.cue delete mode 100644 website/cue/reference/remap/functions/parse_xml.cue delete mode 100644 website/cue/reference/remap/functions/pascalcase.cue delete mode 100644 website/cue/reference/remap/functions/pop.cue delete mode 100644 website/cue/reference/remap/functions/push.cue delete mode 100644 website/cue/reference/remap/functions/random_bool.cue delete mode 100644 website/cue/reference/remap/functions/random_bytes.cue delete mode 100644 website/cue/reference/remap/functions/random_float.cue delete mode 100644 website/cue/reference/remap/functions/random_int.cue delete mode 100644 website/cue/reference/remap/functions/redact.cue delete mode 100644 website/cue/reference/remap/functions/remove.cue delete mode 100644 website/cue/reference/remap/functions/remove_secret.cue delete mode 100644 website/cue/reference/remap/functions/replace.cue delete mode 100644 website/cue/reference/remap/functions/replace_with.cue delete mode 100644 website/cue/reference/remap/functions/reverse_dns.cue delete mode 100644 website/cue/reference/remap/functions/round.cue delete mode 100644 website/cue/reference/remap/functions/screamingsnakecase.cue delete mode 100644 website/cue/reference/remap/functions/seahash.cue delete mode 100644 website/cue/reference/remap/functions/set.cue delete mode 100644 website/cue/reference/remap/functions/set_secret.cue delete mode 100644 website/cue/reference/remap/functions/set_semantic_meaning.cue delete mode 100644 website/cue/reference/remap/functions/sha1.cue delete mode 100644 website/cue/reference/remap/functions/sha2.cue delete mode 100644 website/cue/reference/remap/functions/sha3.cue delete mode 100644 website/cue/reference/remap/functions/shannon_entropy.cue delete mode 100644 website/cue/reference/remap/functions/sieve.cue delete mode 100644 website/cue/reference/remap/functions/slice.cue delete mode 100644 website/cue/reference/remap/functions/snakecase.cue delete mode 100644 website/cue/reference/remap/functions/split.cue delete mode 100644 website/cue/reference/remap/functions/split_path.cue delete mode 100644 website/cue/reference/remap/functions/starts_with.cue delete mode 100644 website/cue/reference/remap/functions/string.cue delete mode 100644 website/cue/reference/remap/functions/strip_ansi_escape_codes.cue delete mode 100644 website/cue/reference/remap/functions/strip_whitespace.cue delete mode 100644 website/cue/reference/remap/functions/strlen.cue delete mode 100644 website/cue/reference/remap/functions/tag_types_externally.cue delete mode 100644 website/cue/reference/remap/functions/tally.cue delete mode 100644 website/cue/reference/remap/functions/tally_value.cue delete mode 100644 website/cue/reference/remap/functions/timestamp.cue delete mode 100644 website/cue/reference/remap/functions/to_bool.cue delete mode 100644 website/cue/reference/remap/functions/to_float.cue delete mode 100644 website/cue/reference/remap/functions/to_int.cue delete mode 100644 website/cue/reference/remap/functions/to_regex.cue delete mode 100644 website/cue/reference/remap/functions/to_string.cue delete mode 100644 website/cue/reference/remap/functions/to_syslog_facility.cue delete mode 100644 website/cue/reference/remap/functions/to_syslog_facility_code.cue delete mode 100644 website/cue/reference/remap/functions/to_syslog_level.cue delete mode 100644 website/cue/reference/remap/functions/to_syslog_severity.cue delete mode 100644 website/cue/reference/remap/functions/to_unix_timestamp.cue delete mode 100644 website/cue/reference/remap/functions/truncate.cue delete mode 100644 website/cue/reference/remap/functions/type_def.cue delete mode 100644 website/cue/reference/remap/functions/unflatten.cue delete mode 100644 website/cue/reference/remap/functions/unique.cue delete mode 100644 website/cue/reference/remap/functions/unnest.cue delete mode 100644 website/cue/reference/remap/functions/upcase.cue delete mode 100644 website/cue/reference/remap/functions/uuid_from_friendly_id.cue delete mode 100644 website/cue/reference/remap/functions/uuid_v4.cue delete mode 100644 website/cue/reference/remap/functions/uuid_v7.cue delete mode 100644 website/cue/reference/remap/functions/validate_json_schema.cue delete mode 100644 website/cue/reference/remap/functions/values.cue delete mode 100644 website/cue/reference/remap/functions/xxhash.cue delete mode 100644 website/cue/reference/remap/functions/zip.cue diff --git a/Cargo.lock b/Cargo.lock index 5c16a281c486f..8a64a27b6b9e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13101,7 +13101,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=main#74f9a58fea5ea39f53c614fb4a5d7521b85c0a46" +source = "git+https://github.com/vectordotdev/vrl.git?branch=doc-generation#2fd9f546c560ab80c4f0c0dc28e5f9d638a753db" dependencies = [ "aes", "aes-siv", diff --git a/Cargo.toml b/Cargo.toml index 84790899d37d7..878f552e6775a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -215,7 +215,7 @@ vector-common-macros = { path = "lib/vector-common-macros" } vector-lib = { path = "lib/vector-lib", default-features = false, features = ["vrl"] } vector-vrl-category = { path = "lib/vector-vrl/category" } vector-vrl-functions = { path = "lib/vector-vrl/functions" } -vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "main", features = ["arbitrary", "cli", "test", "test_framework"] } +vrl = { git = "https://github.com/vectordotdev/vrl.git", branch = "doc-generation", features = ["arbitrary", "cli", "test", "test_framework"] } mock_instant = { version = "0.6" } serial_test = { version = "3.2" } diff --git a/vdev/src/commands/build/vrl_docs.rs b/vdev/src/commands/build/vrl_docs.rs index 09b39d4b1a0eb..e105ea9cda338 100644 --- a/vdev/src/commands/build/vrl_docs.rs +++ b/vdev/src/commands/build/vrl_docs.rs @@ -2,17 +2,12 @@ use anyhow::Result; use indexmap::IndexMap; use serde::Serialize; use std::{fs, path::PathBuf}; -use vrl::compiler::Function; -use vrl::compiler::value::kind; -use vrl::core::Value; -use vrl::prelude::function::EnumVariant; -use vrl::prelude::{Example, Parameter}; +use vrl::docs::{FunctionDoc, build_functions_doc}; /// Generate VRL function documentation as JSON files. /// -/// This command iterates over all VRL functions available in Vector and generates -/// JSON documentation files that are compatible with the CUE-based documentation -/// pipeline (valid JSON is valid CUE). +/// This command iterates over all VRL functions available in Vector and VRL and +/// generates a generated.cue documentation file with all functions' documentation. #[derive(clap::Args, Debug)] #[command()] pub struct Cli { @@ -28,239 +23,36 @@ struct FunctionDocWrapper { #[derive(Serialize)] struct RemapWrapper { - functions: std::collections::HashMap, -} - -#[derive(Serialize)] -struct FunctionDoc { - anchor: String, - name: String, - category: String, - description: String, - arguments: Vec, - r#return: ReturnDoc, - #[serde(skip_serializing_if = "Vec::is_empty")] - internal_failure_reasons: Vec, - #[serde(skip_serializing_if = "Vec::is_empty")] - examples: Vec, - #[serde(skip_serializing_if = "Vec::is_empty")] - notices: Vec, - pure: bool, -} - -#[derive(Serialize)] -struct ArgumentDoc { - name: String, - description: String, - required: bool, - r#type: Vec, - #[serde(skip_serializing_if = "IndexMap::is_empty")] - r#enum: IndexMap, - #[serde(skip_serializing_if = "Option::is_none")] - default: Option, -} - -#[derive(Serialize)] -struct ReturnDoc { - types: Vec, - #[serde(skip_serializing_if = "Vec::is_empty")] - rules: Vec, -} - -#[derive(Serialize)] -struct ExampleDoc { - title: String, - source: String, - #[serde(skip_serializing_if = "Option::is_none")] - input: Option, - #[serde(skip_serializing_if = "Option::is_none")] - r#return: Option, - #[serde(skip_serializing_if = "Option::is_none")] - raises: Option, + functions: IndexMap, } impl Cli { pub fn exec(self) -> Result<()> { let functions = vector_vrl_functions::all(); - // Ensure output directory exists - fs::create_dir_all(&self.output_dir)?; - - for func in functions { - let doc = build_function_doc(func.as_ref()); - let filename = format!("{}.cue", doc.name); - let filepath = self.output_dir.join(&filename); + let docs = build_functions_doc(&functions); + let functions_map = docs + .into_iter() + .map(|doc| (doc.name.clone(), doc)) + .collect(); - // Wrap in the expected CUE structure - let mut functions_map = std::collections::HashMap::new(); - functions_map.insert(doc.name.clone(), doc); - let wrapper = FunctionDocWrapper { - remap: RemapWrapper { - functions: functions_map, - }, - }; + let wrapper = FunctionDocWrapper { + remap: RemapWrapper { + functions: functions_map, + }, + }; - let mut json = serde_json::to_string_pretty(&wrapper)?; - json.push('\n'); + // Ensure output directory exists + fs::create_dir_all(&self.output_dir)?; - fs::write(&filepath, json)?; + let mut json = serde_json::to_string(&wrapper)?; + json.push('\n'); + let filepath = self.output_dir.join("generated.cue"); + fs::write(&filepath, json)?; - println!("Generated: {}", filepath.display()); - } + println!("Generated: {}", filepath.display()); println!("\nVRL documentation generation complete."); Ok(()) } } - -fn build_function_doc(func: &dyn Function) -> FunctionDoc { - let name = func.identifier().to_string(); - - let arguments: Vec = func - .parameters() - .iter() - .map(|param| { - let Parameter { - keyword, - kind, - required, - description, - default, - enum_variants, - } = param; - - let name = keyword.trim().to_string(); - let description = description.trim().to_string(); - let default = default.map(pretty_value); - let r#type = kind_to_types(*kind); - let r#enum = enum_variants - .unwrap_or_default() - .iter() - .map(|EnumVariant { value, description }| { - (value.to_string(), description.to_string()) - }) - .collect(); - - ArgumentDoc { - name, - description, - required: *required, - r#type, - default, - r#enum, - } - }) - .collect(); - - let examples: Vec = func - .examples() - .iter() - .map(|example| { - let Example { - title, - source, - result, - input, - file: _, - line: _, - } = example; - - let (r#return, raises) = match result { - Ok(result) => { - // Try to parse as JSON, otherwise treat as string - let value = serde_json::from_str(result) - .unwrap_or_else(|_| serde_json::Value::String(result.to_string())); - (Some(value), None) - } - Err(error) => (None, Some(error.to_string())), - }; - - let source = source.to_string(); - let title = title.to_string(); - let input = input.map(|s| { - serde_json::from_str(s) - .expect("VRL example input must be valid JSON") - }); - ExampleDoc { - title, - source, - input, - r#return, - raises, - } - }) - .collect(); - - FunctionDoc { - anchor: name.clone(), - name, - category: func.category().to_string(), - description: trim_str(func.usage()), - arguments, - r#return: ReturnDoc { - types: kind_to_types(func.return_kind()), - rules: trim_slice(func.return_rules()), - }, - internal_failure_reasons: trim_slice(func.internal_failure_reasons()), - examples, - notices: trim_slice(func.notices()), - pure: func.pure(), - } -} - -fn kind_to_types(kind_bits: u16) -> Vec { - // All type bits combined - if (kind_bits & kind::ANY) == kind::ANY { - return vec!["any".to_string()]; - } - - let mut types = Vec::new(); - - if (kind_bits & kind::BYTES) == kind::BYTES { - types.push("string".to_string()); - } - if (kind_bits & kind::INTEGER) == kind::INTEGER { - types.push("integer".to_string()); - } - if (kind_bits & kind::FLOAT) == kind::FLOAT { - types.push("float".to_string()); - } - if (kind_bits & kind::BOOLEAN) == kind::BOOLEAN { - types.push("boolean".to_string()); - } - if (kind_bits & kind::OBJECT) == kind::OBJECT { - types.push("object".to_string()); - } - if (kind_bits & kind::ARRAY) == kind::ARRAY { - types.push("array".to_string()); - } - if (kind_bits & kind::TIMESTAMP) == kind::TIMESTAMP { - types.push("timestamp".to_string()); - } - if (kind_bits & kind::REGEX) == kind::REGEX { - types.push("regex".to_string()); - } - if (kind_bits & kind::NULL) == kind::NULL { - types.push("null".to_string()); - } - - assert!(!types.is_empty(), "kind_bits {kind_bits} produced no types"); - - types -} - -fn pretty_value(v: &Value) -> String { - if let Value::Bytes(b) = v { - str::from_utf8(b).map_or_else(|_| v.to_string(), String::from) - } else { - v.to_string() - } -} - -fn trim_str(s: &'static str) -> String { - s.trim().to_string() -} - -fn trim_slice(slice: &'static [&'static str]) -> Vec { - slice.iter().map(|s| s.trim().to_string()).collect() -} diff --git a/website/cue/reference/remap/functions/.gitignore b/website/cue/reference/remap/functions/.gitignore new file mode 100644 index 0000000000000..89cd6fdc6b606 --- /dev/null +++ b/website/cue/reference/remap/functions/.gitignore @@ -0,0 +1 @@ +generated.cue diff --git a/website/cue/reference/remap/functions/abs.cue b/website/cue/reference/remap/functions/abs.cue deleted file mode 100644 index e20abf0c3a307..0000000000000 --- a/website/cue/reference/remap/functions/abs.cue +++ /dev/null @@ -1,50 +0,0 @@ -{ - "remap": { - "functions": { - "abs": { - "anchor": "abs", - "name": "abs", - "category": "Number", - "description": "Computes the absolute value of `value`.", - "arguments": [ - { - "name": "value", - "description": "The number to calculate the absolute value.", - "required": true, - "type": [ - "integer", - "float" - ] - } - ], - "return": { - "types": [ - "integer", - "float" - ], - "rules": [ - "Returns the absolute value." - ] - }, - "examples": [ - { - "title": "Computes the absolute value of an integer", - "source": "abs(-42)", - "return": 42 - }, - { - "title": "Computes the absolute value of a float", - "source": "abs(-42.2)", - "return": 42.2 - }, - { - "title": "Computes the absolute value of a positive integer", - "source": "abs(10)", - "return": 10 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue b/website/cue/reference/remap/functions/aggregate_vector_metrics.cue deleted file mode 100644 index 2734094b86000..0000000000000 --- a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue +++ /dev/null @@ -1,79 +0,0 @@ -{ - "remap": { - "functions": { - "aggregate_vector_metrics": { - "anchor": "aggregate_vector_metrics", - "name": "aggregate_vector_metrics", - "category": "Metrics", - "description": "Aggregates internal Vector metrics, using one of 4 aggregation functions, filtering by name and optionally by tags. Returns the aggregated value. Only includes counter and gauge metrics.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", - "arguments": [ - { - "name": "function", - "description": "The metric name to search.", - "required": true, - "type": [ - "string" - ], - "enum": { - "sum": "Sum the values of all the matched metrics.", - "avg": "Find the average of the values of all the matched metrics.", - "max": "Find the highest metric value of all the matched metrics.", - "min": "Find the lowest metric value of all the matched metrics." - } - }, - { - "name": "key", - "description": "The metric name to aggregate.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "tags", - "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - } - ], - "return": { - "types": [ - "float", - "null" - ] - }, - "examples": [ - { - "title": "Sum vector internal metrics matching the name", - "source": "aggregate_vector_metrics(\"sum\", \"utilization\")", - "return": 0.5 - }, - { - "title": "Sum vector internal metrics matching the name and tags", - "source": "aggregate_vector_metrics(\"sum\", \"utilization\", tags: {\"component_id\": \"test\"})", - "return": 0.5 - }, - { - "title": "Average of vector internal metrics matching the name", - "source": "aggregate_vector_metrics(\"avg\", \"utilization\")", - "return": 0.5 - }, - { - "title": "Max of vector internal metrics matching the name", - "source": "aggregate_vector_metrics(\"max\", \"utilization\")", - "return": 0.5 - }, - { - "title": "Min of vector internal metrics matching the name", - "source": "aggregate_vector_metrics(\"max\", \"utilization\")", - "return": 0.5 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/append.cue b/website/cue/reference/remap/functions/append.cue deleted file mode 100644 index db2d3391afacf..0000000000000 --- a/website/cue/reference/remap/functions/append.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "append": { - "anchor": "append", - "name": "append", - "category": "Array", - "description": "Appends each item in the `items` array to the end of the `value` array.", - "arguments": [ - { - "name": "value", - "description": "The initial array.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "items", - "description": "The items to append.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "examples": [ - { - "title": "Append to an array", - "source": "append([1, 2], [3, 4])", - "return": [ - 1, - 2, - 3, - 4 - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/array.cue b/website/cue/reference/remap/functions/array.cue deleted file mode 100644 index f2638eae73eca..0000000000000 --- a/website/cue/reference/remap/functions/array.cue +++ /dev/null @@ -1,67 +0,0 @@ -{ - "remap": { - "functions": { - "array": { - "anchor": "array", - "name": "array", - "category": "Type", - "description": "Returns `value` if it is an array, otherwise returns an error. This enables the type checker to guarantee that the returned value is an array and can be used in any function that expects an array.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an array.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Returns the `value` if it's an array.", - "Raises an error if not an array." - ] - }, - "internal_failure_reasons": [ - "`value` is not an array." - ], - "examples": [ - { - "title": "Declare an array type", - "source": "array!(.value)", - "input": { - "value": [ - 1, - 2, - 3 - ] - }, - "return": [ - 1, - 2, - 3 - ] - }, - { - "title": "Valid array literal", - "source": "array([1,2,3])", - "return": [ - 1, - 2, - 3 - ] - }, - { - "title": "Invalid type", - "source": "array!(true)", - "raises": "function call error for \"array\" at (0:12): expected array, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/assert.cue b/website/cue/reference/remap/functions/assert.cue deleted file mode 100644 index 52c483b25b088..0000000000000 --- a/website/cue/reference/remap/functions/assert.cue +++ /dev/null @@ -1,59 +0,0 @@ -{ - "remap": { - "functions": { - "assert": { - "anchor": "assert", - "name": "assert", - "category": "Debug", - "description": "Asserts the `condition`, which must be a Boolean expression. The program is aborted with `message` if the condition evaluates to `false`.", - "arguments": [ - { - "name": "condition", - "description": "The condition to check.", - "required": true, - "type": [ - "boolean" - ] - }, - { - "name": "message", - "description": "An optional custom error message. If the equality assertion fails, `message` is\nappended to the default message prefix. See the [examples](#assert-examples) below\nfor a fully formed log message sample.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "internal_failure_reasons": [ - "`condition` evaluates to `false`." - ], - "examples": [ - { - "title": "Assertion (true) - with message", - "source": "assert!(\"foo\" == \"foo\", message: \"\\\"foo\\\" must be \\\"foo\\\"!\")", - "return": true - }, - { - "title": "Assertion (false) - with message", - "source": "assert!(\"foo\" == \"bar\", message: \"\\\"foo\\\" must be \\\"foo\\\"!\")", - "raises": "function call error for \"assert\" at (0:60): \"foo\" must be \"foo\"!" - }, - { - "title": "Assertion (false) - simple", - "source": "assert!(false)", - "raises": "function call error for \"assert\" at (0:14): assertion failed" - } - ], - "notices": [ - "The `assert` function should be used in a standalone fashion and only when you want\nto abort the program. You should avoid it in logical expressions and other situations\nin which you want the program to continue if the condition evaluates to `false`." - ], - "pure": false - } - } - } -} diff --git a/website/cue/reference/remap/functions/assert_eq.cue b/website/cue/reference/remap/functions/assert_eq.cue deleted file mode 100644 index eaf36428a797b..0000000000000 --- a/website/cue/reference/remap/functions/assert_eq.cue +++ /dev/null @@ -1,64 +0,0 @@ -{ - "remap": { - "functions": { - "assert_eq": { - "anchor": "assert_eq", - "name": "assert_eq", - "category": "Debug", - "description": "Asserts that two expressions, `left` and `right`, have the same value. The program is aborted with `message` if they do not have the same value.", - "arguments": [ - { - "name": "left", - "description": "The value to check for equality against `right`.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "right", - "description": "The value to check for equality against `left`.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "message", - "description": "An optional custom error message. If the equality assertion fails, `message` is\nappended to the default message prefix. See the [examples](#assert_eq-examples)\nbelow for a fully formed log message sample.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Successful assertion", - "source": "assert_eq!(1, 1)", - "return": true - }, - { - "title": "Unsuccessful assertion", - "source": "assert_eq!(127, [1, 2, 3])", - "raises": "function call error for \"assert_eq\" at (0:26): assertion failed: 127 == [1, 2, 3]" - }, - { - "title": "Unsuccessful assertion with custom log message", - "source": "assert_eq!(1, 0, message: \"Unequal integers\")", - "raises": "function call error for \"assert_eq\" at (0:45): Unequal integers" - } - ], - "notices": [ - "The `assert_eq` function should be used in a standalone fashion and only when you want\nto abort the program. You should avoid it in logical expressions and other situations in\nwhich you want the program to continue if the condition evaluates to `false`." - ], - "pure": false - } - } - } -} diff --git a/website/cue/reference/remap/functions/basename.cue b/website/cue/reference/remap/functions/basename.cue deleted file mode 100644 index b45436b443c35..0000000000000 --- a/website/cue/reference/remap/functions/basename.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "basename": { - "anchor": "basename", - "name": "basename", - "category": "String", - "description": "Returns the filename component of the given `path`. This is similar to the Unix `basename` command. If the path ends in a directory separator, the function returns the name of the directory.", - "arguments": [ - { - "name": "value", - "description": "The path from which to extract the basename.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string", - "null" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid string." - ], - "examples": [ - { - "title": "Extract basename from file path", - "source": "basename!(\"/usr/local/bin/vrl\")", - "return": "vrl" - }, - { - "title": "Extract basename from file path with extension", - "source": "basename!(\"/home/user/file.txt\")", - "return": "file.txt" - }, - { - "title": "Extract basename from directory path", - "source": "basename!(\"/home/user/\")", - "return": "user" - }, - { - "title": "Root directory has no basename", - "source": "basename!(\"/\")", - "return": null - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/bool.cue b/website/cue/reference/remap/functions/bool.cue deleted file mode 100644 index 861976dc23bc9..0000000000000 --- a/website/cue/reference/remap/functions/bool.cue +++ /dev/null @@ -1,55 +0,0 @@ -{ - "remap": { - "functions": { - "bool": { - "anchor": "bool", - "name": "bool", - "category": "Type", - "description": "Returns `value` if it is a Boolean, otherwise returns an error. This enables the type\nchecker to guarantee that the returned value is a Boolean and can be used in any\nfunction that expects a Boolean.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a Boolean.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `value` if it's a Boolean.", - "Raises an error if not a Boolean." - ] - }, - "internal_failure_reasons": [ - "`value` is not a Boolean." - ], - "examples": [ - { - "title": "Valid Boolean", - "source": "bool(false)", - "return": false - }, - { - "title": "Invalid Boolean", - "source": "bool!(42)", - "raises": "function call error for \"bool\" at (0:9): expected boolean, got integer" - }, - { - "title": "Valid Boolean from path", - "source": "bool!(.value)", - "input": { - "value": true - }, - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/camelcase.cue b/website/cue/reference/remap/functions/camelcase.cue deleted file mode 100644 index 581b4f2c21d29..0000000000000 --- a/website/cue/reference/remap/functions/camelcase.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "camelcase": { - "anchor": "camelcase", - "name": "camelcase", - "category": "String", - "description": "Takes the `value` string, and turns it into camelCase. Optionally, you can pass in the existing case of the function, or else an attempt is made to determine the case automatically.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to camelCase.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "original_case", - "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", - "required": false, - "type": [ - "string" - ], - "enum": { - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" - } - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "camelCase a string without specifying original case", - "source": "camelcase(\"input-string\")", - "return": "inputString" - }, - { - "title": "camelcase a snake_case string", - "source": "camelcase(\"foo_bar_baz\", \"snake_case\")", - "return": "fooBarBaz" - }, - { - "title": "camelcase specifying the wrong original case (noop)", - "source": "camelcase(\"foo_bar_baz\", \"kebab-case\")", - "return": "foo_bar_baz" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ceil.cue b/website/cue/reference/remap/functions/ceil.cue deleted file mode 100644 index d14083903968f..0000000000000 --- a/website/cue/reference/remap/functions/ceil.cue +++ /dev/null @@ -1,59 +0,0 @@ -{ - "remap": { - "functions": { - "ceil": { - "anchor": "ceil", - "name": "ceil", - "category": "Number", - "description": "Rounds the `value` up to the specified `precision`.", - "arguments": [ - { - "name": "value", - "description": "The number to round up.", - "required": true, - "type": [ - "integer", - "float" - ] - }, - { - "name": "precision", - "description": "The number of decimal places to round to.", - "required": false, - "type": [ - "integer" - ], - "default": "0" - } - ], - "return": { - "types": [ - "integer", - "float" - ], - "rules": [ - "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise." - ] - }, - "examples": [ - { - "title": "Round a number up (without precision)", - "source": "ceil(4.345)", - "return": 5.0 - }, - { - "title": "Round a number up (with precision)", - "source": "ceil(4.345, precision: 2)", - "return": 4.35 - }, - { - "title": "Round an integer up (noop)", - "source": "ceil(5)", - "return": 5 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/chunks.cue b/website/cue/reference/remap/functions/chunks.cue deleted file mode 100644 index 77ba3c9a62c62..0000000000000 --- a/website/cue/reference/remap/functions/chunks.cue +++ /dev/null @@ -1,61 +0,0 @@ -{ - "remap": { - "functions": { - "chunks": { - "anchor": "chunks", - "name": "chunks", - "category": "Array", - "description": "Chunks `value` into slices of length `chunk_size` bytes.", - "arguments": [ - { - "name": "value", - "description": "The array of bytes to split.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "chunk_size", - "description": "The desired length of each chunk in bytes. This may be constrained by the host platform architecture.", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "`chunks` is considered fallible if the supplied `chunk_size` is an expression, and infallible if it's a literal integer." - ] - }, - "internal_failure_reasons": [ - "`chunk_size` must be at least 1 byte.", - "`chunk_size` is too large." - ], - "examples": [ - { - "title": "Split a string into chunks", - "source": "chunks(\"abcdefgh\", 4)", - "return": [ - "abcd", - "efgh" - ] - }, - { - "title": "Chunks do not respect unicode code point boundaries", - "source": "chunks(\"ab你好\", 4)", - "return": [ - "ab�", - "�好" - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/community_id.cue b/website/cue/reference/remap/functions/community_id.cue deleted file mode 100644 index 589191facfd06..0000000000000 --- a/website/cue/reference/remap/functions/community_id.cue +++ /dev/null @@ -1,90 +0,0 @@ -{ - "remap": { - "functions": { - "community_id": { - "anchor": "community_id", - "name": "community_id", - "category": "String", - "description": "Generates an ID based on the [Community ID Spec](https://github.com/corelight/community-id-spec).", - "arguments": [ - { - "name": "source_ip", - "description": "The source IP address.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "destination_ip", - "description": "The destination IP address.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "protocol", - "description": "The protocol number.", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "source_port", - "description": "The source port or ICMP type.", - "required": false, - "type": [ - "integer" - ] - }, - { - "name": "destination_port", - "description": "The destination port or ICMP code.", - "required": false, - "type": [ - "integer" - ] - }, - { - "name": "seed", - "description": "The custom seed number.", - "required": false, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Generate Community ID for TCP", - "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 1122, destination_port: 3344, protocol: 6)", - "return": "1:wCb3OG7yAFWelaUydu0D+125CLM=" - }, - { - "title": "Generate Community ID for UDP", - "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 1122, destination_port: 3344, protocol: 17)", - "return": "1:0Mu9InQx6z4ZiCZM/7HXi2WMhOg=" - }, - { - "title": "Generate Community ID for ICMP", - "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", source_port: 8, destination_port: 0, protocol: 1)", - "return": "1:crodRHL2FEsHjbv3UkRrfbs4bZ0=" - }, - { - "title": "Generate Community ID for RSVP", - "source": "community_id!(source_ip: \"1.2.3.4\", destination_ip: \"5.6.7.8\", protocol: 46)", - "return": "1:ikv3kmf89luf73WPz1jOs49S768=" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/compact.cue b/website/cue/reference/remap/functions/compact.cue deleted file mode 100644 index e49d043b3429f..0000000000000 --- a/website/cue/reference/remap/functions/compact.cue +++ /dev/null @@ -1,132 +0,0 @@ -{ - "remap": { - "functions": { - "compact": { - "anchor": "compact", - "name": "compact", - "category": "Enumerate", - "description": "Compacts the `value` by removing empty values, where empty values are defined using the available parameters.", - "arguments": [ - { - "name": "value", - "description": "The object or array to compact.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "recursive", - "description": "Whether the compaction be recursive.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "null", - "description": "Whether null should be treated as an empty value.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "string", - "description": "Whether an empty string should be treated as an empty value.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "object", - "description": "Whether an empty object should be treated as an empty value.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "array", - "description": "Whether an empty array should be treated as an empty value.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "nullish", - "description": "Tests whether the value is \"nullish\" as defined by the [`is_nullish`](#is_nullish) function.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object", - "array" - ], - "rules": [ - "The return type matches the `value` type." - ] - }, - "examples": [ - { - "title": "Compact an object with default parameters", - "source": "compact({\"field1\": 1, \"field2\": \"\", \"field3\": [], \"field4\": null})", - "return": { - "field1": 1 - } - }, - { - "title": "Compact an array with default parameters", - "source": "compact([\"foo\", \"bar\", \"\", null, [], \"buzz\"])", - "return": [ - "foo", - "bar", - "buzz" - ] - }, - { - "title": "Compact an array using nullish", - "source": "compact([\"-\", \" \", \"\\n\", null, true], nullish: true)", - "return": [ - true - ] - }, - { - "title": "Compact a complex object with default parameters", - "source": "compact({ \"a\": {}, \"b\": null, \"c\": [null], \"d\": \"\", \"e\": \"-\", \"f\": true })", - "return": { - "e": "-", - "f": true - } - }, - { - "title": "Compact a complex object using null: false", - "source": "compact({ \"a\": {}, \"b\": null, \"c\": [null], \"d\": \"\", \"e\": \"-\", \"f\": true }, null: false)", - "return": { - "b": null, - "c": [ - null - ], - "e": "-", - "f": true - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/contains.cue b/website/cue/reference/remap/functions/contains.cue deleted file mode 100644 index a003374bd12e6..0000000000000 --- a/website/cue/reference/remap/functions/contains.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "contains": { - "anchor": "contains", - "name": "contains", - "category": "String", - "description": "Determines whether the `value` string contains the specified `substring`.", - "arguments": [ - { - "name": "value", - "description": "The text to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "substring", - "description": "The substring to search for in `value`.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "case_sensitive", - "description": "Whether the match should be case sensitive.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "String contains with default parameters (case sensitive)", - "source": "contains(\"banana\", \"AnA\")", - "return": false - }, - { - "title": "String contains (case insensitive)", - "source": "contains(\"banana\", \"AnA\", case_sensitive: false)", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/contains_all.cue b/website/cue/reference/remap/functions/contains_all.cue deleted file mode 100644 index 70980a0613ba4..0000000000000 --- a/website/cue/reference/remap/functions/contains_all.cue +++ /dev/null @@ -1,61 +0,0 @@ -{ - "remap": { - "functions": { - "contains_all": { - "anchor": "contains_all", - "name": "contains_all", - "category": "String", - "description": "Determines whether the `value` string contains all the specified `substrings`.", - "arguments": [ - { - "name": "value", - "description": "The text to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "substrings", - "description": "An array of substrings to search for in `value`.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "case_sensitive", - "description": "Whether the match should be case sensitive.", - "required": false, - "type": [ - "boolean" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "String contains all with default parameters (case sensitive)", - "source": "contains_all(\"The NEEDLE in the Haystack\", [\"NEEDLE\", \"Haystack\"])", - "return": true - }, - { - "title": "String doesn't contain all with default parameters (case sensitive)", - "source": "contains_all(\"The NEEDLE in the Haystack\", [\"needle\", \"Haystack\"])", - "return": false - }, - { - "title": "String contains all (case insensitive)", - "source": "contains_all(\"The NEEDLE in the HaYsTaCk\", [\"nEeDlE\", \"haystack\"], case_sensitive: false)", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/crc.cue b/website/cue/reference/remap/functions/crc.cue deleted file mode 100644 index e0dc3be7e067a..0000000000000 --- a/website/cue/reference/remap/functions/crc.cue +++ /dev/null @@ -1,167 +0,0 @@ -{ - "remap": { - "functions": { - "crc": { - "anchor": "crc", - "name": "crc", - "category": "Checksum", - "description": "Calculates a CRC of the `value`.The CRC `algorithm` used can be optionally specified.\n\nThis function is infallible if either the default `algorithm` value or a recognized-valid compile-time `algorithm` string literal is used. Otherwise, it is fallible.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the checksum for.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "algorithm", - "description": "The CRC algorithm to use.", - "required": false, - "type": [ - "string" - ], - "enum": { - "CRC_3_GSM": "3-bit CRC used in GSM telecommunications for error detection", - "CRC_3_ROHC": "3-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_4_G_704": "4-bit CRC specified in ITU-T G.704 for synchronous communication systems", - "CRC_4_INTERLAKEN": "4-bit CRC used in Interlaken high-speed serial communication protocol", - "CRC_5_EPC_C1G2": "5-bit CRC used in EPC Gen 2 RFID (Radio-Frequency Identification) standard", - "CRC_5_G_704": "5-bit CRC variant in ITU-T G.704 telecommunication standard", - "CRC_5_USB": "5-bit CRC used in USB communication for detecting transmission errors", - "CRC_6_CDMA2000_A": "6-bit CRC variant used in CDMA2000 network protocols", - "CRC_6_CDMA2000_B": "Alternative 6-bit CRC variant for CDMA2000 network protocols", - "CRC_6_DARC": "6-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_6_GSM": "6-bit CRC variant used in GSM telecommunications", - "CRC_6_G_704": "6-bit CRC specified in ITU-T G.704 for synchronous communication", - "CRC_7_MMC": "7-bit CRC used in MultiMediaCard (MMC) storage systems for error detection", - "CRC_7_ROHC": "7-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_7_UMTS": "7-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_8_AUTOSAR": "8-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", - "CRC_8_BLUETOOTH": "8-bit CRC polynomial used in Bluetooth communication protocols", - "CRC_8_CDMA2000": "8-bit CRC used in CDMA2000 cellular communication standard", - "CRC_8_DARC": "8-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_8_DVB_S2": "8-bit CRC used in DVB-S2 (Digital Video Broadcasting Satellite Second Generation)", - "CRC_8_GSM_A": "8-bit CRC variant A used in GSM telecommunications", - "CRC_8_GSM_B": "8-bit CRC variant B used in GSM telecommunications", - "CRC_8_HITAG": "8-bit CRC used in Hitag RFID and transponder systems", - "CRC_8_I_432_1": "8-bit CRC specified in IEEE 1432.1 standard", - "CRC_8_I_CODE": "8-bit CRC used in I-CODE RFID systems", - "CRC_8_LTE": "8-bit CRC used in LTE (Long-Term Evolution) cellular networks", - "CRC_8_MAXIM_DOW": "8-bit CRC used by Maxim/Dallas Semiconductor for 1-Wire and iButton devices", - "CRC_8_MIFARE_MAD": "8-bit CRC used in MIFARE MAD (Multiple Application Directory) protocol", - "CRC_8_NRSC_5": "8-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_8_OPENSAFETY": "8-bit CRC used in OpenSAFETY industrial communication protocol", - "CRC_8_ROHC": "8-bit CRC used in Robust Header Compression (ROHC) protocol", - "CRC_8_SAE_J1850": "8-bit CRC used in SAE J1850 automotive communication protocol", - "CRC_8_SMBUS": "8-bit CRC used in System Management Bus (SMBus) communication", - "CRC_8_TECH_3250": "8-bit CRC used in SMPTE (Society of Motion Picture and Television Engineers) standard", - "CRC_8_WCDMA": "8-bit CRC used in WCDMA (Wideband Code Division Multiple Access) networks", - "CRC_10_ATM": "10-bit CRC used in ATM (Asynchronous Transfer Mode) cell headers", - "CRC_10_CDMA2000": "10-bit CRC used in CDMA2000 cellular communication standard", - "CRC_10_GSM": "10-bit CRC variant used in GSM telecommunications", - "CRC_11_FLEXRAY": "11-bit CRC used in FlexRay automotive communication protocol", - "CRC_11_UMTS": "11-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_12_CDMA2000": "12-bit CRC used in CDMA2000 cellular communication standard", - "CRC_12_DECT": "12-bit CRC used in DECT (Digital Enhanced Cordless Telecommunications) standards", - "CRC_12_GSM": "12-bit CRC variant used in GSM telecommunications", - "CRC_12_UMTS": "12-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_13_BBC": "13-bit CRC used in BBC (British Broadcasting Corporation) digital transmission", - "CRC_14_DARC": "14-bit CRC used in DARC (Digital Audio Radio Channel) communication", - "CRC_14_GSM": "14-bit CRC variant used in GSM telecommunications", - "CRC_15_CAN": "15-bit CRC used in CAN (Controller Area Network) automotive communication", - "CRC_15_MPT1327": "15-bit CRC used in MPT 1327 radio trunking system", - "CRC_16_ARC": "16-bit CRC used in ARC (Adaptive Routing Code) communication", - "CRC_16_CDMA2000": "16-bit CRC used in CDMA2000 cellular communication standard", - "CRC_16_CMS": "16-bit CRC used in Content Management Systems for data integrity", - "CRC_16_DDS_110": "16-bit CRC used in DDS (Digital Data Storage) standard", - "CRC_16_DECT_R": "16-bit CRC variant R used in DECT communication", - "CRC_16_DECT_X": "16-bit CRC variant X used in DECT communication", - "CRC_16_DNP": "16-bit CRC used in DNP3 (Distributed Network Protocol) for utilities", - "CRC_16_EN_13757": "16-bit CRC specified in EN 13757 for meter communication", - "CRC_16_GENIBUS": "16-bit CRC used in GENIBUS communication protocol", - "CRC_16_GSM": "16-bit CRC variant used in GSM telecommunications", - "CRC_16_IBM_3740": "16-bit CRC used in IBM 3740 data integrity checks", - "CRC_16_IBM_SDLC": "16-bit CRC used in IBM SDLC (Synchronous Data Link Control)", - "CRC_16_ISO_IEC_14443_3_A": "16-bit CRC used in ISO/IEC 14443-3 Type A contactless smart cards", - "CRC_16_KERMIT": "16-bit CRC used in Kermit file transfer protocol", - "CRC_16_LJ1200": "16-bit CRC used in LJ1200 communication system", - "CRC_16_M17": "16-bit CRC used in M17 digital radio communication", - "CRC_16_MAXIM_DOW": "16-bit CRC used by Maxim/Dallas Semiconductor for data integrity", - "CRC_16_MCRF4XX": "16-bit CRC used in MCRF4XX RFID systems", - "CRC_16_MODBUS": "16-bit CRC used in Modbus communication protocol for error detection", - "CRC_16_NRSC_5": "16-bit CRC used in NRSC-5 digital radio broadcasting standard", - "CRC_16_OPENSAFETY_A": "16-bit CRC variant A in OpenSAFETY industrial communication", - "CRC_16_OPENSAFETY_B": "16-bit CRC variant B in OpenSAFETY industrial communication", - "CRC_16_PROFIBUS": "16-bit CRC used in PROFIBUS industrial communication protocol", - "CRC_16_RIELLO": "16-bit CRC used in Riello UPS communication", - "CRC_16_SPI_FUJITSU": "16-bit CRC used in Fujitsu SPI (Serial Peripheral Interface) communication", - "CRC_16_T10_DIF": "16-bit CRC used in T10 DIF (Data Integrity Field) standard", - "CRC_16_TELEDISK": "16-bit CRC used in Teledisk disk image format", - "CRC_16_TMS37157": "16-bit CRC used in TMS37157 microcontroller communication", - "CRC_16_UMTS": "16-bit CRC used in UMTS (Universal Mobile Telecommunications System)", - "CRC_16_USB": "16-bit CRC used in USB communication for error detection", - "CRC_16_XMODEM": "16-bit CRC used in XMODEM file transfer protocol", - "CRC_17_CAN_FD": "17-bit CRC used in CAN FD (Flexible Data-Rate) automotive communication protocol", - "CRC_21_CAN_FD": "21-bit CRC variant used in CAN FD (Flexible Data-Rate) automotive communication", - "CRC_24_BLE": "24-bit CRC used in Bluetooth Low Energy (BLE) packet error checking", - "CRC_24_FLEXRAY_A": "24-bit CRC variant A used in FlexRay automotive communication protocol", - "CRC_24_FLEXRAY_B": "24-bit CRC variant B used in FlexRay automotive communication protocol", - "CRC_24_INTERLAKEN": "24-bit CRC used in Interlaken high-speed serial communication protocol", - "CRC_24_LTE_A": "24-bit CRC variant A used in LTE (Long-Term Evolution) cellular networks", - "CRC_24_LTE_B": "24-bit CRC variant B used in LTE (Long-Term Evolution) cellular networks", - "CRC_24_OPENPGP": "24-bit CRC used in OpenPGP (Pretty Good Privacy) for data integrity", - "CRC_24_OS_9": "24-bit CRC used in OS-9 operating system for error detection", - "CRC_30_CDMA": "30-bit CRC used in CDMA (Code Division Multiple Access) communication standard", - "CRC_31_PHILIPS": "31-bit CRC used in Philips communication protocols", - "CRC_32_AIXM": "32-bit CRC used in Aeronautical Information Exchange Model (AIXM)", - "CRC_32_AUTOSAR": "32-bit CRC used in AUTOSAR (Automotive Open System Architecture) standard", - "CRC_32_BASE91_D": "32-bit CRC variant used in Base91 data encoding", - "CRC_32_BZIP2": "32-bit CRC used in bzip2 compression algorithm", - "CRC_32_CD_ROM_EDC": "32-bit CRC used for Error Detection Code in CD-ROM systems", - "CRC_32_CKSUM": "32-bit CRC used in UNIX cksum command for file integrity", - "CRC_32_ISCSI": "32-bit CRC used in iSCSI (Internet Small Computer Systems Interface)", - "CRC_32_ISO_HDLC": "32-bit CRC used in ISO HDLC (High-Level Data Link Control)", - "CRC_32_JAMCRC": "32-bit CRC variant used in JAM error detection", - "CRC_32_MEF": "32-bit CRC used in Metro Ethernet Forum (MEF) standards", - "CRC_32_MPEG_2": "32-bit CRC used in MPEG-2 transport streams for error detection", - "CRC_32_XFER": "32-bit CRC used in data transfer protocols", - "CRC_40_GSM": "40-bit CRC variant used in GSM telecommunications", - "CRC_64_ECMA_182": "64-bit CRC specified in ECMA-182 standard", - "CRC_64_GO_ISO": "64-bit CRC used in Go programming language and ISO standards", - "CRC_64_MS": "64-bit CRC variant used in Microsoft systems", - "CRC_64_REDIS": "64-bit CRC used in Redis key-value data store", - "CRC_64_WE": "64-bit CRC variant for wide-area error detection", - "CRC_64_XZ": "64-bit CRC used in the XZ compression format for integrity verification", - "CRC_82_DARC": "82-bit CRC used in DARC (Digital Audio Radio Channel) communication" - }, - "default": "CRC_32_ISO_HDLC" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is not a string.", - "`algorithm` is not a supported algorithm." - ], - "examples": [ - { - "title": "Create CRC checksum using the default algorithm", - "source": "crc(\"foo\")", - "return": "2356372769" - }, - { - "title": "Create CRC checksum using the CRC_32_CKSUM algorithm", - "source": "crc(\"foo\", algorithm: \"CRC_32_CKSUM\")", - "return": "4271552933" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_base16.cue b/website/cue/reference/remap/functions/decode_base16.cue deleted file mode 100644 index 8d86242aeb942..0000000000000 --- a/website/cue/reference/remap/functions/decode_base16.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "decode_base16": { - "anchor": "decode_base16", - "name": "decode_base16", - "category": "Codec", - "description": "Decodes the `value` (a [Base16](https://en.wikipedia.org/wiki/Hexadecimal) string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The [Base16](https://en.wikipedia.org/wiki/Hexadecimal) data to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Base16 string." - ], - "examples": [ - { - "title": "Decode Base16 data", - "source": "decode_base16!(\"736F6D6520737472696E672076616C7565\")", - "return": "some string value" - }, - { - "title": "Decode longer Base16 data", - "source": "decode_base16!(\"796f752068617665207375636365737366756c6c79206465636f646564206d65\")", - "return": "you have successfully decoded me" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_base64.cue b/website/cue/reference/remap/functions/decode_base64.cue deleted file mode 100644 index 491c27d9255db..0000000000000 --- a/website/cue/reference/remap/functions/decode_base64.cue +++ /dev/null @@ -1,56 +0,0 @@ -{ - "remap": { - "functions": { - "decode_base64": { - "anchor": "decode_base64", - "name": "decode_base64", - "category": "Codec", - "description": "Decodes the `value` (a [Base64](https://en.wikipedia.org/wiki/Base64) string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The [Base64](https://en.wikipedia.org/wiki/Base64) data to decode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "charset", - "description": "The character set to use when decoding the data.", - "required": false, - "type": [ - "string" - ], - "enum": { - "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format.", - "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications)." - }, - "default": "standard" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Base64 string." - ], - "examples": [ - { - "title": "Decode Base64 data (default)", - "source": "decode_base64!(\"eW91IGhhdmUgc3VjY2Vzc2Z1bGx5IGRlY29kZWQgbWU=\")", - "return": "you have successfully decoded me" - }, - { - "title": "Decode Base64 data (URL safe)", - "source": "decode_base64!(\"eW91IGNhbid0IG1ha2UgeW91ciBoZWFydCBmZWVsIHNvbWV0aGluZyBpdCB3b24ndA==\", charset: \"url_safe\")", - "return": "you can't make your heart feel something it won't" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_charset.cue b/website/cue/reference/remap/functions/decode_charset.cue deleted file mode 100644 index 75a113664fea9..0000000000000 --- a/website/cue/reference/remap/functions/decode_charset.cue +++ /dev/null @@ -1,56 +0,0 @@ -{ - "remap": { - "functions": { - "decode_charset": { - "anchor": "decode_charset", - "name": "decode_charset", - "category": "Codec", - "description": "Decodes the `value` (a non-UTF8 string) to a UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", - "arguments": [ - { - "name": "value", - "description": "The non-UTF8 string to decode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "from_charset", - "description": "The [character set](https://encoding.spec.whatwg.org/#names-and-labels) to use when decoding the data.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`from_charset` isn't a valid [character set](https://encoding.spec.whatwg.org/#names-and-labels)." - ], - "examples": [ - { - "title": "Decode EUC-KR string", - "source": "decode_charset!(decode_base64!(\"vsiz58fPvLy/5A==\"), \"euc-kr\")", - "return": "안녕하세요" - }, - { - "title": "Decode EUC-JP string", - "source": "decode_charset!(decode_base64!(\"pLOk86TLpMGkzw==\"), \"euc-jp\")", - "return": "こんにちは" - }, - { - "title": "Decode GB2312 string", - "source": "decode_charset!(decode_base64!(\"xOO6ww==\"), \"gb2312\")", - "return": "你好" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_gzip.cue b/website/cue/reference/remap/functions/decode_gzip.cue deleted file mode 100644 index 321f955e80e63..0000000000000 --- a/website/cue/reference/remap/functions/decode_gzip.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "decode_gzip": { - "anchor": "decode_gzip", - "name": "decode_gzip", - "category": "Codec", - "description": "Decodes the `value` (a [Gzip](https://www.gzip.org/) string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The [Gzip](https://www.gzip.org/) data to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Gzip string." - ], - "examples": [ - { - "title": "Decode Gzip data", - "source": "decode_gzip!(decode_base64!(\"H4sIAB8BymMAAyvISU0sTlVISU3OT0lVyE0FAJsZ870QAAAA\"))", - "return": "please decode me" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_lz4.cue b/website/cue/reference/remap/functions/decode_lz4.cue deleted file mode 100644 index 60d230130127c..0000000000000 --- a/website/cue/reference/remap/functions/decode_lz4.cue +++ /dev/null @@ -1,64 +0,0 @@ -{ - "remap": { - "functions": { - "decode_lz4": { - "anchor": "decode_lz4", - "name": "decode_lz4", - "category": "Codec", - "description": "Decodes the `value` (an lz4 string) into its original string. `buf_size` is the size of the buffer to decode into, this must be equal to or larger than the uncompressed size.\n If `prepended_size` is set to `true`, it expects the original uncompressed size to be prepended to the compressed data.\n `prepended_size` is useful for some implementations of lz4 that require the original size to be known before decoding.", - "arguments": [ - { - "name": "value", - "description": "The lz4 block data to decode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "buf_size", - "description": "The size of the buffer to decode into, this must be equal to or larger than the uncompressed size.", - "required": false, - "type": [ - "integer" - ], - "default": "1000000" - }, - { - "name": "prepended_size", - "description": "Some implementations of lz4 require the original uncompressed size to be prepended to the compressed data.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` unable to decode value with lz4 frame decoder.", - "`value` unable to decode value with lz4 block decoder.", - "`value` unable to decode because the output is too large for the buffer.", - "`value` unable to decode because the prepended size is not a valid integer." - ], - "examples": [ - { - "title": "LZ4 block with prepended size", - "source": "decode_lz4!(decode_base64!(\"LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=\"), prepended_size: true)", - "return": "The quick brown fox jumps over 13 lazy dogs." - }, - { - "title": "Decode Lz4 data without prepended size.", - "source": "decode_lz4!(decode_base64!(\"BCJNGGBAgiwAAIBUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLgAAAAA=\"))", - "return": "The quick brown fox jumps over 13 lazy dogs." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_mime_q.cue b/website/cue/reference/remap/functions/decode_mime_q.cue deleted file mode 100644 index 8a6ee5810124b..0000000000000 --- a/website/cue/reference/remap/functions/decode_mime_q.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "decode_mime_q": { - "anchor": "decode_mime_q", - "name": "decode_mime_q", - "category": "Codec", - "description": "Replaces q-encoded or base64-encoded [encoded-word](https://datatracker.ietf.org/doc/html/rfc2047#section-2) substrings in the `value` with their original string.", - "arguments": [ - { - "name": "value", - "description": "The string with [encoded-words](https://datatracker.ietf.org/doc/html/rfc2047#section-2) to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` has invalid encoded [encoded-word](https://datatracker.ietf.org/doc/html/rfc2047#section-2) string." - ], - "examples": [ - { - "title": "Decode single encoded-word", - "source": "decode_mime_q!(\"=?utf-8?b?SGVsbG8sIFdvcmxkIQ==?=\")", - "return": "Hello, World!" - }, - { - "title": "Embedded", - "source": "decode_mime_q!(\"From: =?utf-8?b?SGVsbG8sIFdvcmxkIQ==?= <=?utf-8?q?hello=5Fworld=40example=2ecom?=>\")", - "return": "From: Hello, World! " - }, - { - "title": "Without charset", - "source": "decode_mime_q!(\"?b?SGVsbG8sIFdvcmxkIQ==\")", - "return": "Hello, World!" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_percent.cue b/website/cue/reference/remap/functions/decode_percent.cue deleted file mode 100644 index e659cbadd104b..0000000000000 --- a/website/cue/reference/remap/functions/decode_percent.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "decode_percent": { - "anchor": "decode_percent", - "name": "decode_percent", - "category": "Codec", - "description": "Decodes a [percent-encoded](https://url.spec.whatwg.org/#percent-encoded-bytes) `value` like a URL.", - "arguments": [ - { - "name": "value", - "description": "The string to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Percent decode a value", - "source": "decode_percent(\"foo%20bar%3F\")", - "return": "foo bar?" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_punycode.cue b/website/cue/reference/remap/functions/decode_punycode.cue deleted file mode 100644 index dfbd48743223b..0000000000000 --- a/website/cue/reference/remap/functions/decode_punycode.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "decode_punycode": { - "anchor": "decode_punycode", - "name": "decode_punycode", - "category": "Codec", - "description": "Decodes a [punycode](https://en.wikipedia.org/wiki/Punycode) encoded `value`, such as an internationalized domain name ([IDN](https://en.wikipedia.org/wiki/Internationalized_domain_name)). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it.", - "arguments": [ - { - "name": "value", - "description": "The string to decode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "validate", - "description": "If enabled, checks if the input string is a valid domain name.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is not valid `punycode`" - ], - "examples": [ - { - "title": "Decode a punycode encoded internationalized domain name", - "source": "decode_punycode!(\"www.xn--caf-dma.com\")", - "return": "www.café.com" - }, - { - "title": "Decode an ASCII only string", - "source": "decode_punycode!(\"www.cafe.com\")", - "return": "www.cafe.com" - }, - { - "title": "Ignore validation", - "source": "decode_punycode!(\"xn--8hbb.xn--fiba.xn--8hbf.xn--eib.\", validate: false)", - "return": "١٠.٦٦.٣٠.٥." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_snappy.cue b/website/cue/reference/remap/functions/decode_snappy.cue deleted file mode 100644 index 1bf175c855b76..0000000000000 --- a/website/cue/reference/remap/functions/decode_snappy.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "decode_snappy": { - "anchor": "decode_snappy", - "name": "decode_snappy", - "category": "Codec", - "description": "Decodes the `value` (a Snappy string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The Snappy data to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Snappy string." - ], - "examples": [ - { - "title": "Decode Snappy data", - "source": "decode_snappy!(decode_base64!(\"LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==\"))", - "return": "The quick brown fox jumps over 13 lazy dogs." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_zlib.cue b/website/cue/reference/remap/functions/decode_zlib.cue deleted file mode 100644 index f39986108902b..0000000000000 --- a/website/cue/reference/remap/functions/decode_zlib.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "decode_zlib": { - "anchor": "decode_zlib", - "name": "decode_zlib", - "category": "Codec", - "description": "Decodes the `value` (a [Zlib](https://www.zlib.net) string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The [Zlib](https://www.zlib.net) data to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Zlib string." - ], - "examples": [ - { - "title": "Decode Zlib data", - "source": "decode_zlib!(decode_base64!(\"eJxLzUvOT0mNz00FABI5A6A=\"))", - "return": "encode_me" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decode_zstd.cue b/website/cue/reference/remap/functions/decode_zstd.cue deleted file mode 100644 index 54bc01f1c13dc..0000000000000 --- a/website/cue/reference/remap/functions/decode_zstd.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "decode_zstd": { - "anchor": "decode_zstd", - "name": "decode_zstd", - "category": "Codec", - "description": "Decodes the `value` (a [Zstandard](https://facebook.github.io/zstd) string) into its original string.", - "arguments": [ - { - "name": "value", - "description": "The [Zstandard](https://facebook.github.io/zstd) data to decode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid encoded Zstd string." - ], - "examples": [ - { - "title": "Decode Zstd data", - "source": "decode_zstd!(decode_base64!(\"KLUv/QBY/QEAYsQOFKClbQBedqXsb96EWDax/f/F/z+gNU4ZTInaUeAj82KqPFjUzKqhcfDqAIsLvAsnY1bI/N2mHzDixRQA\"))", - "return": "you_have_successfully_decoded_me.congratulations.you_are_breathtaking." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decrypt.cue b/website/cue/reference/remap/functions/decrypt.cue deleted file mode 100644 index 73cb449947e2e..0000000000000 --- a/website/cue/reference/remap/functions/decrypt.cue +++ /dev/null @@ -1,69 +0,0 @@ -{ - "remap": { - "functions": { - "decrypt": { - "anchor": "decrypt", - "name": "decrypt", - "category": "Cryptography", - "description": "Decrypts a string with a symmetric encryption algorithm.\n\nSupported Algorithms:\n\n* AES-256-CFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-CFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-CFB (key = 16 bytes, iv = 16 bytes)\n* AES-256-OFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-OFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-OFB (key = 16 bytes, iv = 16 bytes)\n* AES-128-SIV (key = 32 bytes, iv = 16 bytes)\n* AES-256-SIV (key = 64 bytes, iv = 16 bytes)\n* Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes)\n* Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes)\n* Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes)\n* CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes)\n* XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes)\n* XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes)", - "arguments": [ - { - "name": "ciphertext", - "description": "The string in raw bytes (not encoded) to decrypt.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "algorithm", - "description": "The algorithm to use.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key", - "description": "The key in raw bytes (not encoded) for decryption. The length must match the algorithm requested.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "iv", - "description": "The IV in raw bytes (not encoded) for decryption. The length must match the algorithm requested.\nA new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value.\nThe value should match the one used during encryption.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`algorithm` is not a supported algorithm.", - "`key` length does not match the key size required for the algorithm specified.", - "`iv` length does not match the `iv` size required for the algorithm specified." - ], - "examples": [ - { - "title": "Decrypt value using AES-256-CFB", - "source": "iv = \"0123456789012345\"\nkey = \"01234567890123456789012345678912\"\nciphertext = decode_base64!(\"c/dIOA==\")\ndecrypt!(ciphertext, \"AES-256-CFB\", key: key, iv: iv)\n", - "return": "data" - }, - { - "title": "Decrypt value using AES-128-CBC-PKCS7", - "source": "iv = decode_base64!(\"fVEIRkIiczCRWNxaarsyxA==\")\nkey = \"16_byte_keyxxxxx\"\nciphertext = decode_base64!(\"5fLGcu1VHdzsPcGNDio7asLqE1P43QrVfPfmP4i4zOU=\")\ndecrypt!(ciphertext, \"AES-128-CBC-PKCS7\", key: key, iv: iv)\n", - "return": "super_secret_message" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/decrypt_ip.cue b/website/cue/reference/remap/functions/decrypt_ip.cue deleted file mode 100644 index 57cdd6016540d..0000000000000 --- a/website/cue/reference/remap/functions/decrypt_ip.cue +++ /dev/null @@ -1,79 +0,0 @@ -{ - "remap": { - "functions": { - "decrypt_ip": { - "anchor": "decrypt_ip", - "name": "decrypt_ip", - "category": "IP", - "description": "Decrypts an IP address that was previously encrypted, restoring the original IP address.\n\nSupported Modes:\n\n* AES128 - Decrypts an IP address that was scrambled using AES-128 encryption. Can transform between IPv4 and IPv6.\n* PFX (Prefix-preserving) - Decrypts an IP address that was encrypted with prefix-preserving mode, where network hierarchy was maintained.", - "arguments": [ - { - "name": "ip", - "description": "The encrypted IP address to decrypt (v4 or v6).", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key", - "description": "The decryption key in raw bytes (not encoded). Must be the same key that was used for encryption. For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "mode", - "description": "The decryption mode to use. Must match the mode used for encryption: either `aes128` or `pfx`.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`ip` is not a valid IP address.", - "`mode` is not a supported mode (must be `aes128` or `pfx`).", - "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`)." - ], - "examples": [ - { - "title": "Decrypt IPv4 address with AES128", - "source": "decrypt_ip!(\"72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0\", \"sixteen byte key\", \"aes128\")", - "return": "192.168.1.1" - }, - { - "title": "Decrypt IPv6 address with AES128", - "source": "decrypt_ip!(\"c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a\", \"sixteen byte key\", \"aes128\")", - "return": "2001:db8::1" - }, - { - "title": "Decrypt IPv4 address with prefix-preserving mode", - "source": "decrypt_ip!(\"33.245.248.61\", \"thirty-two bytes key for pfx use\", \"pfx\")", - "return": "192.168.1.1" - }, - { - "title": "Decrypt IPv6 address with prefix-preserving mode", - "source": "decrypt_ip!(\"88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9\", \"thirty-two bytes key for ipv6pfx\", \"pfx\")", - "return": "2001:db8::1" - }, - { - "title": "Round-trip encryption and decryption", - "source": "original_ip = \"192.168.1.100\"\nkey = \"sixteen byte key\"\nmode = \"aes128\"\n\nencrypted = encrypt_ip!(original_ip, key, mode)\ndecrypt_ip!(encrypted, key, mode)\n", - "return": "192.168.1.100" - } - ], - "notices": [ - "The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt\nspecification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. This\nfunction reverses the encryption performed by `encrypt_ip` - the same key and algorithm\nthat were used for encryption must be used for decryption." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/del.cue b/website/cue/reference/remap/functions/del.cue deleted file mode 100644 index a177b42717c68..0000000000000 --- a/website/cue/reference/remap/functions/del.cue +++ /dev/null @@ -1,91 +0,0 @@ -{ - "remap": { - "functions": { - "del": { - "anchor": "del", - "name": "del", - "category": "Path", - "description": "Removes the field specified by the static `path` from the target.\n\nFor dynamic path deletion, see the `remove` function.", - "arguments": [ - { - "name": "target", - "description": "The path of the field to delete", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "compact", - "description": "After deletion, if `compact` is `true` and there is an empty object or array left,\nthe empty object or array is also removed, cascading up to the root. This only\napplies to the path being deleted, and any parent paths.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "any" - ], - "rules": [ - "Returns the value of the field being deleted. Returns `null` if the field doesn't exist." - ] - }, - "examples": [ - { - "title": "Delete a field", - "source": ". = { \"foo\": \"bar\" }\ndel(.foo)\n", - "return": "bar" - }, - { - "title": "Rename a field", - "source": ". = { \"old\": \"foo\" }\n.new = del(.old)\n.\n", - "return": { - "new": "foo" - } - }, - { - "title": "Returns null for unknown field", - "source": "del({\"foo\": \"bar\"}.baz)", - "return": null - }, - { - "title": "External target", - "source": ". = { \"foo\": true, \"bar\": 10 }\ndel(.foo)\n.\n", - "return": { - "bar": 10 - } - }, - { - "title": "Delete field from variable", - "source": "var = { \"foo\": true, \"bar\": 10 }\ndel(var.foo)\nvar\n", - "return": { - "bar": 10 - } - }, - { - "title": "Delete object field", - "source": "var = { \"foo\": {\"nested\": true}, \"bar\": 10 }\ndel(var.foo.nested, false)\nvar\n", - "return": { - "foo": {}, - "bar": 10 - } - }, - { - "title": "Compact object field", - "source": "var = { \"foo\": {\"nested\": true}, \"bar\": 10 }\ndel(var.foo.nested, true)\nvar\n", - "return": { - "bar": 10 - } - } - ], - "notices": [ - "The `del` function _modifies the current event in place_ and returns the value of the deleted field." - ], - "pure": false - } - } - } -} diff --git a/website/cue/reference/remap/functions/dirname.cue b/website/cue/reference/remap/functions/dirname.cue deleted file mode 100644 index 2a8504790513b..0000000000000 --- a/website/cue/reference/remap/functions/dirname.cue +++ /dev/null @@ -1,58 +0,0 @@ -{ - "remap": { - "functions": { - "dirname": { - "anchor": "dirname", - "name": "dirname", - "category": "String", - "description": "Returns the directory component of the given `path`. This is similar to the Unix `dirname` command. The directory component is the path with the final component removed.", - "arguments": [ - { - "name": "value", - "description": "The path from which to extract the directory name.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid string." - ], - "examples": [ - { - "title": "Extract dirname from file path", - "source": "dirname!(\"/usr/local/bin/vrl\")", - "return": "/usr/local/bin" - }, - { - "title": "Extract dirname from file path with extension", - "source": "dirname!(\"/home/user/file.txt\")", - "return": "/home/user" - }, - { - "title": "Extract dirname from directory path", - "source": "dirname!(\"/home/user/\")", - "return": "/home" - }, - { - "title": "Root directory dirname is itself", - "source": "dirname!(\"/\")", - "return": "/" - }, - { - "title": "Relative files have current directory as dirname", - "source": "dirname!(\"file.txt\")", - "return": "." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/dns_lookup.cue b/website/cue/reference/remap/functions/dns_lookup.cue deleted file mode 100644 index 1decb751c7d06..0000000000000 --- a/website/cue/reference/remap/functions/dns_lookup.cue +++ /dev/null @@ -1,264 +0,0 @@ -{ - "remap": { - "functions": { - "dns_lookup": { - "anchor": "dns_lookup", - "name": "dns_lookup", - "category": "System", - "description": "Performs a DNS lookup on the provided domain name.", - "arguments": [ - { - "name": "value", - "description": "The domain name to query.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "qtype", - "description": "The DNS record type to query (e.g., A, AAAA, MX, TXT). Defaults to A.", - "required": false, - "type": [ - "string" - ], - "default": "A" - }, - { - "name": "class", - "description": "The DNS query class. Defaults to IN (Internet).", - "required": false, - "type": [ - "string" - ], - "default": "IN" - }, - { - "name": "options", - "description": "DNS resolver options. Supported fields: servers (array of nameserver addresses), timeout (seconds), attempts (number of retry attempts), ndots, aa_only, tcp, recurse, rotate.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Basic lookup", - "source": "res = dns_lookup!(\"dns.google\")\n# reset non-static ttl so result is static\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", - "return": { - "additional": [ - { - "domainName": "", - "rData": "OPT ...", - "recordType": "OPT", - "recordTypeId": 41, - "ttl": 0 - } - ], - "answers": [ - { - "class": "IN", - "domainName": "dns.google", - "rData": "8.8.8.8", - "recordType": "A", - "recordTypeId": 1, - "ttl": 600 - } - ], - "authority": [], - "fullRcode": 0, - "header": { - "aa": false, - "ad": false, - "anCount": 2, - "arCount": 1, - "cd": false, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": true, - "ra": true, - "rcode": 0, - "rd": true, - "tc": false - }, - "question": [ - { - "class": "IN", - "domainName": "dns.google", - "questionType": "A", - "questionTypeId": 1 - } - ], - "rcodeName": "NOERROR" - } - }, - { - "title": "Custom class and qtype", - "source": "res = dns_lookup!(\"dns.google\", class: \"IN\", qtype: \"A\")\n# reset non-static ttl so result is static\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", - "return": { - "additional": [ - { - "domainName": "", - "rData": "OPT ...", - "recordType": "OPT", - "recordTypeId": 41, - "ttl": 0 - } - ], - "answers": [ - { - "class": "IN", - "domainName": "dns.google", - "rData": "8.8.8.8", - "recordType": "A", - "recordTypeId": 1, - "ttl": 600 - } - ], - "authority": [], - "fullRcode": 0, - "header": { - "aa": false, - "ad": false, - "anCount": 2, - "arCount": 1, - "cd": false, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": true, - "ra": true, - "rcode": 0, - "rd": true, - "tc": false - }, - "question": [ - { - "class": "IN", - "domainName": "dns.google", - "questionType": "A", - "questionTypeId": 1 - } - ], - "rcodeName": "NOERROR" - } - }, - { - "title": "Custom options", - "source": "res = dns_lookup!(\"dns.google\", options: {\"timeout\": 30, \"attempts\": 5})\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", - "return": { - "additional": [ - { - "domainName": "", - "rData": "OPT ...", - "recordType": "OPT", - "recordTypeId": 41, - "ttl": 0 - } - ], - "answers": [ - { - "class": "IN", - "domainName": "dns.google", - "rData": "8.8.8.8", - "recordType": "A", - "recordTypeId": 1, - "ttl": 600 - } - ], - "authority": [], - "fullRcode": 0, - "header": { - "aa": false, - "ad": false, - "anCount": 2, - "arCount": 1, - "cd": false, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": true, - "ra": true, - "rcode": 0, - "rd": true, - "tc": false - }, - "question": [ - { - "class": "IN", - "domainName": "dns.google", - "questionType": "A", - "questionTypeId": 1 - } - ], - "rcodeName": "NOERROR" - } - }, - { - "title": "Custom server", - "source": "res = dns_lookup!(\"dns.google\", options: {\"servers\": [\"dns.quad9.net\"]})\nres.answers = map_values(res.answers) -> |value| {\n value.ttl = 600\n value\n}\n# remove extra responses for example\nres.answers = filter(res.answers) -> |_, value| {\n value.rData == \"8.8.8.8\"\n}\n# remove class since this is also dynamic\nres.additional = map_values(res.additional) -> |value| {\n del(value.class)\n value\n}\nres\n", - "return": { - "additional": [ - { - "domainName": "", - "rData": "OPT ...", - "recordType": "OPT", - "recordTypeId": 41, - "ttl": 0 - } - ], - "answers": [ - { - "class": "IN", - "domainName": "dns.google", - "rData": "8.8.8.8", - "recordType": "A", - "recordTypeId": 1, - "ttl": 600 - } - ], - "authority": [], - "fullRcode": 0, - "header": { - "aa": false, - "ad": false, - "anCount": 2, - "arCount": 1, - "cd": false, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": true, - "ra": true, - "rcode": 0, - "rd": true, - "tc": false - }, - "question": [ - { - "class": "IN", - "domainName": "dns.google", - "questionType": "A", - "questionTypeId": 1 - } - ], - "rcodeName": "NOERROR" - } - } - ], - "notices": [ - "This function performs network calls and blocks on each request until a response is\nreceived. It is not recommended for frequent or performance-critical workflows." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/downcase.cue b/website/cue/reference/remap/functions/downcase.cue deleted file mode 100644 index bff98b9f00131..0000000000000 --- a/website/cue/reference/remap/functions/downcase.cue +++ /dev/null @@ -1,40 +0,0 @@ -{ - "remap": { - "functions": { - "downcase": { - "anchor": "downcase", - "name": "downcase", - "category": "String", - "description": "Downcases the `value` string, where downcase is defined according to the Unicode Derived Core Property Lowercase.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to lowercase.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Downcase a string", - "source": "downcase(\"Hello, World!\")", - "return": "hello, world!" - }, - { - "title": "Downcase with number", - "source": "downcase(\"FOO 2 BAR\")", - "return": "foo 2 bar" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_base16.cue b/website/cue/reference/remap/functions/encode_base16.cue deleted file mode 100644 index 2c09897f1a2fe..0000000000000 --- a/website/cue/reference/remap/functions/encode_base16.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "encode_base16": { - "anchor": "encode_base16", - "name": "encode_base16", - "category": "Codec", - "description": "Encodes the `value` to [Base16](https://en.wikipedia.org/wiki/Hexadecimal).", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Base16", - "source": "encode_base16(\"some string value\")", - "return": "736f6d6520737472696e672076616c7565" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_base64.cue b/website/cue/reference/remap/functions/encode_base64.cue deleted file mode 100644 index 0cf0e537a1046..0000000000000 --- a/website/cue/reference/remap/functions/encode_base64.cue +++ /dev/null @@ -1,72 +0,0 @@ -{ - "remap": { - "functions": { - "encode_base64": { - "anchor": "encode_base64", - "name": "encode_base64", - "category": "Codec", - "description": "Encodes the `value` to [Base64](https://en.wikipedia.org/wiki/Base64).", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "padding", - "description": "Whether the Base64 output is [padded](https://en.wikipedia.org/wiki/Base64#Output_padding).", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "charset", - "description": "The character set to use when encoding the data.", - "required": false, - "type": [ - "string" - ], - "enum": { - "standard": "[Standard](https://tools.ietf.org/html/rfc4648#section-4) Base64 format.", - "url_safe": "Modified Base64 for [URL variants](https://en.wikipedia.org/wiki/Base64#URL_applications)." - }, - "default": "standard" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Base64 (default)", - "source": "encode_base64(\"please encode me\")", - "return": "cGxlYXNlIGVuY29kZSBtZQ==" - }, - { - "title": "Encode to Base64 (without padding)", - "source": "encode_base64(\"please encode me, no padding though\", padding: false)", - "return": "cGxlYXNlIGVuY29kZSBtZSwgbm8gcGFkZGluZyB0aG91Z2g" - }, - { - "title": "Encode to Base64 (URL safe)", - "source": "encode_base64(\"please encode me, but safe for URLs\", charset: \"url_safe\")", - "return": "cGxlYXNlIGVuY29kZSBtZSwgYnV0IHNhZmUgZm9yIFVSTHM=" - }, - { - "title": "Encode to Base64 (without padding and URL safe)", - "source": "encode_base64(\"some string value\", padding: false, charset: \"url_safe\")", - "return": "c29tZSBzdHJpbmcgdmFsdWU" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_charset.cue b/website/cue/reference/remap/functions/encode_charset.cue deleted file mode 100644 index 53eb0d4691a3e..0000000000000 --- a/website/cue/reference/remap/functions/encode_charset.cue +++ /dev/null @@ -1,56 +0,0 @@ -{ - "remap": { - "functions": { - "encode_charset": { - "anchor": "encode_charset", - "name": "encode_charset", - "category": "Codec", - "description": "Encodes the `value` (a UTF8 string) to a non-UTF8 string using the specified\n[character set](https://encoding.spec.whatwg.org/#names-and-labels).", - "arguments": [ - { - "name": "value", - "description": "The UTF8 string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "to_charset", - "description": "The [character set](https://encoding.spec.whatwg.org/#names-and-labels) to use when encoding the data.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`to_charset` isn't a valid [character set](https://encoding.spec.whatwg.org/#names-and-labels)." - ], - "examples": [ - { - "title": "Encode UTF8 string to EUC-KR", - "source": "encode_base64(encode_charset!(\"안녕하세요\", \"euc-kr\"))", - "return": "vsiz58fPvLy/5A==" - }, - { - "title": "Encode UTF8 string to EUC-JP", - "source": "encode_base64(encode_charset!(\"こんにちは\", \"euc-jp\"))", - "return": "pLOk86TLpMGkzw==" - }, - { - "title": "Encode UTF8 string to GB2312", - "source": "encode_base64(encode_charset!(\"你好\", \"gb2312\"))", - "return": "xOO6ww==" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_gzip.cue b/website/cue/reference/remap/functions/encode_gzip.cue deleted file mode 100644 index a16ee3013ff11..0000000000000 --- a/website/cue/reference/remap/functions/encode_gzip.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "encode_gzip": { - "anchor": "encode_gzip", - "name": "encode_gzip", - "category": "Codec", - "description": "Encodes the `value` to [Gzip](https://www.gzip.org/).", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "compression_level", - "description": "The default compression level.", - "required": false, - "type": [ - "integer" - ], - "default": "6" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Gzip", - "source": "encode_base64(encode_gzip(\"please encode me\"))", - "return": "H4sIAAAAAAAA/yvISU0sTlVIzUvOT0lVyE0FAI4R4vcQAAAA" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_json.cue b/website/cue/reference/remap/functions/encode_json.cue deleted file mode 100644 index 04f12f406c14a..0000000000000 --- a/website/cue/reference/remap/functions/encode_json.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "encode_json": { - "anchor": "encode_json", - "name": "encode_json", - "category": "Codec", - "description": "Encodes the `value` to JSON.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a JSON string.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "pretty", - "description": "Whether to pretty print the JSON string or not.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode object to JSON", - "source": "encode_json({\"field\": \"value\", \"another\": [1,2,3]})", - "return": "s'{\"another\":[1,2,3],\"field\":\"value\"}'" - }, - { - "title": "Encode object to as pretty-printed JSON", - "source": "encode_json({\"field\": \"value\", \"another\": [1,2,3]}, true)", - "return": "{\n \"another\": [\n 1,\n 2,\n 3\n ],\n \"field\": \"value\"\n}" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_key_value.cue b/website/cue/reference/remap/functions/encode_key_value.cue deleted file mode 100644 index 22c90b381b6df..0000000000000 --- a/website/cue/reference/remap/functions/encode_key_value.cue +++ /dev/null @@ -1,102 +0,0 @@ -{ - "remap": { - "functions": { - "encode_key_value": { - "anchor": "encode_key_value", - "name": "encode_key_value", - "category": "Codec", - "description": "Encodes the `value` into key-value format with customizable delimiters. Default delimiters match the [logfmt](https://brandur.org/logfmt) format.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a string.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "fields_ordering", - "description": "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields.", - "required": false, - "type": [ - "array" - ], - "default": "[]" - }, - { - "name": "key_value_delimiter", - "description": "The string that separates the key from the value.", - "required": false, - "type": [ - "string" - ], - "default": "=" - }, - { - "name": "field_delimiter", - "description": "The string that separates each key-value pair.", - "required": false, - "type": [ - "string" - ], - "default": " " - }, - { - "name": "flatten_boolean", - "description": "Whether to encode key-value with a boolean value as a standalone key if `true` and nothing if `false`.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`fields_ordering` contains a non-string element." - ], - "examples": [ - { - "title": "Encode with default delimiters (no ordering)", - "source": "encode_key_value(\n {\n \"ts\": \"2021-06-05T17:20:00Z\",\n \"msg\": \"This is a message\",\n \"lvl\": \"info\"\n }\n)\n", - "return": "lvl=info msg=\"This is a message\" ts=2021-06-05T17:20:00Z" - }, - { - "title": "Encode with default delimiters (fields ordering)", - "source": "encode_key_value!(\n {\n \"ts\": \"2021-06-05T17:20:00Z\",\n \"msg\": \"This is a message\",\n \"lvl\": \"info\",\n \"log_id\": 12345\n },\n [\"ts\", \"lvl\", \"msg\"]\n)\n", - "return": "ts=2021-06-05T17:20:00Z lvl=info msg=\"This is a message\" log_id=12345" - }, - { - "title": "Encode with default delimiters (nested fields)", - "source": "encode_key_value(\n {\n \"agent\": {\"name\": \"foo\"},\n \"log\": {\"file\": {\"path\": \"my.log\"}},\n \"event\": \"log\"\n }\n)\n", - "return": "agent.name=foo event=log log.file.path=my.log" - }, - { - "title": "Encode with default delimiters (nested fields ordering)", - "source": "encode_key_value!(\n {\n \"agent\": {\"name\": \"foo\"},\n \"log\": {\"file\": {\"path\": \"my.log\"}},\n \"event\": \"log\"\n },\n [\"event\", \"log.file.path\", \"agent.name\"])\n", - "return": "event=log log.file.path=my.log agent.name=foo" - }, - { - "title": "Encode with custom delimiters (no ordering)", - "source": "encode_key_value(\n {\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\"},\n field_delimiter: \",\",\n key_value_delimiter: \":\"\n)\n", - "return": "lvl:info,msg:\"This is a message\",ts:2021-06-05T17:20:00Z" - }, - { - "title": "Encode with custom delimiters and flatten boolean", - "source": "encode_key_value(\n {\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\", \"beta\": true, \"dropped\": false},\n field_delimiter: \",\",\n key_value_delimiter: \":\",\n flatten_boolean: true\n)\n", - "return": "beta,lvl:info,msg:\"This is a message\",ts:2021-06-05T17:20:00Z" - } - ], - "notices": [ - "If `fields_ordering` is specified then the function is fallible else it is infallible." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_logfmt.cue b/website/cue/reference/remap/functions/encode_logfmt.cue deleted file mode 100644 index a6f787459e7d5..0000000000000 --- a/website/cue/reference/remap/functions/encode_logfmt.cue +++ /dev/null @@ -1,65 +0,0 @@ -{ - "remap": { - "functions": { - "encode_logfmt": { - "anchor": "encode_logfmt", - "name": "encode_logfmt", - "category": "Codec", - "description": "Encodes the `value` to [logfmt](https://brandur.org/logfmt).", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a logfmt string.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "fields_ordering", - "description": "The ordering of fields to preserve. Any fields not in this list are listed unordered, after all ordered fields.", - "required": false, - "type": [ - "array" - ], - "default": "[]" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`fields_ordering` contains a non-string element." - ], - "examples": [ - { - "title": "Encode to logfmt (no ordering)", - "source": "encode_logfmt({\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\"})", - "return": "lvl=info msg=\"This is a message\" ts=2021-06-05T17:20:00Z" - }, - { - "title": "Encode to logfmt (fields ordering)", - "source": "encode_logfmt!({\"ts\": \"2021-06-05T17:20:00Z\", \"msg\": \"This is a message\", \"lvl\": \"info\", \"log_id\": 12345}, [\"ts\", \"lvl\", \"msg\"])", - "return": "ts=2021-06-05T17:20:00Z lvl=info msg=\"This is a message\" log_id=12345" - }, - { - "title": "Encode to logfmt (nested fields)", - "source": "encode_logfmt({\"agent\": {\"name\": \"foo\"}, \"log\": {\"file\": {\"path\": \"my.log\"}}, \"event\": \"log\"})", - "return": "agent.name=foo event=log log.file.path=my.log" - }, - { - "title": "Encode to logfmt (nested fields ordering)", - "source": "encode_logfmt!({\"agent\": {\"name\": \"foo\"}, \"log\": {\"file\": {\"path\": \"my.log\"}}, \"event\": \"log\"}, [\"event\", \"log.file.path\", \"agent.name\"])", - "return": "event=log log.file.path=my.log agent.name=foo" - } - ], - "notices": [ - "If `fields_ordering` is specified then the function is fallible else it is infallible." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_lz4.cue b/website/cue/reference/remap/functions/encode_lz4.cue deleted file mode 100644 index 709d2f9cb72c1..0000000000000 --- a/website/cue/reference/remap/functions/encode_lz4.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "encode_lz4": { - "anchor": "encode_lz4", - "name": "encode_lz4", - "category": "Codec", - "description": "Encodes the `value` to [Lz4](https://lz4.github.io/lz4/). This function compresses the\ninput string into an lz4 block. If `prepend_size` is set to `true`, it prepends the\noriginal uncompressed size to the compressed data. This is useful for some\nimplementations of lz4 that require the original size to be known before decoding.", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "prepend_size", - "description": "Whether to prepend the original size to the compressed data.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Lz4", - "source": "encode_base64(encode_lz4!(\"The quick brown fox jumps over 13 lazy dogs.\", true))", - "return": "LAAAAPAdVGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIDEzIGxhenkgZG9ncy4=" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_percent.cue b/website/cue/reference/remap/functions/encode_percent.cue deleted file mode 100644 index 75907a70a1aa5..0000000000000 --- a/website/cue/reference/remap/functions/encode_percent.cue +++ /dev/null @@ -1,65 +0,0 @@ -{ - "remap": { - "functions": { - "encode_percent": { - "anchor": "encode_percent", - "name": "encode_percent", - "category": "Codec", - "description": "Encodes a `value` with [percent encoding](https://url.spec.whatwg.org/#percent-encoded-bytes) to safely be used in URLs.", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "ascii_set", - "description": "The ASCII set to use when encoding the data.", - "required": false, - "type": [ - "string" - ], - "enum": { - "NON_ALPHANUMERIC": "Encode any non-alphanumeric characters. This is the safest option.", - "CONTROLS": "Encode only [control characters](https://infra.spec.whatwg.org/#c0-control).", - "FRAGMENT": "Encode only [fragment characters](https://url.spec.whatwg.org/#fragment-percent-encode-set)", - "QUERY": "Encode only [query characters](https://url.spec.whatwg.org/#query-percent-encode-set)", - "SPECIAL": "Encode only [special characters](https://url.spec.whatwg.org/#special-percent-encode-set)", - "PATH": "Encode only [path characters](https://url.spec.whatwg.org/#path-percent-encode-set)", - "USERINFO": "Encode only [userinfo characters](https://url.spec.whatwg.org/#userinfo-percent-encode-set)", - "COMPONENT": "Encode only [component characters](https://url.spec.whatwg.org/#component-percent-encode-set)", - "WWW_FORM_URLENCODED": "Encode only [`application/x-www-form-urlencoded`](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set)" - }, - "default": "NON_ALPHANUMERIC" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Percent encode all non-alphanumeric characters (default)", - "source": "encode_percent(\"foo bar?\")", - "return": "foo%20bar%3F" - }, - { - "title": "Percent encode only control characters", - "source": "encode_percent(\"foo \\tbar\", ascii_set: \"CONTROLS\")", - "return": "foo %09bar" - }, - { - "title": "Percent encode special characters", - "source": "encode_percent(\"foo@bar?\")", - "return": "foo%40bar%3F" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_proto.cue b/website/cue/reference/remap/functions/encode_proto.cue deleted file mode 100644 index 9a1a25f884d89..0000000000000 --- a/website/cue/reference/remap/functions/encode_proto.cue +++ /dev/null @@ -1,55 +0,0 @@ -{ - "remap": { - "functions": { - "encode_proto": { - "anchor": "encode_proto", - "name": "encode_proto", - "category": "Codec", - "description": "Encodes the `value` into a protocol buffer payload.", - "arguments": [ - { - "name": "value", - "description": "The object to convert to a protocol buffer payload.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "desc_file", - "description": "The path to the protobuf descriptor set file. Must be a literal string.\n\nThis file is the output of protoc -o ...", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "message_type", - "description": "The name of the message type to use for serializing.\n\nMust be a literal string.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`desc_file` file does not exist.", - "`message_type` message type does not exist in the descriptor file." - ], - "examples": [ - { - "title": "Encode to proto", - "source": "encode_base64(encode_proto!({ \"name\": \"someone\", \"phones\": [{\"number\": \"123456\"}]}, \"test_protobuf.desc\", \"test_protobuf.v1.Person\"))", - "return": "Cgdzb21lb25lIggKBjEyMzQ1Ng==" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_punycode.cue b/website/cue/reference/remap/functions/encode_punycode.cue deleted file mode 100644 index 2d293b1fa0743..0000000000000 --- a/website/cue/reference/remap/functions/encode_punycode.cue +++ /dev/null @@ -1,62 +0,0 @@ -{ - "remap": { - "functions": { - "encode_punycode": { - "anchor": "encode_punycode", - "name": "encode_punycode", - "category": "Codec", - "description": "Encodes a `value` to [punycode](https://en.wikipedia.org/wiki/Punycode). Useful for internationalized domain names ([IDN](https://en.wikipedia.org/wiki/Internationalized_domain_name)). This function assumes that the value passed is meant to be used in IDN context and that it is either a domain name or a part of it.", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "validate", - "description": "Whether to validate the input string to check if it is a valid domain name.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` can not be encoded to `punycode`" - ], - "examples": [ - { - "title": "Encode an internationalized domain name", - "source": "encode_punycode!(\"www.café.com\")", - "return": "www.xn--caf-dma.com" - }, - { - "title": "Encode an internationalized domain name with mixed case", - "source": "encode_punycode!(\"www.CAFé.com\")", - "return": "www.xn--caf-dma.com" - }, - { - "title": "Encode an ASCII only string", - "source": "encode_punycode!(\"www.cafe.com\")", - "return": "www.cafe.com" - }, - { - "title": "Ignore validation", - "source": "encode_punycode!(\"xn--8hbb.xn--fiba.xn--8hbf.xn--eib.\", validate: false)", - "return": "xn--8hbb.xn--fiba.xn--8hbf.xn--eib." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_snappy.cue b/website/cue/reference/remap/functions/encode_snappy.cue deleted file mode 100644 index 9a50830643fa3..0000000000000 --- a/website/cue/reference/remap/functions/encode_snappy.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "encode_snappy": { - "anchor": "encode_snappy", - "name": "encode_snappy", - "category": "Codec", - "description": "Encodes the `value` to Snappy.", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` cannot be encoded into a Snappy string." - ], - "examples": [ - { - "title": "Encode to Snappy", - "source": "encode_base64(encode_snappy!(\"The quick brown fox jumps over 13 lazy dogs.\"))", - "return": "LKxUaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgMTMgbGF6eSBkb2dzLg==" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_zlib.cue b/website/cue/reference/remap/functions/encode_zlib.cue deleted file mode 100644 index f7a34aed5f2a8..0000000000000 --- a/website/cue/reference/remap/functions/encode_zlib.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "encode_zlib": { - "anchor": "encode_zlib", - "name": "encode_zlib", - "category": "Codec", - "description": "Encodes the `value` to [Zlib](https://www.zlib.net).", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "compression_level", - "description": "The default compression level.", - "required": false, - "type": [ - "integer" - ], - "default": "6" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Zlib", - "source": "encode_base64(encode_zlib(\"please encode me\"))", - "return": "eJwryElNLE5VSM1Lzk9JVchNBQA0RQX7" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encode_zstd.cue b/website/cue/reference/remap/functions/encode_zstd.cue deleted file mode 100644 index f4bd875943c17..0000000000000 --- a/website/cue/reference/remap/functions/encode_zstd.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "encode_zstd": { - "anchor": "encode_zstd", - "name": "encode_zstd", - "category": "Codec", - "description": "Encodes the `value` to [Zstandard](https://facebook.github.io/zstd).", - "arguments": [ - { - "name": "value", - "description": "The string to encode.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "compression_level", - "description": "The default compression level.", - "required": false, - "type": [ - "integer" - ], - "default": "3" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Encode to Zstd", - "source": "encode_base64(encode_zstd(\"please encode me\"))", - "return": "KLUv/QBYgQAAcGxlYXNlIGVuY29kZSBtZQ==" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encrypt.cue b/website/cue/reference/remap/functions/encrypt.cue deleted file mode 100644 index 37326469100f0..0000000000000 --- a/website/cue/reference/remap/functions/encrypt.cue +++ /dev/null @@ -1,69 +0,0 @@ -{ - "remap": { - "functions": { - "encrypt": { - "anchor": "encrypt", - "name": "encrypt", - "category": "Cryptography", - "description": "Encrypts a string with a symmetric encryption algorithm.\n\nSupported Algorithms:\n\n* AES-256-CFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-CFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-CFB (key = 16 bytes, iv = 16 bytes)\n* AES-256-OFB (key = 32 bytes, iv = 16 bytes)\n* AES-192-OFB (key = 24 bytes, iv = 16 bytes)\n* AES-128-OFB (key = 16 bytes, iv = 16 bytes)\n* AES-128-SIV (key = 32 bytes, iv = 16 bytes)\n* AES-256-SIV (key = 64 bytes, iv = 16 bytes)\n* Deprecated - AES-256-CTR (key = 32 bytes, iv = 16 bytes)\n* Deprecated - AES-192-CTR (key = 24 bytes, iv = 16 bytes)\n* Deprecated - AES-128-CTR (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-LE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-LE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-LE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CTR-BE (key = 32 bytes, iv = 16 bytes)\n* AES-192-CTR-BE (key = 24 bytes, iv = 16 bytes)\n* AES-128-CTR-BE (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-PKCS7 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-PKCS7 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-PKCS7 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ANSIX923 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ANSIX923 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ANSIX923 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO7816 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO7816 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO7816 (key = 16 bytes, iv = 16 bytes)\n* AES-256-CBC-ISO10126 (key = 32 bytes, iv = 16 bytes)\n* AES-192-CBC-ISO10126 (key = 24 bytes, iv = 16 bytes)\n* AES-128-CBC-ISO10126 (key = 16 bytes, iv = 16 bytes)\n* CHACHA20-POLY1305 (key = 32 bytes, iv = 12 bytes)\n* XCHACHA20-POLY1305 (key = 32 bytes, iv = 24 bytes)\n* XSALSA20-POLY1305 (key = 32 bytes, iv = 24 bytes)", - "arguments": [ - { - "name": "plaintext", - "description": "The string to encrypt.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "algorithm", - "description": "The algorithm to use.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key", - "description": "The key in raw bytes (not encoded) for encryption. The length must match the algorithm requested.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "iv", - "description": "The IV in raw bytes (not encoded) for encryption. The length must match the algorithm requested.\nA new IV should be generated for every message. You can use `random_bytes` to generate a cryptographically secure random value.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`algorithm` is not a supported algorithm.", - "`key` length does not match the key size required for the algorithm specified.", - "`iv` length does not match the `iv` size required for the algorithm specified." - ], - "examples": [ - { - "title": "Encrypt value using AES-256-CFB", - "source": "iv = \"0123456789012345\" # typically you would call random_bytes(16)\nkey = \"01234567890123456789012345678912\"\nencrypted_message = encrypt!(\"data\", \"AES-256-CFB\", key: key, iv: iv)\nencode_base64(encrypted_message)\n", - "return": "c/dIOA==" - }, - { - "title": "Encrypt value using AES-128-CBC-PKCS7", - "source": "iv = \"1234567890123456\" # typically you would call random_bytes(16)\nkey = \"16_byte_keyxxxxx\"\nencrypted_message = encrypt!(\"super secret message\", \"AES-128-CBC-PKCS7\", key: key, iv: iv)\nencode_base64(encrypted_message)\n", - "return": "GBw8Mu00v0Kc38+/PvsVtGgWuUJ+ZNLgF8Opy8ohIYE=" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/encrypt_ip.cue b/website/cue/reference/remap/functions/encrypt_ip.cue deleted file mode 100644 index 9d9bcde349a38..0000000000000 --- a/website/cue/reference/remap/functions/encrypt_ip.cue +++ /dev/null @@ -1,74 +0,0 @@ -{ - "remap": { - "functions": { - "encrypt_ip": { - "anchor": "encrypt_ip", - "name": "encrypt_ip", - "category": "IP", - "description": "Encrypts an IP address, transforming it into a different valid IP address.\n\nSupported Modes:\n\n* AES128 - Scrambles the entire IP address using AES-128 encryption. Can transform between IPv4 and IPv6.\n* PFX (Prefix-preserving) - Maintains network hierarchy by ensuring that IP addresses within the same network are encrypted to addresses that also share a common network. This preserves prefix relationships while providing confidentiality.", - "arguments": [ - { - "name": "ip", - "description": "The IP address to encrypt (v4 or v6).", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key", - "description": "The encryption key in raw bytes (not encoded). For AES128 mode, the key must be exactly 16 bytes. For PFX mode, the key must be exactly 32 bytes.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "mode", - "description": "The encryption mode to use. Must be either `aes128` or `pfx`.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`ip` is not a valid IP address.", - "`mode` is not a supported mode (must be `aes128` or `pfx`).", - "`key` length does not match the requirements for the specified mode (16 bytes for `aes128`, 32 bytes for `pfx`)." - ], - "examples": [ - { - "title": "Encrypt IPv4 address with AES128", - "source": "encrypt_ip!(\"192.168.1.1\", \"sixteen byte key\", \"aes128\")", - "return": "72b9:a747:f2e9:72af:76ca:5866:6dcf:c3b0" - }, - { - "title": "Encrypt IPv6 address with AES128", - "source": "encrypt_ip!(\"2001:db8::1\", \"sixteen byte key\", \"aes128\")", - "return": "c0e6:eb35:6887:f554:4c65:8ace:17ca:6c6a" - }, - { - "title": "Encrypt IPv4 address with prefix-preserving mode", - "source": "encrypt_ip!(\"192.168.1.1\", \"thirty-two bytes key for pfx use\", \"pfx\")", - "return": "33.245.248.61" - }, - { - "title": "Encrypt IPv6 address with prefix-preserving mode", - "source": "encrypt_ip!(\"2001:db8::1\", \"thirty-two bytes key for ipv6pfx\", \"pfx\")", - "return": "88bd:d2bf:8865:8c4d:84b:44f6:6077:72c9" - } - ], - "notices": [ - "The `aes128` mode implements the `ipcrypt-deterministic` algorithm from the IPCrypt\nspecification, while the `pfx` mode implements the `ipcrypt-pfx` algorithm. Both modes\nprovide deterministic encryption where the same input IP address encrypted with the\nsame key will always produce the same encrypted output." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ends_with.cue b/website/cue/reference/remap/functions/ends_with.cue deleted file mode 100644 index f1b0dae5ff2e3..0000000000000 --- a/website/cue/reference/remap/functions/ends_with.cue +++ /dev/null @@ -1,62 +0,0 @@ -{ - "remap": { - "functions": { - "ends_with": { - "anchor": "ends_with", - "name": "ends_with", - "category": "String", - "description": "Determines whether the `value` string ends with the specified `substring`.", - "arguments": [ - { - "name": "value", - "description": "The string to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "substring", - "description": "The substring with which `value` must end.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "case_sensitive", - "description": "Whether the match should be case sensitive.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "String ends with (case sensitive)", - "source": "ends_with(\"The Needle In The Haystack\", \"The Haystack\")", - "return": true - }, - { - "title": "String ends with (case insensitive)", - "source": "ends_with(\"The Needle In The Haystack\", \"the haystack\", case_sensitive: false)", - "return": true - }, - { - "title": "String ends with (case sensitive failure)", - "source": "ends_with(\"foobar\", \"R\")", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/exists.cue b/website/cue/reference/remap/functions/exists.cue deleted file mode 100644 index 85bd2c0be6edd..0000000000000 --- a/website/cue/reference/remap/functions/exists.cue +++ /dev/null @@ -1,45 +0,0 @@ -{ - "remap": { - "functions": { - "exists": { - "anchor": "exists", - "name": "exists", - "category": "Path", - "description": "Checks whether the `path` exists for the target.\n\nThis function distinguishes between a missing path\nand a path with a `null` value. A regular path lookup,\nsuch as `.foo`, cannot distinguish between the two cases\nsince it always returns `null` if the path doesn't exist.", - "arguments": [ - { - "name": "field", - "description": "The path of the field to check.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Exists (field)", - "source": ". = { \"field\": 1 }\nexists(.field)\n", - "return": true - }, - { - "title": "Exists (array element)", - "source": ". = { \"array\": [1, 2, 3] }\nexists(.array[2])\n", - "return": true - }, - { - "title": "Does not exist (field)", - "source": "exists({ \"foo\": \"bar\"}.baz)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/filter.cue b/website/cue/reference/remap/functions/filter.cue deleted file mode 100644 index 367554fc8cdd6..0000000000000 --- a/website/cue/reference/remap/functions/filter.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "filter": { - "anchor": "filter", - "name": "filter", - "category": "Enumerate", - "description": "Filter elements from a collection.\n\nThis function currently *does not* support recursive iteration.\n\nThe function uses the function closure syntax to allow reading\nthe key-value or index-value combination for each item in the\ncollection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", - "arguments": [ - { - "name": "value", - "description": "The array or object to filter.", - "required": true, - "type": [ - "object", - "array" - ] - } - ], - "return": { - "types": [ - "object", - "array" - ] - }, - "examples": [ - { - "title": "Filter elements", - "source": ". = { \"tags\": [\"foo\", \"bar\", \"foo\", \"baz\"] }\nfilter(array(.tags)) -> |_index, value| {\n value != \"foo\"\n}\n", - "return": [ - "bar", - "baz" - ] - }, - { - "title": "Filter object", - "source": "filter({ \"a\": 1, \"b\": 2 }) -> |key, _value| { key == \"a\" }", - "return": { - "a": 1 - } - }, - { - "title": "Filter array", - "source": "filter([1, 2]) -> |_index, value| { value < 2 }", - "return": [ - 1 - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/find.cue b/website/cue/reference/remap/functions/find.cue deleted file mode 100644 index 3b00297eeefc0..0000000000000 --- a/website/cue/reference/remap/functions/find.cue +++ /dev/null @@ -1,73 +0,0 @@ -{ - "remap": { - "functions": { - "find": { - "anchor": "find", - "name": "find", - "category": "String", - "description": "Determines from left to right the start position of the first found element in `value` that matches `pattern`. Returns `-1` if not found.", - "arguments": [ - { - "name": "value", - "description": "The string to find the pattern in.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "The regular expression or string pattern to match against.", - "required": true, - "type": [ - "string", - "regex" - ] - }, - { - "name": "from", - "description": "Offset to start searching.", - "required": false, - "type": [ - "integer" - ], - "default": "0" - } - ], - "return": { - "types": [ - "integer" - ] - }, - "examples": [ - { - "title": "Match text", - "source": "find(\"foobar\", \"bar\")", - "return": 3 - }, - { - "title": "Match text at start", - "source": "find(\"foobar\", \"foo\")", - "return": 0 - }, - { - "title": "Match regex", - "source": "find(\"foobar\", r'b.r')", - "return": 3 - }, - { - "title": "No matches", - "source": "find(\"foobar\", \"baz\")", - "return": null - }, - { - "title": "With an offset", - "source": "find(\"foobarfoobarfoo\", \"bar\", 4)", - "return": 9 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/find_enrichment_table_records.cue b/website/cue/reference/remap/functions/find_enrichment_table_records.cue deleted file mode 100644 index 6aeb89934fcc1..0000000000000 --- a/website/cue/reference/remap/functions/find_enrichment_table_records.cue +++ /dev/null @@ -1,127 +0,0 @@ -{ - "remap": { - "functions": { - "find_enrichment_table_records": { - "anchor": "find_enrichment_table_records", - "name": "find_enrichment_table_records", - "category": "Enrichment", - "description": "Searches an [enrichment table](/docs/reference/glossary/#enrichment-tables) for rows that match the provided condition.\n\nFor `file` enrichment tables, this condition needs to be a VRL object in which\nthe key-value pairs indicate a field to search mapped to a value to search in that field.\nThis function returns the rows that match the provided condition(s). _All_ fields need to\nmatch for rows to be returned; if any fields do not match, then no rows are returned.\n\nThere are currently three forms of search criteria:\n\n1. **Exact match search**. The given field must match the value exactly. Case sensitivity\n can be specified using the `case_sensitive` argument. An exact match search can use an\n index directly into the dataset, which should make this search fairly \"cheap\" from a\n performance perspective.\n\n2. **Wildcard match search**. The given fields specified by the exact match search may also\n be matched exactly to the value provided to the `wildcard` parameter.\n A wildcard match search can also use an index directly into the dataset.\n\n3. **Date range search**. The given field must be greater than or equal to the `from` date\n and/or less than or equal to the `to` date. A date range search involves\n sequentially scanning through the rows that have been located using any exact match\n criteria. This can be an expensive operation if there are many rows returned by any exact\n match criteria. Therefore, use date ranges as the _only_ criteria when the enrichment\n data set is very small.\n\nFor `geoip` and `mmdb` enrichment tables, this condition needs to be a VRL object with a single key-value pair\nwhose value needs to be a valid IP address. Example: `{\"ip\": .ip }`. If a return field is expected\nand without a value, `null` is used. This table can return the following fields:\n\n* ISP databases:\n * `autonomous_system_number`\n * `autonomous_system_organization`\n * `isp`\n * `organization`\n\n* City databases:\n * `city_name`\n * `continent_code`\n * `country_code`\n * `country_name`\n * `region_code`\n * `region_name`\n * `metro_code`\n * `latitude`\n * `longitude`\n * `postal_code`\n * `timezone`\n\n* Connection-Type databases:\n * `connection_type`\n\nTo use this function, you need to update your configuration to\ninclude an\n[`enrichment_tables`](/docs/reference/configuration/global-options/#enrichment_tables)\nparameter.", - "arguments": [ - { - "name": "table", - "description": "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "condition", - "description": "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "select", - "description": "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", - "required": false, - "type": [ - "array" - ] - }, - { - "name": "case_sensitive", - "description": "Whether text fields need to match cases exactly.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "wildcard", - "description": "Value to use for wildcard matching in the search.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "examples": [ - { - "title": "Exact match", - "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"Smith\"}\n)\n", - "return": [ - { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - }, - { - "id": 2, - "firstname": "Fred", - "surname": "Smith" - } - ] - }, - { - "title": "Case insensitive match", - "source": "find_enrichment_table_records!(\n \"test\",\n {\"surname\": \"smith\"},\n case_sensitive: false\n)\n", - "return": [ - { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - }, - { - "id": 2, - "firstname": "Fred", - "surname": "Smith" - } - ] - }, - { - "title": "Wildcard match", - "source": "find_enrichment_table_records!(\n \"test\",\n {\"firstname\": \"Bob\"},\n wildcard: \"fred\",\n case_sensitive: false\n)\n", - "return": [ - { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - }, - { - "id": 2, - "firstname": "Fred", - "surname": "Smith" - } - ] - }, - { - "title": "Date range search", - "source": "find_enrichment_table_records!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", - "return": [ - { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - }, - { - "id": 2, - "firstname": "Fred", - "surname": "Smith" - } - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/find_vector_metrics.cue b/website/cue/reference/remap/functions/find_vector_metrics.cue deleted file mode 100644 index c9d8a4b271616..0000000000000 --- a/website/cue/reference/remap/functions/find_vector_metrics.cue +++ /dev/null @@ -1,73 +0,0 @@ -{ - "remap": { - "functions": { - "find_vector_metrics": { - "anchor": "find_vector_metrics", - "name": "find_vector_metrics", - "category": "Metrics", - "description": "Searches internal Vector metrics by name and optionally by tags. Returns all matching metrics.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", - "arguments": [ - { - "name": "key", - "description": "The metric name to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "tags", - "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - } - ], - "return": { - "types": [ - "array" - ] - }, - "examples": [ - { - "title": "Find vector internal metrics matching the name", - "source": "find_vector_metrics(\"utilization\")", - "return": [ - { - "name": "utilization", - "tags": { - "component_id": [ - "test" - ] - }, - "type": "gauge", - "kind": "absolute", - "value": 0.5 - } - ] - }, - { - "title": "Find vector internal metrics matching the name and tags", - "source": "find_vector_metrics(\"utilization\", tags: {\"component_id\": \"test\"})", - "return": [ - { - "name": "utilization", - "tags": { - "component_id": [ - "test" - ] - }, - "type": "gauge", - "kind": "absolute", - "value": 0.5 - } - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/flatten.cue b/website/cue/reference/remap/functions/flatten.cue deleted file mode 100644 index b677ebb91122c..0000000000000 --- a/website/cue/reference/remap/functions/flatten.cue +++ /dev/null @@ -1,75 +0,0 @@ -{ - "remap": { - "functions": { - "flatten": { - "anchor": "flatten", - "name": "flatten", - "category": "Enumerate", - "description": "Flattens the `value` into a single-level representation.", - "arguments": [ - { - "name": "value", - "description": "The array or object to flatten.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "separator", - "description": "The separator to join nested keys", - "required": false, - "type": [ - "string" - ], - "default": "." - } - ], - "return": { - "types": [ - "object", - "array" - ], - "rules": [ - "The return type matches the `value` type." - ] - }, - "examples": [ - { - "title": "Flatten array", - "source": "flatten([1, [2, 3, 4], [5, [6, 7], 8], 9])", - "return": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9 - ] - }, - { - "title": "Flatten object", - "source": "flatten({\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n})\n", - "return": { - "parent1.child1": 1, - "parent1.child2": 2, - "parent2.child3": 3 - } - }, - { - "title": "Flatten object with custom separator", - "source": "flatten({ \"foo\": { \"bar\": true }}, \"_\")", - "return": { - "foo_bar": true - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/float.cue b/website/cue/reference/remap/functions/float.cue deleted file mode 100644 index 21f47ae8e883f..0000000000000 --- a/website/cue/reference/remap/functions/float.cue +++ /dev/null @@ -1,52 +0,0 @@ -{ - "remap": { - "functions": { - "float": { - "anchor": "float", - "name": "float", - "category": "Type", - "description": "Returns `value` if it is a float, otherwise returns an error. This enables the type checker to guarantee that the returned value is a float and can be used in any function that expects a float.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a float.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "float" - ], - "rules": [ - "Returns the `value` if it's a float.", - "Raises an error if not a float." - ] - }, - "internal_failure_reasons": [ - "`value` is not a float." - ], - "examples": [ - { - "title": "Declare a float type", - "source": ". = { \"value\": 42.0 }\nfloat(.value)\n", - "return": 42.0 - }, - { - "title": "Declare a float type (literal)", - "source": "float(3.1415)", - "return": 3.1415 - }, - { - "title": "Invalid float type", - "source": "float!(true)", - "raises": "function call error for \"float\" at (0:12): expected float, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/floor.cue b/website/cue/reference/remap/functions/floor.cue deleted file mode 100644 index 9cc8c6a2ad6c5..0000000000000 --- a/website/cue/reference/remap/functions/floor.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "floor": { - "anchor": "floor", - "name": "floor", - "category": "Number", - "description": "Rounds the `value` down to the specified `precision`.", - "arguments": [ - { - "name": "value", - "description": "The number to round down.", - "required": true, - "type": [ - "integer", - "float" - ] - }, - { - "name": "precision", - "description": "The number of decimal places to round to.", - "required": false, - "type": [ - "integer" - ], - "default": "0" - } - ], - "return": { - "types": [ - "integer", - "float" - ], - "rules": [ - "Returns an integer if `precision` is `0` (this is the default). Returns a float otherwise." - ] - }, - "examples": [ - { - "title": "Round a number down (without precision)", - "source": "floor(9.8)", - "return": 9.0 - }, - { - "title": "Round a number down (with precision)", - "source": "floor(4.345, precision: 2)", - "return": 4.34 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/for_each.cue b/website/cue/reference/remap/functions/for_each.cue deleted file mode 100644 index 5f8d0c234054d..0000000000000 --- a/website/cue/reference/remap/functions/for_each.cue +++ /dev/null @@ -1,50 +0,0 @@ -{ - "remap": { - "functions": { - "for_each": { - "anchor": "for_each", - "name": "for_each", - "category": "Enumerate", - "description": "Iterate over a collection.\n\nThis function currently *does not* support recursive iteration.\n\nThe function uses the \"function closure syntax\" to allow reading\nthe key/value or index/value combination for each item in the\ncollection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", - "arguments": [ - { - "name": "value", - "description": "The array or object to iterate.", - "required": true, - "type": [ - "object", - "array" - ] - } - ], - "return": { - "types": [ - "null" - ] - }, - "examples": [ - { - "title": "Tally elements", - "source": ".tags = [\"foo\", \"bar\", \"foo\", \"baz\"]\ntally = {}\nfor_each(array(.tags)) -> |_index, value| {\n count = int(get!(tally, [value])) ?? 0\n tally = set!(tally, [value], count + 1)\n}\ntally\n", - "return": { - "bar": 1, - "baz": 1, - "foo": 2 - } - }, - { - "title": "Iterate over an object", - "source": "count = 0\nfor_each({ \"a\": 1, \"b\": 2 }) -> |_key, value| {\n count = count + value\n}\ncount\n", - "return": 3 - }, - { - "title": "Iterate over an array", - "source": "count = 0\nfor_each([1, 2, 3]) -> |index, value| {\n count = count + index + value\n}\ncount\n", - "return": 9 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/format_int.cue b/website/cue/reference/remap/functions/format_int.cue deleted file mode 100644 index e24be8d9cf90d..0000000000000 --- a/website/cue/reference/remap/functions/format_int.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "format_int": { - "anchor": "format_int", - "name": "format_int", - "category": "Number", - "description": "Formats the integer `value` into a string representation using the given base/radix.", - "arguments": [ - { - "name": "value", - "description": "The number to format.", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "base", - "description": "The base to format the number in. Must be between 2 and 36 (inclusive).", - "required": false, - "type": [ - "integer" - ], - "default": "10" - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "The base is not between 2 and 36." - ], - "examples": [ - { - "title": "Format as a hexadecimal integer", - "source": "format_int!(42, 16)", - "return": "2a" - }, - { - "title": "Format as a negative hexadecimal integer", - "source": "format_int!(-42, 16)", - "return": "-2a" - }, - { - "title": "Format as a decimal integer (default base)", - "source": "format_int!(42)", - "return": "42" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/format_number.cue b/website/cue/reference/remap/functions/format_number.cue deleted file mode 100644 index 244f25d0284e2..0000000000000 --- a/website/cue/reference/remap/functions/format_number.cue +++ /dev/null @@ -1,71 +0,0 @@ -{ - "remap": { - "functions": { - "format_number": { - "anchor": "format_number", - "name": "format_number", - "category": "Number", - "description": "Formats the `value` into a string representation of the number.", - "arguments": [ - { - "name": "value", - "description": "The number to format as a string.", - "required": true, - "type": [ - "integer", - "float" - ] - }, - { - "name": "scale", - "description": "The number of decimal places to display.", - "required": false, - "type": [ - "integer" - ] - }, - { - "name": "decimal_separator", - "description": "The character to use between the whole and decimal parts of the number.", - "required": false, - "type": [ - "string" - ], - "default": "." - }, - { - "name": "grouping_separator", - "description": "The character to use between each thousands part of the number.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Format a number (3 decimals)", - "source": "format_number(1234567.89, 3, decimal_separator: \".\", grouping_separator: \",\")", - "return": "1,234,567.890" - }, - { - "title": "Format a number with European-style separators", - "source": "format_number(4672.4, decimal_separator: \",\", grouping_separator: \"_\")", - "return": "4_672,4" - }, - { - "title": "Format a number with a middle dot separator", - "source": "format_number(4321.09, 3, decimal_separator: \"·\")", - "return": "4321·090" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/format_timestamp.cue b/website/cue/reference/remap/functions/format_timestamp.cue deleted file mode 100644 index 722be6f647a83..0000000000000 --- a/website/cue/reference/remap/functions/format_timestamp.cue +++ /dev/null @@ -1,66 +0,0 @@ -{ - "remap": { - "functions": { - "format_timestamp": { - "anchor": "format_timestamp", - "name": "format_timestamp", - "category": "Timestamp", - "description": "Formats `value` into a string representation of the timestamp.", - "arguments": [ - { - "name": "value", - "description": "The timestamp to format as text.", - "required": true, - "type": [ - "timestamp" - ] - }, - { - "name": "format", - "description": "The format string as described by the [Chrono library](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers).", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "timezone", - "description": "The timezone to use when formatting the timestamp. The parameter uses the TZ identifier or `local`.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Format a timestamp (ISO8601/RFC 3339)", - "source": "format_timestamp!(t'2020-10-21T16:00:00Z', format: \"%+\")", - "return": "2020-10-21T16:00:00+00:00" - }, - { - "title": "Format a timestamp (custom)", - "source": "format_timestamp!(t'2020-10-21T16:00:00Z', format: \"%v %R\")", - "return": "21-Oct-2020 16:00" - }, - { - "title": "Format a timestamp with custom format string", - "source": "format_timestamp!(t'2021-02-10T23:32:00+00:00', format: \"%d %B %Y %H:%M\")", - "return": "10 February 2021 23:32" - }, - { - "title": "Format a timestamp with timezone conversion", - "source": "format_timestamp!(t'2021-02-10T23:32:00+00:00', format: \"%d %B %Y %H:%M\", timezone: \"Europe/Berlin\")", - "return": "11 February 2021 00:32" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/from_unix_timestamp.cue b/website/cue/reference/remap/functions/from_unix_timestamp.cue deleted file mode 100644 index 4e29934d47f69..0000000000000 --- a/website/cue/reference/remap/functions/from_unix_timestamp.cue +++ /dev/null @@ -1,65 +0,0 @@ -{ - "remap": { - "functions": { - "from_unix_timestamp": { - "anchor": "from_unix_timestamp", - "name": "from_unix_timestamp", - "category": "Convert", - "description": "Converts the `value` integer from a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) to a VRL `timestamp`.\n\nConverts from the number of seconds since the Unix epoch by default. To convert from milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`.", - "arguments": [ - { - "name": "value", - "description": "The Unix timestamp to convert.", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "unit", - "description": "The time unit.", - "required": false, - "type": [ - "string" - ], - "enum": { - "seconds": "Express Unix time in seconds", - "milliseconds": "Express Unix time in milliseconds", - "nanoseconds": "Express Unix time in nanoseconds", - "microseconds": "Express Unix time in microseconds" - }, - "default": "seconds" - } - ], - "return": { - "types": [ - "timestamp" - ] - }, - "examples": [ - { - "title": "Convert from a Unix timestamp (seconds)", - "source": "from_unix_timestamp!(5)", - "return": "t'1970-01-01T00:00:05Z'" - }, - { - "title": "Convert from a Unix timestamp (milliseconds)", - "source": "from_unix_timestamp!(5000, unit: \"milliseconds\")", - "return": "t'1970-01-01T00:00:05Z'" - }, - { - "title": "Convert from a Unix timestamp (microseconds)", - "source": "from_unix_timestamp!(5000, unit: \"microseconds\")", - "return": "t'1970-01-01T00:00:00.005Z'" - }, - { - "title": "Convert from a Unix timestamp (nanoseconds)", - "source": "from_unix_timestamp!(5000, unit: \"nanoseconds\")", - "return": "t'1970-01-01T00:00:00.000005Z'" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get.cue b/website/cue/reference/remap/functions/get.cue deleted file mode 100644 index be16483ee2c3e..0000000000000 --- a/website/cue/reference/remap/functions/get.cue +++ /dev/null @@ -1,100 +0,0 @@ -{ - "remap": { - "functions": { - "get": { - "anchor": "get", - "name": "get", - "category": "Path", - "description": "Dynamically get the value of a given path.\n\nIf you know the path you want to look up, use\nstatic paths such as `.foo.bar[1]` to get the value of that\npath. However, if you do not know the path names,\nuse the dynamic `get` function to get the requested value.", - "arguments": [ - { - "name": "value", - "description": "The object or array to query.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "path", - "description": "An array of path segments to look for the value.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "any" - ] - }, - "internal_failure_reasons": [ - "The `path` segment must be a string or an integer." - ], - "examples": [ - { - "title": "Single-segment top-level field", - "source": "get!(value: {\"foo\": \"bar\"}, path: [\"foo\"])", - "return": "bar" - }, - { - "title": "Returns null for unknown field", - "source": "get!(value: {\"foo\": \"bar\"}, path: [\"baz\"])", - "return": null - }, - { - "title": "Multi-segment nested field", - "source": "get!(value: {\"foo\": { \"bar\": true }}, path: [\"foo\", \"bar\"])", - "return": true - }, - { - "title": "Array indexing", - "source": "get!(value: [92, 42], path: [0])", - "return": 92 - }, - { - "title": "Array indexing (negative)", - "source": "get!(value: [\"foo\", \"bar\", \"baz\"], path: [-2])", - "return": "bar" - }, - { - "title": "Nested indexing", - "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1])", - "return": 42 - }, - { - "title": "External target", - "source": "get!(value: ., path: [\"foo\"])", - "input": { - "foo": true - }, - "return": true - }, - { - "title": "Variable", - "source": "var = { \"foo\": true }\nget!(value: var, path: [\"foo\"])\n", - "return": true - }, - { - "title": "Missing index", - "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1, -1])", - "return": null - }, - { - "title": "Invalid indexing", - "source": "get!(value: [42], path: [\"foo\"])", - "return": null - }, - { - "title": "Invalid segment type", - "source": "get!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", true])", - "raises": "function call error for \"get\" at (0:62): path segment must be either string or integer, not boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_enrichment_table_record.cue b/website/cue/reference/remap/functions/get_enrichment_table_record.cue deleted file mode 100644 index 4e1bdb0cddcf2..0000000000000 --- a/website/cue/reference/remap/functions/get_enrichment_table_record.cue +++ /dev/null @@ -1,94 +0,0 @@ -{ - "remap": { - "functions": { - "get_enrichment_table_record": { - "anchor": "get_enrichment_table_record", - "name": "get_enrichment_table_record", - "category": "Enrichment", - "description": "Searches an [enrichment table](/docs/reference/glossary/#enrichment-tables) for a row that matches the provided condition. A single row must be matched. If no rows are found or more than one row is found, an error is returned.\n\nFor `file` enrichment tables, this condition needs to be a VRL object in which\nthe key-value pairs indicate a field to search mapped to a value to search in that field.\nThis function returns the rows that match the provided condition(s). _All_ fields need to\nmatch for rows to be returned; if any fields do not match, then no rows are returned.\n\nThere are currently three forms of search criteria:\n\n1. **Exact match search**. The given field must match the value exactly. Case sensitivity\n can be specified using the `case_sensitive` argument. An exact match search can use an\n index directly into the dataset, which should make this search fairly \"cheap\" from a\n performance perspective.\n\n2. **Wildcard match search**. The given fields specified by the exact match search may also\n be matched exactly to the value provided to the `wildcard` parameter.\n A wildcard match search can also use an index directly into the dataset.\n\n3. **Date range search**. The given field must be greater than or equal to the `from` date\n and/or less than or equal to the `to` date. A date range search involves\n sequentially scanning through the rows that have been located using any exact match\n criteria. This can be an expensive operation if there are many rows returned by any exact\n match criteria. Therefore, use date ranges as the _only_ criteria when the enrichment\n data set is very small.\n\nFor `geoip` and `mmdb` enrichment tables, this condition needs to be a VRL object with a single key-value pair\nwhose value needs to be a valid IP address. Example: `{\"ip\": .ip }`. If a return field is expected\nand without a value, `null` is used. This table can return the following fields:\n\n* ISP databases:\n * `autonomous_system_number`\n * `autonomous_system_organization`\n * `isp`\n * `organization`\n\n* City databases:\n * `city_name`\n * `continent_code`\n * `country_code`\n * `country_name`\n * `region_code`\n * `region_name`\n * `metro_code`\n * `latitude`\n * `longitude`\n * `postal_code`\n * `timezone`\n\n* Connection-Type databases:\n * `connection_type`\n\nTo use this function, you need to update your configuration to\ninclude an\n[`enrichment_tables`](/docs/reference/configuration/global-options/#enrichment_tables)\nparameter.", - "arguments": [ - { - "name": "table", - "description": "The [enrichment table](/docs/reference/glossary/#enrichment-tables) to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "condition", - "description": "The condition to search on. Since the condition is used at boot time to create indices into the data, these conditions must be statically defined.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "select", - "description": "A subset of fields from the enrichment table to return. If not specified, all fields are returned.", - "required": false, - "type": [ - "array" - ] - }, - { - "name": "case_sensitive", - "description": "Whether the text fields match the case exactly.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "wildcard", - "description": "Value to use for wildcard matching in the search.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "The row is not found.", - "Multiple rows are found that match the condition." - ], - "examples": [ - { - "title": "Exact match", - "source": "get_enrichment_table_record!(\"test\", {\"id\": 1})", - "return": { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - } - }, - { - "title": "Case insensitive match", - "source": "get_enrichment_table_record!(\n \"test\",\n {\"surname\": \"bob\", \"firstname\": \"John\"},\n case_sensitive: false\n)\n", - "return": { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - } - }, - { - "title": "Date range search", - "source": "get_enrichment_table_record!(\n \"test\",\n {\n \"surname\": \"Smith\",\n \"date_of_birth\": {\n \"from\": t'1985-01-01T00:00:00Z',\n \"to\": t'1985-12-31T00:00:00Z'\n }\n }\n)\n", - "return": { - "id": 1, - "firstname": "Bob", - "surname": "Smith" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_env_var.cue b/website/cue/reference/remap/functions/get_env_var.cue deleted file mode 100644 index 83efb10db884f..0000000000000 --- a/website/cue/reference/remap/functions/get_env_var.cue +++ /dev/null @@ -1,39 +0,0 @@ -{ - "remap": { - "functions": { - "get_env_var": { - "anchor": "get_env_var", - "name": "get_env_var", - "category": "System", - "description": "Returns the value of the environment variable specified by `name`.", - "arguments": [ - { - "name": "name", - "description": "The name of the environment variable.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "Environment variable `name` does not exist.", - "The value of environment variable `name` is not valid Unicode" - ], - "examples": [ - { - "title": "Get an environment variable", - "source": "get_env_var!(\"HOME\")", - "return": "/root" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_hostname.cue b/website/cue/reference/remap/functions/get_hostname.cue deleted file mode 100644 index 757a77eace88d..0000000000000 --- a/website/cue/reference/remap/functions/get_hostname.cue +++ /dev/null @@ -1,29 +0,0 @@ -{ - "remap": { - "functions": { - "get_hostname": { - "anchor": "get_hostname", - "name": "get_hostname", - "category": "System", - "description": "Returns the local system's hostname.", - "arguments": [], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "Internal hostname resolution failed." - ], - "examples": [ - { - "title": "Get hostname", - "source": "get_hostname!()", - "return": "my-hostname" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_secret.cue b/website/cue/reference/remap/functions/get_secret.cue deleted file mode 100644 index dd19870ae3a66..0000000000000 --- a/website/cue/reference/remap/functions/get_secret.cue +++ /dev/null @@ -1,41 +0,0 @@ -{ - "remap": { - "functions": { - "get_secret": { - "anchor": "get_secret", - "name": "get_secret", - "category": "Event", - "description": "Returns the value of the given secret from an event.", - "arguments": [ - { - "name": "key", - "description": "The name of the secret.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string", - "null" - ] - }, - "examples": [ - { - "title": "Get the Datadog API key from the event metadata", - "source": "get_secret(\"datadog_api_key\")", - "return": "secret value" - }, - { - "title": "Get a non existent secret", - "source": "get_secret(\"i_dont_exist\")", - "return": null - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_timezone_name.cue b/website/cue/reference/remap/functions/get_timezone_name.cue deleted file mode 100644 index f08748a1019eb..0000000000000 --- a/website/cue/reference/remap/functions/get_timezone_name.cue +++ /dev/null @@ -1,29 +0,0 @@ -{ - "remap": { - "functions": { - "get_timezone_name": { - "anchor": "get_timezone_name", - "name": "get_timezone_name", - "category": "System", - "description": "Returns the name of the timezone in the Vector configuration (see\n[global configuration options](/docs/reference/configuration/global-options)).\nIf the configuration is set to `local`, then it attempts to\ndetermine the name of the timezone from the host OS. If this\nis not possible, then it returns the fixed offset of the\nlocal timezone for the current time in the format `\"[+-]HH:MM\"`,\nfor example, `\"+02:00\"`.", - "arguments": [], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "Retrieval of local timezone information failed." - ], - "examples": [ - { - "title": "Get the IANA name of Vector's timezone", - "source": "get_timezone_name!()", - "return": "UTC" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/get_vector_metric.cue b/website/cue/reference/remap/functions/get_vector_metric.cue deleted file mode 100644 index 5a98e7f476342..0000000000000 --- a/website/cue/reference/remap/functions/get_vector_metric.cue +++ /dev/null @@ -1,70 +0,0 @@ -{ - "remap": { - "functions": { - "get_vector_metric": { - "anchor": "get_vector_metric", - "name": "get_vector_metric", - "category": "Metrics", - "description": "Searches internal Vector metrics by name and optionally by tags. Returns the first matching metric.\n\nInternal Vector metrics functions work with a snapshot of the metrics. The interval at which the snapshot is updated is controlled through the [`metrics_storage_refresh_period`](/docs/reference/configuration/global-options/#metrics_storage_refresh_period) global option. Higher values can reduce performance impact of that process, but may cause stale metrics data in the snapshot.", - "arguments": [ - { - "name": "key", - "description": "The metric name to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "tags", - "description": "Tags to filter the results on. Values in this object support wildcards ('*') to match on parts of the tag value.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - } - ], - "return": { - "types": [ - "object", - "null" - ] - }, - "examples": [ - { - "title": "Get a vector internal metric matching the name", - "source": "get_vector_metric(\"utilization\")", - "return": { - "name": "utilization", - "tags": { - "component_id": [ - "test" - ] - }, - "type": "gauge", - "kind": "absolute", - "value": 0.5 - } - }, - { - "title": "Get a vector internal metric matching the name and tags", - "source": "get_vector_metric(\"utilization\", tags: {\"component_id\": \"test\"})", - "return": { - "name": "utilization", - "tags": { - "component_id": [ - "test" - ] - }, - "type": "gauge", - "kind": "absolute", - "value": 0.5 - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/haversine.cue b/website/cue/reference/remap/functions/haversine.cue deleted file mode 100644 index c6365ac2c983c..0000000000000 --- a/website/cue/reference/remap/functions/haversine.cue +++ /dev/null @@ -1,82 +0,0 @@ -{ - "remap": { - "functions": { - "haversine": { - "anchor": "haversine", - "name": "haversine", - "category": "Map", - "description": "Calculates [haversine](https://en.wikipedia.org/wiki/Haversine_formula) distance and bearing between two points.", - "arguments": [ - { - "name": "latitude1", - "description": "Latitude of the first point.", - "required": true, - "type": [ - "float" - ] - }, - { - "name": "longitude1", - "description": "Longitude of the first point.", - "required": true, - "type": [ - "float" - ] - }, - { - "name": "latitude2", - "description": "Latitude of the second point.", - "required": true, - "type": [ - "float" - ] - }, - { - "name": "longitude2", - "description": "Longitude of the second point.", - "required": true, - "type": [ - "float" - ] - }, - { - "name": "measurement_unit", - "description": "Measurement system to use for resulting distance.", - "required": false, - "type": [ - "string" - ], - "enum": { - "kilometers": "Use kilometers for the resulting distance.", - "miles": "Use miles for the resulting distance." - } - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Haversine in kilometers", - "source": "haversine(0.0, 0.0, 10.0, 10.0)", - "return": { - "distance": 1568.5227233, - "bearing": 44.561 - } - }, - { - "title": "Haversine in miles", - "source": "haversine(0.0, 0.0, 10.0, 10.0, measurement_unit: \"miles\")", - "return": { - "distance": 974.6348468, - "bearing": 44.561 - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/hmac.cue b/website/cue/reference/remap/functions/hmac.cue deleted file mode 100644 index ccd857adb34dc..0000000000000 --- a/website/cue/reference/remap/functions/hmac.cue +++ /dev/null @@ -1,74 +0,0 @@ -{ - "remap": { - "functions": { - "hmac": { - "anchor": "hmac", - "name": "hmac", - "category": "Cryptography", - "description": "Calculates a [HMAC](https://en.wikipedia.org/wiki/HMAC) of the `value` using the given `key`.\nThe hashing `algorithm` used can be optionally specified.\n\nFor most use cases, the resulting bytestream should be encoded into a hex or base64\nstring using either [encode_base16](/docs/reference/vrl/functions/#encode_base16) or\n[encode_base64](/docs/reference/vrl/functions/#encode_base64).\n\nThis function is infallible if either the default `algorithm` value or a recognized-valid compile-time\n`algorithm` string literal is used. Otherwise, it is fallible.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the HMAC for.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key", - "description": "The string to use as the cryptographic key.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "algorithm", - "description": "The hashing algorithm to use.", - "required": false, - "type": [ - "string" - ], - "enum": { - "SHA1": "SHA1 algorithm", - "SHA-224": "SHA-224 algorithm", - "SHA-256": "SHA-256 algorithm", - "SHA-384": "SHA-384 algorithm", - "SHA-512": "SHA-512 algorithm" - }, - "default": "SHA-256" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Calculate message HMAC (defaults: SHA-256), encoding to a base64 string", - "source": "encode_base64(hmac(\"Hello there\", \"super-secret-key\"))", - "return": "eLGE8YMviv85NPXgISRUZxstBNSU47JQdcXkUWcClmI=" - }, - { - "title": "Calculate message HMAC using SHA-224, encoding to a hex-encoded string", - "source": "encode_base16(hmac(\"Hello there\", \"super-secret-key\", algorithm: \"SHA-224\"))", - "return": "42fccbc2b7d22a143b92f265a8046187558a94d11ddbb30622207e90" - }, - { - "title": "Calculate message HMAC using SHA1, encoding to a base64 string", - "source": "encode_base64(hmac(\"Hello there\", \"super-secret-key\", algorithm: \"SHA1\"))", - "return": "MiyBIHO8Set9+6crALiwkS0yFPE=" - }, - { - "title": "Calculate message HMAC using a variable hash algorithm", - "source": ".hash_algo = \"SHA-256\"\nhmac_bytes, err = hmac(\"Hello there\", \"super-secret-key\", algorithm: .hash_algo)\nif err == null {\n .hmac = encode_base16(hmac_bytes)\n}\n", - "return": "78b184f1832f8aff3934f5e0212454671b2d04d494e3b25075c5e45167029662" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/http_request.cue b/website/cue/reference/remap/functions/http_request.cue deleted file mode 100644 index d5fa501cfde82..0000000000000 --- a/website/cue/reference/remap/functions/http_request.cue +++ /dev/null @@ -1,112 +0,0 @@ -{ - "remap": { - "functions": { - "http_request": { - "anchor": "http_request", - "name": "http_request", - "category": "System", - "description": "Makes an HTTP request to the specified URL.", - "arguments": [ - { - "name": "url", - "description": "The URL to make the HTTP request to.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "method", - "description": "The HTTP method to use (e.g., GET, POST, PUT, DELETE). Defaults to GET.", - "required": false, - "type": [ - "string" - ], - "default": "get" - }, - { - "name": "headers", - "description": "An object containing HTTP headers to send with the request.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - }, - { - "name": "body", - "description": "The request body content to send.", - "required": false, - "type": [ - "string" - ], - "default": "" - }, - { - "name": "http_proxy", - "description": "HTTP proxy URL to use for the request.", - "required": false, - "type": [ - "string" - ] - }, - { - "name": "https_proxy", - "description": "HTTPS proxy URL to use for the request.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Basic HTTP request", - "source": "http_request(\"https://httpbin.org/get\")", - "return": { - "args": {}, - "headers": { - "Accept": "*/*", - "Host": "httpbin.org" - }, - "url": "https://httpbin.org/get" - } - }, - { - "title": "HTTP request with bearer token", - "source": "http_request(\"https://httpbin.org/bearer\", headers: {\"Authorization\": \"Bearer my_token\"})", - "return": { - "authenticated": true, - "token": "my_token" - } - }, - { - "title": "HTTP PUT request", - "source": "http_request(\"https://httpbin.org/put\", method: \"put\")", - "return": { - "args": {}, - "data": "", - "url": "https://httpbin.org/put" - } - }, - { - "title": "HTTP POST request with body", - "source": "http_request(\"https://httpbin.org/post\", method: \"post\", body: \"{\\\"data\\\":{\\\"hello\\\":\\\"world\\\"}}\")", - "return": { - "data": "{\"data\":{\"hello\":\"world\"}}" - } - } - ], - "notices": [ - "This function performs synchronous blocking operations and is not recommended for\nfrequent or performance-critical workflows due to potential network-related delays." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/includes.cue b/website/cue/reference/remap/functions/includes.cue deleted file mode 100644 index 750ecb8e10a66..0000000000000 --- a/website/cue/reference/remap/functions/includes.cue +++ /dev/null @@ -1,53 +0,0 @@ -{ - "remap": { - "functions": { - "includes": { - "anchor": "includes", - "name": "includes", - "category": "Enumerate", - "description": "Determines whether the `value` array includes the specified `item`.", - "arguments": [ - { - "name": "value", - "description": "The array.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "item", - "description": "The item to check.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Array includes", - "source": "includes([\"apple\", \"orange\", \"banana\"], \"banana\")", - "return": true - }, - { - "title": "Includes boolean", - "source": "includes([1, true], true)", - "return": true - }, - { - "title": "Doesn't include", - "source": "includes([\"foo\", \"bar\"], \"baz\")", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/int.cue b/website/cue/reference/remap/functions/int.cue deleted file mode 100644 index 92fc7cfb7a029..0000000000000 --- a/website/cue/reference/remap/functions/int.cue +++ /dev/null @@ -1,52 +0,0 @@ -{ - "remap": { - "functions": { - "int": { - "anchor": "int", - "name": "int", - "category": "Type", - "description": "Returns `value` if it is an integer, otherwise returns an error. This enables the type checker to guarantee that the returned value is an integer and can be used in any function that expects an integer.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an integer.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "integer" - ], - "rules": [ - "Returns the `value` if it's an integer.", - "Raises an error if not an integer." - ] - }, - "internal_failure_reasons": [ - "`value` is not an integer." - ], - "examples": [ - { - "title": "Declare an integer type", - "source": ". = { \"value\": 42 }\nint(.value)\n", - "return": 42 - }, - { - "title": "Declare an integer type (literal)", - "source": "int(42)", - "return": 42 - }, - { - "title": "Invalid integer type", - "source": "int!(true)", - "raises": "function call error for \"int\" at (0:10): expected integer, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_aton.cue b/website/cue/reference/remap/functions/ip_aton.cue deleted file mode 100644 index 0e155959cc2e2..0000000000000 --- a/website/cue/reference/remap/functions/ip_aton.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "ip_aton": { - "anchor": "ip_aton", - "name": "ip_aton", - "category": "IP", - "description": "Converts IPv4 address in numbers-and-dots notation into network-order\nbytes represented as an integer.\n\nThis behavior mimics [inet_aton](https://linux.die.net/man/3/inet_aton).", - "arguments": [ - { - "name": "value", - "description": "The IP address to convert to binary.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid IPv4 address." - ], - "examples": [ - { - "title": "IPv4 to integer", - "source": "ip_aton!(\"1.2.3.4\")", - "return": 16909060 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_cidr_contains.cue b/website/cue/reference/remap/functions/ip_cidr_contains.cue deleted file mode 100644 index 80a5a11e02def..0000000000000 --- a/website/cue/reference/remap/functions/ip_cidr_contains.cue +++ /dev/null @@ -1,68 +0,0 @@ -{ - "remap": { - "functions": { - "ip_cidr_contains": { - "anchor": "ip_cidr_contains", - "name": "ip_cidr_contains", - "category": "IP", - "description": "Determines whether the `ip` is contained in the block referenced by the `cidr`.", - "arguments": [ - { - "name": "cidr", - "description": "The CIDR mask (v4 or v6).", - "required": true, - "type": [ - "string", - "array" - ] - }, - { - "name": "value", - "description": "The IP address (v4 or v6).", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "internal_failure_reasons": [ - "`cidr` is not a valid CIDR.", - "`ip` is not a valid IP address." - ], - "examples": [ - { - "title": "IPv4 contains CIDR", - "source": "ip_cidr_contains!(\"192.168.0.0/16\", \"192.168.10.32\")", - "return": true - }, - { - "title": "IPv4 is private", - "source": "ip_cidr_contains!([\"10.0.0.0/8\", \"172.16.0.0/12\", \"192.168.0.0/16\"], \"192.168.10.32\")", - "return": true - }, - { - "title": "IPv6 contains CIDR", - "source": "ip_cidr_contains!(\"2001:4f8:4:ba::/64\", \"2001:4f8:4:ba:2e0:81ff:fe22:d1f1\")", - "return": true - }, - { - "title": "Not in range", - "source": "ip_cidr_contains!(\"192.168.0.0/24\", \"192.168.10.32\")", - "return": false - }, - { - "title": "Invalid address", - "source": "ip_cidr_contains!(\"192.168.0.0/24\", \"INVALID\")", - "raises": "function call error for \"ip_cidr_contains\" at (0:46): unable to parse IP address: invalid IP address syntax" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_ntoa.cue b/website/cue/reference/remap/functions/ip_ntoa.cue deleted file mode 100644 index 1e28ba4ee7031..0000000000000 --- a/website/cue/reference/remap/functions/ip_ntoa.cue +++ /dev/null @@ -1,38 +0,0 @@ -{ - "remap": { - "functions": { - "ip_ntoa": { - "anchor": "ip_ntoa", - "name": "ip_ntoa", - "category": "IP", - "description": "Converts numeric representation of IPv4 address in network-order bytes\nto numbers-and-dots notation.\n\nThis behavior mimics [inet_ntoa](https://linux.die.net/man/3/inet_ntoa).", - "arguments": [ - { - "name": "value", - "description": "The integer representation of an IPv4 address.", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` cannot fit in an unsigned 32-bit integer." - ], - "examples": [ - { - "title": "Integer to IPv4", - "source": "ip_ntoa!(16909060)", - "return": "1.2.3.4" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_ntop.cue b/website/cue/reference/remap/functions/ip_ntop.cue deleted file mode 100644 index 91d0911bf169d..0000000000000 --- a/website/cue/reference/remap/functions/ip_ntop.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "ip_ntop": { - "anchor": "ip_ntop", - "name": "ip_ntop", - "category": "IP", - "description": "Converts IPv4 and IPv6 addresses from binary to text form.\n\nThis behavior mimics [inet_ntop](https://linux.die.net/man/3/inet_ntop).", - "arguments": [ - { - "name": "value", - "description": "The binary data to convert from.\nFor IPv4 addresses, it must be 4 bytes (32 bits) long.\nFor IPv6 addresses, it must be 16 bytes (128 bits) long.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` must be of length 4 or 16 bytes." - ], - "examples": [ - { - "title": "Convert IPv4 address from bytes after decoding from Base64", - "source": "ip_ntop!(decode_base64!(\"wKgAAQ==\"))", - "return": "192.168.0.1" - }, - { - "title": "Convert IPv6 address from bytes after decoding from Base64", - "source": "ip_ntop!(decode_base64!(\"IAENuIWjAAAAAIouA3BzNA==\"))", - "return": "2001:db8:85a3::8a2e:370:7334" - } - ], - "notices": [ - "The binary data for this function is not easily printable. However, the results from\nfunctions such as `decode_base64` or `decode_percent` can still be used correctly." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_pton.cue b/website/cue/reference/remap/functions/ip_pton.cue deleted file mode 100644 index ad5781420669b..0000000000000 --- a/website/cue/reference/remap/functions/ip_pton.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "ip_pton": { - "anchor": "ip_pton", - "name": "ip_pton", - "category": "IP", - "description": "Converts IPv4 and IPv6 addresses from text to binary form.\n\n* The binary form of IPv4 addresses is 4 bytes (32 bits) long.\n* The binary form of IPv6 addresses is 16 bytes (128 bits) long.\n\nThis behavior mimics [inet_pton](https://linux.die.net/man/3/inet_pton).", - "arguments": [ - { - "name": "value", - "description": "The IP address (v4 or v6) to convert to binary form.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid IP (v4 or v6) address in text form." - ], - "examples": [ - { - "title": "Convert IPv4 address to bytes and encode to Base64", - "source": "encode_base64(ip_pton!(\"192.168.0.1\"))", - "return": "wKgAAQ==" - }, - { - "title": "Convert IPv6 address to bytes and encode to Base64", - "source": "encode_base64(ip_pton!(\"2001:db8:85a3::8a2e:370:7334\"))", - "return": "IAENuIWjAAAAAIouA3BzNA==" - } - ], - "notices": [ - "The binary data from this function is not easily printable. However, functions such as\n`encode_base64` or `encode_percent` can still process it correctly." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_subnet.cue b/website/cue/reference/remap/functions/ip_subnet.cue deleted file mode 100644 index 0870e6d3a14bf..0000000000000 --- a/website/cue/reference/remap/functions/ip_subnet.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "ip_subnet": { - "anchor": "ip_subnet", - "name": "ip_subnet", - "category": "IP", - "description": "Extracts the subnet address from the `ip` using the supplied `subnet`.", - "arguments": [ - { - "name": "value", - "description": "The IP address (v4 or v6).", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "subnet", - "description": "The subnet to extract from the IP address. This can be either a prefix length like `/8` or a net mask\nlike `255.255.0.0`. The net mask can be either an IPv4 or IPv6 address.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`ip` is not a valid IP address.", - "`subnet` is not a valid subnet." - ], - "examples": [ - { - "title": "IPv4 subnet", - "source": "ip_subnet!(\"192.168.10.32\", \"255.255.255.0\")", - "return": "192.168.10.0" - }, - { - "title": "IPv6 subnet", - "source": "ip_subnet!(\"2404:6800:4003:c02::64\", \"/32\")", - "return": "2404:6800::" - }, - { - "title": "Subnet /1", - "source": "ip_subnet!(\"192.168.0.1\", \"/1\")", - "return": "128.0.0.0" - } - ], - "notices": [ - "Works with both IPv4 and IPv6 addresses. The IP version for the mask must be the same as\nthe supplied address." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ip_to_ipv6.cue b/website/cue/reference/remap/functions/ip_to_ipv6.cue deleted file mode 100644 index 2b180784d8a05..0000000000000 --- a/website/cue/reference/remap/functions/ip_to_ipv6.cue +++ /dev/null @@ -1,42 +0,0 @@ -{ - "remap": { - "functions": { - "ip_to_ipv6": { - "anchor": "ip_to_ipv6", - "name": "ip_to_ipv6", - "category": "IP", - "description": "Converts the `ip` to an IPv6 address.", - "arguments": [ - { - "name": "value", - "description": "The IP address to convert to IPv6.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ], - "rules": [ - "The `ip` is returned unchanged if it's already an IPv6 address.", - "The `ip` is converted to an IPv6 address if it's an IPv4 address." - ] - }, - "internal_failure_reasons": [ - "`ip` is not a valid IP address." - ], - "examples": [ - { - "title": "IPv4 to IPv6", - "source": "ip_to_ipv6!(\"192.168.10.32\")", - "return": "::ffff:192.168.10.32" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue b/website/cue/reference/remap/functions/ipv6_to_ipv4.cue deleted file mode 100644 index 613860fdc1991..0000000000000 --- a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue +++ /dev/null @@ -1,42 +0,0 @@ -{ - "remap": { - "functions": { - "ipv6_to_ipv4": { - "anchor": "ipv6_to_ipv4", - "name": "ipv6_to_ipv4", - "category": "IP", - "description": "Converts the `ip` to an IPv4 address. `ip` is returned unchanged if it's already an IPv4 address. If `ip` is\ncurrently an IPv6 address then it needs to be IPv4 compatible, otherwise an error is thrown.", - "arguments": [ - { - "name": "value", - "description": "The IPv4-mapped IPv6 address to convert.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ], - "rules": [ - "The `ip` is returned unchanged if it's already an IPv4 address. If it's an IPv6 address it must be IPv4\ncompatible, otherwise an error is thrown." - ] - }, - "internal_failure_reasons": [ - "`ip` is not a valid IP address.", - "`ip` is an IPv6 address that is not compatible with IPv4." - ], - "examples": [ - { - "title": "IPv6 to IPv4", - "source": "ipv6_to_ipv4!(\"::ffff:192.168.0.1\")", - "return": "192.168.0.1" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_array.cue b/website/cue/reference/remap/functions/is_array.cue deleted file mode 100644 index e3a0c691a44b4..0000000000000 --- a/website/cue/reference/remap/functions/is_array.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "is_array": { - "anchor": "is_array", - "name": "is_array", - "category": "Type", - "description": "Check if the `value`'s type is an array.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an array.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is an array.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid array", - "source": "is_array([1, 2, 3])", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_array(\"a string\")", - "return": false - }, - { - "title": "Boolean", - "source": "is_array(true)", - "return": false - }, - { - "title": "Null", - "source": "is_array(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_boolean.cue b/website/cue/reference/remap/functions/is_boolean.cue deleted file mode 100644 index c4b542827dbdf..0000000000000 --- a/website/cue/reference/remap/functions/is_boolean.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_boolean": { - "anchor": "is_boolean", - "name": "is_boolean", - "category": "Type", - "description": "Check if the `value`'s type is a boolean.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a Boolean.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a boolean.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid boolean", - "source": "is_boolean(false)", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_boolean(\"a string\")", - "return": false - }, - { - "title": "Null", - "source": "is_boolean(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_empty.cue b/website/cue/reference/remap/functions/is_empty.cue deleted file mode 100644 index a750d6041a060..0000000000000 --- a/website/cue/reference/remap/functions/is_empty.cue +++ /dev/null @@ -1,66 +0,0 @@ -{ - "remap": { - "functions": { - "is_empty": { - "anchor": "is_empty", - "name": "is_empty", - "category": "Type", - "description": "Check if the object, array, or string has a length of `0`.", - "arguments": [ - { - "name": "value", - "description": "The value to check.", - "required": true, - "type": [ - "string", - "object", - "array" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is empty.", - "Returns `false` if `value` is non-empty." - ] - }, - "examples": [ - { - "title": "Empty array", - "source": "is_empty([])", - "return": true - }, - { - "title": "Non-empty string", - "source": "is_empty(\"a string\")", - "return": false - }, - { - "title": "Non-empty object", - "source": "is_empty({\"foo\": \"bar\"})", - "return": false - }, - { - "title": "Empty string", - "source": "is_empty(\"\")", - "return": true - }, - { - "title": "Empty object", - "source": "is_empty({})", - "return": true - }, - { - "title": "Non-empty array", - "source": "is_empty([1,2,3])", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_float.cue b/website/cue/reference/remap/functions/is_float.cue deleted file mode 100644 index 886f1e105fa49..0000000000000 --- a/website/cue/reference/remap/functions/is_float.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "is_float": { - "anchor": "is_float", - "name": "is_float", - "category": "Type", - "description": "Check if the `value`'s type is a float.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a float.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a float.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid float", - "source": "is_float(0.577)", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_float(\"a string\")", - "return": false - }, - { - "title": "Boolean", - "source": "is_float(true)", - "return": false - }, - { - "title": "Null", - "source": "is_float(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_integer.cue b/website/cue/reference/remap/functions/is_integer.cue deleted file mode 100644 index f6e32418ccf2f..0000000000000 --- a/website/cue/reference/remap/functions/is_integer.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_integer": { - "anchor": "is_integer", - "name": "is_integer", - "category": "Type", - "description": "Check if the `value`'s type is an integer.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an integer.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is an integer.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid integer", - "source": "is_integer(1)", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_integer(\"a string\")", - "return": false - }, - { - "title": "Null", - "source": "is_integer(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_ipv4.cue b/website/cue/reference/remap/functions/is_ipv4.cue deleted file mode 100644 index 34aeccbde4144..0000000000000 --- a/website/cue/reference/remap/functions/is_ipv4.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_ipv4": { - "anchor": "is_ipv4", - "name": "is_ipv4", - "category": "IP", - "description": "Check if the string is a valid IPv4 address or not.\n\nAn [IPv4-mapped](https://datatracker.ietf.org/doc/html/rfc6890) or\n[IPv4-compatible](https://datatracker.ietf.org/doc/html/rfc6890) IPv6 address is not considered\nvalid for the purpose of this function.", - "arguments": [ - { - "name": "value", - "description": "The IP address to check", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a valid IPv4 address.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid IPv4 address", - "source": "is_ipv4(\"10.0.102.37\")", - "return": true - }, - { - "title": "Valid IPv6 address", - "source": "is_ipv4(\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\")", - "return": false - }, - { - "title": "Arbitrary string", - "source": "is_ipv4(\"foobar\")", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_ipv6.cue b/website/cue/reference/remap/functions/is_ipv6.cue deleted file mode 100644 index ac947d60b056d..0000000000000 --- a/website/cue/reference/remap/functions/is_ipv6.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_ipv6": { - "anchor": "is_ipv6", - "name": "is_ipv6", - "category": "IP", - "description": "Check if the string is a valid IPv6 address or not.", - "arguments": [ - { - "name": "value", - "description": "The IP address to check", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a valid IPv6 address.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid IPv6 address", - "source": "is_ipv6(\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\")", - "return": true - }, - { - "title": "Valid IPv4 address", - "source": "is_ipv6(\"10.0.102.37\")", - "return": false - }, - { - "title": "Arbitrary string", - "source": "is_ipv6(\"foobar\")", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_json.cue b/website/cue/reference/remap/functions/is_json.cue deleted file mode 100644 index 7db9e56fd7c86..0000000000000 --- a/website/cue/reference/remap/functions/is_json.cue +++ /dev/null @@ -1,75 +0,0 @@ -{ - "remap": { - "functions": { - "is_json": { - "anchor": "is_json", - "name": "is_json", - "category": "Type", - "description": "Check if the string is a valid JSON document.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a valid JSON document.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "variant", - "description": "The variant of the JSON type to explicitly check for.", - "required": false, - "type": [ - "string" - ], - "enum": { - "object": "JSON object - {}", - "array": "JSON array - []", - "string": "JSON-formatted string values wrapped with quote marks", - "number": "Integer or float numbers", - "bool": "True or false", - "null": "Exact null value" - } - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a valid JSON document.", - "Returns `false` if `value` is not JSON-formatted." - ] - }, - "examples": [ - { - "title": "Valid JSON object", - "source": "is_json(\"{}\")", - "return": true - }, - { - "title": "Non-valid value", - "source": "is_json(\"{\")", - "return": false - }, - { - "title": "Exact variant", - "source": "is_json(\"{}\", variant: \"object\")", - "return": true - }, - { - "title": "Non-valid exact variant", - "source": "is_json(\"{}\", variant: \"array\")", - "return": false - }, - { - "title": "Valid JSON string", - "source": "is_json(s'\"test\"')", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_null.cue b/website/cue/reference/remap/functions/is_null.cue deleted file mode 100644 index 032def4a50904..0000000000000 --- a/website/cue/reference/remap/functions/is_null.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_null": { - "anchor": "is_null", - "name": "is_null", - "category": "Type", - "description": "Check if `value`'s type is `null`. For a more relaxed function, see [`is_nullish`](/docs/reference/vrl/functions#is_nullish).", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is `null`.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is null.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Null value", - "source": "is_null(null)", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_null(\"a string\")", - "return": false - }, - { - "title": "Array", - "source": "is_null([1, 2, 3])", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_nullish.cue b/website/cue/reference/remap/functions/is_nullish.cue deleted file mode 100644 index 190174e9a6bcf..0000000000000 --- a/website/cue/reference/remap/functions/is_nullish.cue +++ /dev/null @@ -1,59 +0,0 @@ -{ - "remap": { - "functions": { - "is_nullish": { - "anchor": "is_nullish", - "name": "is_nullish", - "category": "Type", - "description": "Determines whether `value` is nullish. Returns `true` if the specified `value` is `null`, an empty string, a string containing only whitespace, or the string `\"-\"`. Returns `false` otherwise.", - "arguments": [ - { - "name": "value", - "description": "The value to check for nullishness, for example, a useless value.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is `null`.", - "Returns `true` if `value` is `\"-\"`.", - "Returns `true` if `value` is whitespace as defined by [Unicode `White_Space` property](https://en.wikipedia.org/wiki/Unicode_character_property#Whitespace).", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Null detection (blank string)", - "source": "is_nullish(\"\")", - "return": true - }, - { - "title": "Null detection (dash string)", - "source": "is_nullish(\"-\")", - "return": true - }, - { - "title": "Null detection (whitespace)", - "source": "is_nullish(\"\n \n\")", - "return": true - }, - { - "title": "Null", - "source": "is_nullish(null)", - "return": true - } - ], - "notices": [ - "This function behaves inconsistently: it returns `false` for empty arrays (`[]`) and\nobjects (`{}`), but `true` for empty strings (`\"\"`) and `null`." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_object.cue b/website/cue/reference/remap/functions/is_object.cue deleted file mode 100644 index 39b75bf36f923..0000000000000 --- a/website/cue/reference/remap/functions/is_object.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_object": { - "anchor": "is_object", - "name": "is_object", - "category": "Type", - "description": "Check if `value`'s type is an object.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an object.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is an object.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid object", - "source": "is_object({\"foo\": \"bar\"})", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_object(\"a string\")", - "return": false - }, - { - "title": "Boolean", - "source": "is_object(true)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_regex.cue b/website/cue/reference/remap/functions/is_regex.cue deleted file mode 100644 index 76c9118e44069..0000000000000 --- a/website/cue/reference/remap/functions/is_regex.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_regex": { - "anchor": "is_regex", - "name": "is_regex", - "category": "Type", - "description": "Check if `value`'s type is a regex.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a regex.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a regex.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid regex", - "source": "is_regex(r'pattern')", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_regex(\"a string\")", - "return": false - }, - { - "title": "Null value", - "source": "is_regex(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_string.cue b/website/cue/reference/remap/functions/is_string.cue deleted file mode 100644 index f0604ea35eb69..0000000000000 --- a/website/cue/reference/remap/functions/is_string.cue +++ /dev/null @@ -1,54 +0,0 @@ -{ - "remap": { - "functions": { - "is_string": { - "anchor": "is_string", - "name": "is_string", - "category": "Type", - "description": "Check if `value`'s type is a string.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a string.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a string.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid string", - "source": "is_string(\"a string\")", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_string([1, 2, 3])", - "return": false - }, - { - "title": "Boolean", - "source": "is_string(true)", - "return": false - }, - { - "title": "Null", - "source": "is_string(null)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/is_timestamp.cue b/website/cue/reference/remap/functions/is_timestamp.cue deleted file mode 100644 index 362ecf67fd4f6..0000000000000 --- a/website/cue/reference/remap/functions/is_timestamp.cue +++ /dev/null @@ -1,49 +0,0 @@ -{ - "remap": { - "functions": { - "is_timestamp": { - "anchor": "is_timestamp", - "name": "is_timestamp", - "category": "Type", - "description": "Check if `value`'s type is a timestamp.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a timestamp.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` is a timestamp.", - "Returns `false` if `value` is anything else." - ] - }, - "examples": [ - { - "title": "Valid timestamp", - "source": "is_timestamp(t'2021-03-26T16:00:00Z')", - "return": true - }, - { - "title": "Non-matching type", - "source": "is_timestamp(\"a string\")", - "return": false - }, - { - "title": "Boolean value", - "source": "is_timestamp(true)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/join.cue b/website/cue/reference/remap/functions/join.cue deleted file mode 100644 index e3ce88708f737..0000000000000 --- a/website/cue/reference/remap/functions/join.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "join": { - "anchor": "join", - "name": "join", - "category": "String", - "description": "Joins each string in the `value` array into a single string, with items optionally separated from one another by a `separator`.", - "arguments": [ - { - "name": "value", - "description": "The array of strings to join together.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "separator", - "description": "The string separating each original element when joined.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Join array (no separator)", - "source": "join!([\"bring\", \"us\", \"together\"])", - "return": "bringustogether" - }, - { - "title": "Join array (comma separator)", - "source": "join!([\"sources\", \"transforms\", \"sinks\"], separator: \", \")", - "return": "sources, transforms, sinks" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/kebabcase.cue b/website/cue/reference/remap/functions/kebabcase.cue deleted file mode 100644 index 8565d5e0d5a74..0000000000000 --- a/website/cue/reference/remap/functions/kebabcase.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "kebabcase": { - "anchor": "kebabcase", - "name": "kebabcase", - "category": "String", - "description": "Takes the `value` string, and turns it into kebab-case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to kebab-case.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "original_case", - "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", - "required": false, - "type": [ - "string" - ], - "enum": { - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" - } - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "kebab-case a string without specifying original case", - "source": "kebabcase(\"InputString\")", - "return": "input-string" - }, - { - "title": "kebab-case a snake_case string", - "source": "kebabcase(\"foo_bar_baz\", \"snake_case\")", - "return": "foo-bar-baz" - }, - { - "title": "kebab-case specifying the wrong original case (noop)", - "source": "kebabcase(\"foo_bar_baz\", \"PascalCase\")", - "return": "foo_bar_baz" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/keys.cue b/website/cue/reference/remap/functions/keys.cue deleted file mode 100644 index 26d72e7386e4e..0000000000000 --- a/website/cue/reference/remap/functions/keys.cue +++ /dev/null @@ -1,41 +0,0 @@ -{ - "remap": { - "functions": { - "keys": { - "anchor": "keys", - "name": "keys", - "category": "Enumerate", - "description": "Returns the keys from the object passed into the function.", - "arguments": [ - { - "name": "value", - "description": "The object to extract keys from.", - "required": true, - "type": [ - "object" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Returns an array of all the keys" - ] - }, - "examples": [ - { - "title": "Get keys from the object", - "source": "keys({\n \"key1\": \"val1\",\n \"key2\": \"val2\"\n})\n", - "return": [ - "key1", - "key2" - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/length.cue b/website/cue/reference/remap/functions/length.cue deleted file mode 100644 index 826699f680b0a..0000000000000 --- a/website/cue/reference/remap/functions/length.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "length": { - "anchor": "length", - "name": "length", - "category": "Enumerate", - "description": "Returns the length of the `value`.\n\n* If `value` is an array, returns the number of elements.\n* If `value` is an object, returns the number of top-level keys.\n* If `value` is a string, returns the number of bytes in the string. If\n you want the number of characters, see `strlen`.", - "arguments": [ - { - "name": "value", - "description": "The array or object.", - "required": true, - "type": [ - "string", - "object", - "array" - ] - } - ], - "return": { - "types": [ - "integer" - ], - "rules": [ - "If `value` is an array, returns the number of elements.", - "If `value` is an object, returns the number of top-level keys.", - "If `value` is a string, returns the number of bytes in the string." - ] - }, - "examples": [ - { - "title": "Length (object)", - "source": "length({\n \"portland\": \"Trail Blazers\",\n \"seattle\": \"Supersonics\"\n})\n", - "return": 2 - }, - { - "title": "Length (nested object)", - "source": "length({\n \"home\": {\n \"city\": \"Portland\",\n \"state\": \"Oregon\"\n },\n \"name\": \"Trail Blazers\",\n \"mascot\": {\n \"name\": \"Blaze the Trail Cat\"\n }\n})\n", - "return": 3 - }, - { - "title": "Length (array)", - "source": "length([\"Trail Blazers\", \"Supersonics\", \"Grizzlies\"])", - "return": 3 - }, - { - "title": "Length (string)", - "source": "length(\"The Planet of the Apes Musical\")", - "return": 30 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/log.cue b/website/cue/reference/remap/functions/log.cue deleted file mode 100644 index 2b7f3b1af287f..0000000000000 --- a/website/cue/reference/remap/functions/log.cue +++ /dev/null @@ -1,65 +0,0 @@ -{ - "remap": { - "functions": { - "log": { - "anchor": "log", - "name": "log", - "category": "Debug", - "description": "Logs the `value` to [stdout](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) at the specified `level`.", - "arguments": [ - { - "name": "value", - "description": "The value to log.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "level", - "description": "The log level.", - "required": false, - "type": [ - "string" - ], - "enum": { - "trace": "Log at the `trace` level.", - "debug": "Log at the `debug` level.", - "info": "Log at the `info` level.", - "warn": "Log at the `warn` level.", - "error": "Log at the `error` level." - }, - "default": "info" - }, - { - "name": "rate_limit_secs", - "description": "Specifies that the log message is output no more than once per the given number of seconds.\nUse a value of `0` to turn rate limiting off.", - "required": false, - "type": [ - "integer" - ], - "default": "1" - } - ], - "return": { - "types": [ - "null" - ] - }, - "examples": [ - { - "title": "Log a message", - "source": "log(\"Hello, World!\", level: \"info\", rate_limit_secs: 60)", - "return": null - }, - { - "title": "Log an error", - "source": ". = { \"field\": \"not an integer\" }\n_, err = to_int(.field)\nif err != null {\n log(err, level: \"error\")\n}\n", - "return": null - } - ], - "pure": false - } - } - } -} diff --git a/website/cue/reference/remap/functions/map_keys.cue b/website/cue/reference/remap/functions/map_keys.cue deleted file mode 100644 index d0752f2d5fe5a..0000000000000 --- a/website/cue/reference/remap/functions/map_keys.cue +++ /dev/null @@ -1,77 +0,0 @@ -{ - "remap": { - "functions": { - "map_keys": { - "anchor": "map_keys", - "name": "map_keys", - "category": "Enumerate", - "description": "Map the keys within an object.\n\nIf `recursive` is enabled, the function iterates into nested\nobjects, using the following rules:\n\n1. Iteration starts at the root.\n2. For every nested object type:\n - First return the key of the object type itself.\n - Then recurse into the object, and loop back to item (1)\n in this list.\n - Any mutation done on a nested object *before* recursing into\n it, are preserved.\n3. For every nested array type:\n - First return the key of the array type itself.\n - Then find all objects within the array, and apply item (2)\n to each individual object.\n\nThe above rules mean that `map_keys` with\n`recursive` enabled finds *all* keys in the target,\nregardless of whether nested objects are nested inside arrays.\n\nThe function uses the function closure syntax to allow reading\nthe key for each item in the object.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks. This means that any variable defined in parent scopes\nis accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nSee the examples below to learn about the closure syntax.", - "arguments": [ - { - "name": "value", - "description": "The object to iterate.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "recursive", - "description": "Whether to recursively iterate the collection.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Upcase keys", - "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\",\n \"baz\": {\"nested key\": \"val\"}\n}\nmap_keys(.) -> |key| { upcase(key) }\n", - "return": { - "FOO": "foo", - "BAR": "bar", - "BAZ": { - "nested key": "val" - } - } - }, - { - "title": "De-dot keys", - "source": ". = {\n \"labels\": {\n \"app.kubernetes.io/name\": \"mysql\"\n }\n}\nmap_keys(., recursive: true) -> |key| { replace(key, \".\", \"_\") }\n", - "return": { - "labels": { - "app_kubernetes_io/name": "mysql" - } - } - }, - { - "title": "Recursively map object keys", - "source": "val = {\n \"a\": 1,\n \"b\": [{ \"c\": 2 }, { \"d\": 3 }],\n \"e\": { \"f\": 4 }\n}\nmap_keys(val, recursive: true) -> |key| { upcase(key) }\n", - "return": { - "A": 1, - "B": [ - { - "C": 2 - }, - { - "D": 3 - } - ], - "E": { - "F": 4 - } - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/map_values.cue b/website/cue/reference/remap/functions/map_values.cue deleted file mode 100644 index 12df5fb06bb87..0000000000000 --- a/website/cue/reference/remap/functions/map_values.cue +++ /dev/null @@ -1,67 +0,0 @@ -{ - "remap": { - "functions": { - "map_values": { - "anchor": "map_values", - "name": "map_values", - "category": "Enumerate", - "description": "Map the values within a collection.\n\nIf `recursive` is enabled, the function iterates into nested\ncollections, using the following rules:\n\n1. Iteration starts at the root.\n2. For every nested collection type:\n - First return the collection type itself.\n - Then recurse into the collection, and loop back to item (1)\n in the list\n - Any mutation done on a collection *before* recursing into it,\n are preserved.\n\nThe function uses the function closure syntax to allow mutating\nthe value for each item in the collection.\n\nThe same scoping rules apply to closure blocks as they do for\nregular blocks, meaning, any variable defined in parent scopes\nare accessible, and mutations to those variables are preserved,\nbut any new variables instantiated in the closure block are\nunavailable outside of the block.\n\nCheck out the examples below to learn about the closure syntax.", - "arguments": [ - { - "name": "value", - "description": "The object or array to iterate.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "recursive", - "description": "Whether to recursively iterate the collection.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object", - "array" - ] - }, - "examples": [ - { - "title": "Upcase values", - "source": ". = {\n \"foo\": \"foo\",\n \"bar\": \"bar\"\n}\nmap_values(.) -> |value| { upcase(value) }\n", - "return": { - "foo": "FOO", - "bar": "BAR" - } - }, - { - "title": "Recursively map object values", - "source": "val = {\n \"a\": 1,\n \"b\": [{ \"c\": 2 }, { \"d\": 3 }],\n \"e\": { \"f\": 4 }\n}\nmap_values(val, recursive: true) -> |value| {\n if is_integer(value) { int!(value) + 1 } else { value }\n}\n", - "return": { - "a": 2, - "b": [ - { - "c": 3 - }, - { - "d": 4 - } - ], - "e": { - "f": 5 - } - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/match.cue b/website/cue/reference/remap/functions/match.cue deleted file mode 100644 index 32ac612cb88e5..0000000000000 --- a/website/cue/reference/remap/functions/match.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "match": { - "anchor": "match", - "name": "match", - "category": "String", - "description": "Determines whether the `value` matches the `pattern`.", - "arguments": [ - { - "name": "value", - "description": "The value to match.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "The regular expression pattern to match against.", - "required": true, - "type": [ - "regex" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Regex match on a string", - "source": "match(\"I'm a little teapot\", r'teapot')", - "return": true - }, - { - "title": "String does not match the regular expression", - "source": "match(\"I'm a little teapot\", r'.*balloon')", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/match_any.cue b/website/cue/reference/remap/functions/match_any.cue deleted file mode 100644 index 795590e72b6c1..0000000000000 --- a/website/cue/reference/remap/functions/match_any.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "match_any": { - "anchor": "match_any", - "name": "match_any", - "category": "String", - "description": "Determines whether `value` matches any of the given `patterns`. All patterns are checked in a single pass over the target string, giving this function a potential performance advantage over the multiple calls in the `match` function.", - "arguments": [ - { - "name": "value", - "description": "The value to match.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "patterns", - "description": "The array of regular expression patterns to match against.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Regex match on a string", - "source": "match_any(\"I'm a little teapot\", [r'frying pan', r'teapot'])", - "return": true - }, - { - "title": "No match", - "source": "match_any(\"My name is John Doe\", patterns: [r'\\d+', r'Jane'])", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/match_array.cue b/website/cue/reference/remap/functions/match_array.cue deleted file mode 100644 index 8cfbdc32815a0..0000000000000 --- a/website/cue/reference/remap/functions/match_array.cue +++ /dev/null @@ -1,67 +0,0 @@ -{ - "remap": { - "functions": { - "match_array": { - "anchor": "match_array", - "name": "match_array", - "category": "Enumerate", - "description": "Determines whether the elements in the `value` array matches the `pattern`. By default, it checks that at least one element matches, but can be set to determine if all the elements match.", - "arguments": [ - { - "name": "value", - "description": "The array.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "pattern", - "description": "The regular expression pattern to match against.", - "required": true, - "type": [ - "regex" - ] - }, - { - "name": "all", - "description": "Whether to match on all elements of `value`.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Match at least one element", - "source": "match_array([\"foobar\", \"bazqux\"], r'foo')", - "return": true - }, - { - "title": "Match all elements", - "source": "match_array([\"foo\", \"foobar\", \"barfoo\"], r'foo', all: true)", - "return": true - }, - { - "title": "No matches", - "source": "match_array([\"bazqux\", \"xyz\"], r'foo')", - "return": false - }, - { - "title": "Not all elements match", - "source": "match_array([\"foo\", \"foobar\", \"baz\"], r'foo', all: true)", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/match_datadog_query.cue b/website/cue/reference/remap/functions/match_datadog_query.cue deleted file mode 100644 index ed6e2adeca3a8..0000000000000 --- a/website/cue/reference/remap/functions/match_datadog_query.cue +++ /dev/null @@ -1,58 +0,0 @@ -{ - "remap": { - "functions": { - "match_datadog_query": { - "anchor": "match_datadog_query", - "name": "match_datadog_query", - "category": "Object", - "description": "Matches an object against a [Datadog Search Syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/) query.", - "arguments": [ - { - "name": "value", - "description": "The object.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "query", - "description": "The Datadog Search Syntax query.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "OR query", - "source": "match_datadog_query({\"message\": \"contains this and that\"}, \"this OR that\")", - "return": true - }, - { - "title": "AND query", - "source": "match_datadog_query({\"message\": \"contains only this\"}, \"this AND that\")", - "return": false - }, - { - "title": "Attribute wildcard", - "source": "match_datadog_query({\"name\": \"foobar\"}, \"@name:foo*\")", - "return": true - }, - { - "title": "Tag range", - "source": "match_datadog_query({\"tags\": [\"a:x\", \"b:y\", \"c:z\"]}, s'b:[\"x\" TO \"z\"]')", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/md5.cue b/website/cue/reference/remap/functions/md5.cue deleted file mode 100644 index 3fbb39736098b..0000000000000 --- a/website/cue/reference/remap/functions/md5.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "md5": { - "anchor": "md5", - "name": "md5", - "category": "Cryptography", - "description": "Calculates an md5 hash of the `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Create md5 hash", - "source": "md5(\"foo\")", - "return": "acbd18db4cc2f85cedef654fccc4a4d8" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/merge.cue b/website/cue/reference/remap/functions/merge.cue deleted file mode 100644 index f05bfeceed7be..0000000000000 --- a/website/cue/reference/remap/functions/merge.cue +++ /dev/null @@ -1,78 +0,0 @@ -{ - "remap": { - "functions": { - "merge": { - "anchor": "merge", - "name": "merge", - "category": "Object", - "description": "Merges the `from` object into the `to` object.", - "arguments": [ - { - "name": "to", - "description": "The object to merge into.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "from", - "description": "The object to merge from.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "deep", - "description": "A deep merge is performed if `true`, otherwise only top-level fields are merged.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ], - "rules": [ - "The field from the `from` object is chosen if a key exists in both objects.", - "Objects are merged recursively if `deep` is specified, a key exists in both objects, and both of those\nfields are also objects." - ] - }, - "examples": [ - { - "title": "Object merge (shallow)", - "source": "merge(\n {\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n },\n {\n \"parent1\": {\n \"child2\": 4,\n \"child5\": 5\n }\n }\n)\n", - "return": { - "parent1": { - "child2": 4, - "child5": 5 - }, - "parent2": { - "child3": 3 - } - } - }, - { - "title": "Object merge (deep)", - "source": "merge(\n {\n \"parent1\": {\n \"child1\": 1,\n \"child2\": 2\n },\n \"parent2\": {\n \"child3\": 3\n }\n },\n {\n \"parent1\": {\n \"child2\": 4,\n \"child5\": 5\n }\n },\n deep: true\n)\n", - "return": { - "parent1": { - "child1": 1, - "child2": 4, - "child5": 5 - }, - "parent2": { - "child3": 3 - } - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/mod.cue b/website/cue/reference/remap/functions/mod.cue deleted file mode 100644 index 1e1fccaeca0fc..0000000000000 --- a/website/cue/reference/remap/functions/mod.cue +++ /dev/null @@ -1,51 +0,0 @@ -{ - "remap": { - "functions": { - "mod": { - "anchor": "mod", - "name": "mod", - "category": "Number", - "description": "Calculates the remainder of `value` divided by `modulus`.", - "arguments": [ - { - "name": "value", - "description": "The value the `modulus` is applied to.", - "required": true, - "type": [ - "integer", - "float" - ] - }, - { - "name": "modulus", - "description": "The `modulus` value.", - "required": true, - "type": [ - "integer", - "float" - ] - } - ], - "return": { - "types": [ - "integer", - "float" - ] - }, - "internal_failure_reasons": [ - "`value` is not an integer or float.", - "`modulus` is not an integer or float.", - "`modulus` is equal to 0." - ], - "examples": [ - { - "title": "Calculate the remainder of two integers", - "source": "mod(5, 2)", - "return": 1 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/now.cue b/website/cue/reference/remap/functions/now.cue deleted file mode 100644 index cf50e80f0ad1d..0000000000000 --- a/website/cue/reference/remap/functions/now.cue +++ /dev/null @@ -1,26 +0,0 @@ -{ - "remap": { - "functions": { - "now": { - "anchor": "now", - "name": "now", - "category": "Timestamp", - "description": "Returns the current timestamp in the UTC timezone with nanosecond precision.", - "arguments": [], - "return": { - "types": [ - "timestamp" - ] - }, - "examples": [ - { - "title": "Generate a current timestamp", - "source": "now()", - "return": "2012-03-04T12:34:56.789012345Z" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/object.cue b/website/cue/reference/remap/functions/object.cue deleted file mode 100644 index b750bb37a2671..0000000000000 --- a/website/cue/reference/remap/functions/object.cue +++ /dev/null @@ -1,50 +0,0 @@ -{ - "remap": { - "functions": { - "object": { - "anchor": "object", - "name": "object", - "category": "Type", - "description": "Returns `value` if it is an object, otherwise returns an error. This enables the type checker to guarantee that the returned value is an object and can be used in any function that expects an object.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is an object.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "object" - ], - "rules": [ - "Returns the `value` if it's an object.", - "Raises an error if not an object." - ] - }, - "internal_failure_reasons": [ - "`value` is not an object." - ], - "examples": [ - { - "title": "Declare an object type", - "source": ". = { \"value\": { \"field1\": \"value1\", \"field2\": \"value2\" } }\nobject(.value)\n", - "return": { - "field1": "value1", - "field2": "value2" - } - }, - { - "title": "Invalid type", - "source": "object!(true)", - "raises": "function call error for \"object\" at (0:13): expected object, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/object_from_array.cue b/website/cue/reference/remap/functions/object_from_array.cue deleted file mode 100644 index b9963cfed2772..0000000000000 --- a/website/cue/reference/remap/functions/object_from_array.cue +++ /dev/null @@ -1,70 +0,0 @@ -{ - "remap": { - "functions": { - "object_from_array": { - "anchor": "object_from_array", - "name": "object_from_array", - "category": "Object", - "description": "Iterate over either one array of arrays or a pair of arrays and create an object out of all the key-value pairs contained in them.\nWith one array of arrays, any entries with no value use `null` instead.\nAny keys that are `null` skip the corresponding value.\n\nIf a single parameter is given, it must contain an array of all the input arrays.", - "arguments": [ - { - "name": "values", - "description": "The first array of elements, or the array of input arrays if no other parameter is present.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "keys", - "description": "The second array of elements. If not present, the first parameter must contain all the arrays.", - "required": false, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "object" - ], - "rules": [ - "`object_from_array` is considered fallible in the following cases: if any of the parameters is not an array; if only the `value` parameter is present and it is not an array of arrays; or if any of the keys are not either a string or `null`." - ] - }, - "internal_failure_reasons": [ - "`values` and `keys` must be arrays.", - "If `keys` is not present, `values` must contain only arrays." - ], - "examples": [ - { - "title": "Create an object from one array", - "source": "object_from_array([[\"one\", 1], [null, 2], [\"two\", 3]])", - "return": { - "one": 1, - "two": 3 - } - }, - { - "title": "Create an object from separate key and value arrays", - "source": "object_from_array([1, 2, 3], keys: [\"one\", null, \"two\"])", - "return": { - "one": 1, - "two": 3 - } - }, - { - "title": "Create an object from a separate arrays of keys and values", - "source": "object_from_array(values: [1, null, true], keys: [\"a\", \"b\", \"c\"])", - "return": { - "a": 1, - "b": null, - "c": true - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_apache_log.cue b/website/cue/reference/remap/functions/parse_apache_log.cue deleted file mode 100644 index 7d1ab4216ba32..0000000000000 --- a/website/cue/reference/remap/functions/parse_apache_log.cue +++ /dev/null @@ -1,108 +0,0 @@ -{ - "remap": { - "functions": { - "parse_apache_log": { - "anchor": "parse_apache_log", - "name": "parse_apache_log", - "category": "Parse", - "description": "Parses Apache access and error log lines. Lines can be in [`common`](https://httpd.apache.org/docs/current/logs.html#common),\n[`combined`](https://httpd.apache.org/docs/current/logs.html#combined), or the default [`error`](https://httpd.apache.org/docs/current/logs.html#errorlog) format.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "format", - "description": "The format to use for parsing the log.", - "required": true, - "type": [ - "string" - ], - "enum": { - "common": "Common format", - "combined": "Apache combined format", - "error": "Default Apache error format" - } - }, - { - "name": "timestamp_format", - "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for\nencoding the timestamp. The time is parsed in local time if the timestamp does not specify a timezone.", - "required": false, - "type": [ - "string" - ], - "default": "%d/%b/%Y:%T %z" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` does not match the specified format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`." - ], - "examples": [ - { - "title": "Parse using Apache log format (common)", - "source": "parse_apache_log!(s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326', format: \"common\")", - "return": { - "host": "127.0.0.1", - "identity": "bob", - "message": "GET /apache_pb.gif HTTP/1.0", - "method": "GET", - "path": "/apache_pb.gif", - "protocol": "HTTP/1.0", - "size": 2326, - "status": 200, - "timestamp": "2000-10-10T20:55:36Z", - "user": "frank" - } - }, - { - "title": "Parse using Apache log format (combined)", - "source": "parse_apache_log!(\n s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326 \"http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth\" \"Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0\"',\n \"combined\",\n)\n", - "return": { - "agent": "Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/1945-10-12 Firefox/37.0", - "host": "127.0.0.1", - "identity": "bob", - "message": "GET /apache_pb.gif HTTP/1.0", - "method": "GET", - "path": "/apache_pb.gif", - "protocol": "HTTP/1.0", - "referrer": "http://www.seniorinfomediaries.com/vertical/channels/front-end/bandwidth", - "size": 2326, - "status": 200, - "timestamp": "2000-10-10T20:55:36Z", - "user": "frank" - } - }, - { - "title": "Parse using Apache log format (error)", - "source": "parse_apache_log!(\n s'[01/Mar/2021:12:00:19 +0000] [ab:alert] [pid 4803:tid 3814] [client 147.159.108.175:24259] I will bypass the haptic COM bandwidth, that should matrix the CSS driver!',\n \"error\"\n)\n", - "return": { - "client": "147.159.108.175", - "message": "I will bypass the haptic COM bandwidth, that should matrix the CSS driver!", - "module": "ab", - "pid": 4803, - "port": 24259, - "severity": "alert", - "thread": "3814", - "timestamp": "2021-03-01T12:00:19Z" - } - } - ], - "notices": [ - "Missing information in the log message may be indicated by `-`. These fields are omitted in the result." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_aws_alb_log.cue b/website/cue/reference/remap/functions/parse_aws_alb_log.cue deleted file mode 100644 index 157b5a6922a39..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_alb_log.cue +++ /dev/null @@ -1,118 +0,0 @@ -{ - "remap": { - "functions": { - "parse_aws_alb_log": { - "anchor": "parse_aws_alb_log", - "name": "parse_aws_alb_log", - "category": "Parse", - "description": "Parses `value` in the [Elastic Load Balancer Access format](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-log-entry-examples).", - "arguments": [ - { - "name": "value", - "description": "Access log of the Application Load Balancer.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "strict_mode", - "description": "When set to `false`, the parser ignores any newly added or trailing fields in AWS ALB logs instead of failing. Defaults to `true` to preserve strict parsing behavior.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted AWS ALB log." - ], - "examples": [ - { - "title": "Parse AWS ALB log", - "source": "parse_aws_alb_log!(\n \"http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \\\"GET http://www.example.com:80/ HTTP/1.1\\\" \\\"curl/7.46.0\\\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \\\"Root=1-58337364-23a8c76965a2ef7629b185e3\\\" \\\"-\\\" \\\"-\\\" 0 2018-11-30T22:22:48.364000Z \\\"forward\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\"\"\n)\n", - "return": { - "actions_executed": "forward", - "chosen_cert_arn": null, - "classification": null, - "classification_reason": null, - "client_host": "192.168.131.39:2817", - "domain_name": null, - "elb": "app/my-loadbalancer/50dc6c495c0c9188", - "elb_status_code": "200", - "error_reason": null, - "matched_rule_priority": "0", - "received_bytes": 34, - "redirect_url": null, - "request_creation_time": "2018-11-30T22:22:48.364000Z", - "request_method": "GET", - "request_processing_time": 0.0, - "request_protocol": "HTTP/1.1", - "request_url": "http://www.example.com:80/", - "response_processing_time": 0.0, - "sent_bytes": 366, - "ssl_cipher": null, - "ssl_protocol": null, - "target_group_arn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", - "target_host": null, - "target_port_list": [], - "target_processing_time": 0.001, - "target_status_code": "200", - "target_status_code_list": [], - "timestamp": "2018-11-30T22:23:00.186641Z", - "trace_id": "Root=1-58337364-23a8c76965a2ef7629b185e3", - "traceability_id": null, - "type": "http", - "user_agent": "curl/7.46.0" - } - }, - { - "title": "Parse AWS ALB log with trailing fields (non-strict mode)", - "source": "parse_aws_alb_log!(\n \"http 2018-11-30T22:23:00.186641Z app/my-loadbalancer/50dc6c495c0c9188 192.168.131.39:2817 - 0.000 0.001 0.000 200 200 34 366 \\\"GET http://www.example.com:80/ HTTP/1.1\\\" \\\"curl/7.46.0\\\" - - arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \\\"Root=1-58337364-23a8c76965a2ef7629b185e3\\\" \\\"-\\\" \\\"-\\\" 0 2018-11-30T22:22:48.364000Z \\\"forward\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" \\\"-\\\" TID_12345 \\\"-\\\" \\\"-\\\" \\\"-\\\"\",\n strict_mode: false\n)\n", - "return": { - "actions_executed": "forward", - "chosen_cert_arn": null, - "classification": null, - "classification_reason": null, - "client_host": "192.168.131.39:2817", - "domain_name": null, - "elb": "app/my-loadbalancer/50dc6c495c0c9188", - "elb_status_code": "200", - "error_reason": null, - "matched_rule_priority": "0", - "received_bytes": 34, - "redirect_url": null, - "request_creation_time": "2018-11-30T22:22:48.364000Z", - "request_method": "GET", - "request_processing_time": 0.0, - "request_protocol": "HTTP/1.1", - "request_url": "http://www.example.com:80/", - "response_processing_time": 0.0, - "sent_bytes": 366, - "ssl_cipher": null, - "ssl_protocol": null, - "target_group_arn": "arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", - "target_host": null, - "target_port_list": [], - "target_processing_time": 0.001, - "target_status_code": "200", - "target_status_code_list": [], - "timestamp": "2018-11-30T22:23:00.186641Z", - "trace_id": "Root=1-58337364-23a8c76965a2ef7629b185e3", - "traceability_id": "TID_12345", - "type": "http", - "user_agent": "curl/7.46.0" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue b/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue deleted file mode 100644 index d0293c34df27e..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue +++ /dev/null @@ -1,53 +0,0 @@ -{ - "remap": { - "functions": { - "parse_aws_cloudwatch_log_subscription_message": { - "anchor": "parse_aws_cloudwatch_log_subscription_message", - "name": "parse_aws_cloudwatch_log_subscription_message", - "category": "Parse", - "description": "Parses AWS CloudWatch Logs events (configured through AWS Cloudwatch subscriptions) from the `aws_kinesis_firehose` source.", - "arguments": [ - { - "name": "value", - "description": "The string representation of the message to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted AWS CloudWatch Log subscription message." - ], - "examples": [ - { - "title": "Parse AWS Cloudwatch Log subscription message", - "source": "parse_aws_cloudwatch_log_subscription_message!(s'{\n \"messageType\": \"DATA_MESSAGE\",\n \"owner\": \"111111111111\",\n \"logGroup\": \"test\",\n \"logStream\": \"test\",\n \"subscriptionFilters\": [\n \"Destination\"\n ],\n \"logEvents\": [\n {\n \"id\": \"35683658089614582423604394983260738922885519999578275840\",\n \"timestamp\": 1600110569039,\n \"message\": \"{\\\"bytes\\\":26780,\\\"datetime\\\":\\\"14/Sep/2020:11:45:41-0400\\\",\\\"host\\\":\\\"157.130.216.193\\\",\\\"method\\\":\\\"PUT\\\",\\\"protocol\\\":\\\"HTTP/1.0\\\",\\\"referer\\\":\\\"https://www.principalcross-platform.io/markets/ubiquitous\\\",\\\"request\\\":\\\"/expedite/convergence\\\",\\\"source_type\\\":\\\"stdin\\\",\\\"status\\\":301,\\\"user-identifier\\\":\\\"-\\\"}\"\n }\n ]\n}')\n", - "return": { - "log_events": [ - { - "id": "35683658089614582423604394983260738922885519999578275840", - "message": "{\"bytes\":26780,\"datetime\":\"14/Sep/2020:11:45:41-0400\",\"host\":\"157.130.216.193\",\"method\":\"PUT\",\"protocol\":\"HTTP/1.0\",\"referer\":\"https://www.principalcross-platform.io/markets/ubiquitous\",\"request\":\"/expedite/convergence\",\"source_type\":\"stdin\",\"status\":301,\"user-identifier\":\"-\"}", - "timestamp": "2020-09-14T19:09:29.039Z" - } - ], - "log_group": "test", - "log_stream": "test", - "message_type": "DATA_MESSAGE", - "owner": "111111111111", - "subscription_filters": [ - "Destination" - ] - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue b/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue deleted file mode 100644 index efdfc1784d938..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue +++ /dev/null @@ -1,108 +0,0 @@ -{ - "remap": { - "functions": { - "parse_aws_vpc_flow_log": { - "anchor": "parse_aws_vpc_flow_log", - "name": "parse_aws_vpc_flow_log", - "category": "Parse", - "description": "Parses `value` in the [VPC Flow Logs format](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html).", - "arguments": [ - { - "name": "value", - "description": "VPC Flow Log.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "format", - "description": "VPC Flow Log format.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted AWS VPC Flow log." - ], - "examples": [ - { - "title": "Parse AWS VPC Flow log (default format)", - "source": "parse_aws_vpc_flow_log!(\"2 123456789010 eni-1235b8ca123456789 - - - - - - - 1431280876 1431280934 - NODATA\")", - "return": { - "version": 2, - "account_id": "123456789010", - "interface_id": "eni-1235b8ca123456789", - "srcaddr": null, - "dstaddr": null, - "srcport": null, - "dstport": null, - "protocol": null, - "packets": null, - "bytes": null, - "start": 1431280876, - "end": 1431280934, - "action": null, - "log_status": "NODATA" - } - }, - { - "title": "Parse AWS VPC Flow log (custom format)", - "source": "parse_aws_vpc_flow_log!(\n \"- eni-1235b8ca123456789 10.0.1.5 10.0.0.220 10.0.1.5 203.0.113.5\",\n \"instance_id interface_id srcaddr dstaddr pkt_srcaddr pkt_dstaddr\"\n)\n", - "return": { - "instance_id": null, - "interface_id": "eni-1235b8ca123456789", - "srcaddr": "10.0.1.5", - "dstaddr": "10.0.0.220", - "pkt_srcaddr": "10.0.1.5", - "pkt_dstaddr": "203.0.113.5" - } - }, - { - "title": "Parse AWS VPC Flow log including v5 fields", - "source": "parse_aws_vpc_flow_log!(\n \"5 52.95.128.179 10.0.0.71 80 34210 6 1616729292 1616729349 IPv4 14 15044 123456789012 vpc-abcdefab012345678 subnet-aaaaaaaa012345678 i-0c50d5961bcb2d47b eni-1235b8ca123456789 ap-southeast-2 apse2-az3 - - ACCEPT 19 52.95.128.179 10.0.0.71 S3 - - ingress OK\",\n format: \"version srcaddr dstaddr srcport dstport protocol start end type packets bytes account_id vpc_id subnet_id instance_id interface_id region az_id sublocation_type sublocation_id action tcp_flags pkt_srcaddr pkt_dstaddr pkt_src_aws_service pkt_dst_aws_service traffic_path flow_direction log_status\"\n)\n", - "return": { - "account_id": "123456789012", - "action": "ACCEPT", - "az_id": "apse2-az3", - "bytes": 15044, - "dstaddr": "10.0.0.71", - "dstport": 34210, - "end": 1616729349, - "flow_direction": "ingress", - "instance_id": "i-0c50d5961bcb2d47b", - "interface_id": "eni-1235b8ca123456789", - "log_status": "OK", - "packets": 14, - "pkt_dst_aws_service": null, - "pkt_dstaddr": "10.0.0.71", - "pkt_src_aws_service": "S3", - "pkt_srcaddr": "52.95.128.179", - "protocol": 6, - "region": "ap-southeast-2", - "srcaddr": "52.95.128.179", - "srcport": 80, - "start": 1616729292, - "sublocation_id": null, - "sublocation_type": null, - "subnet_id": "subnet-aaaaaaaa012345678", - "tcp_flags": 19, - "traffic_path": null, - "type": "IPv4", - "version": 5, - "vpc_id": "vpc-abcdefab012345678" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_bytes.cue b/website/cue/reference/remap/functions/parse_bytes.cue deleted file mode 100644 index d68639e420b8c..0000000000000 --- a/website/cue/reference/remap/functions/parse_bytes.cue +++ /dev/null @@ -1,95 +0,0 @@ -{ - "remap": { - "functions": { - "parse_bytes": { - "anchor": "parse_bytes", - "name": "parse_bytes", - "category": "Parse", - "description": "Parses the `value` into a human-readable bytes format specified by `unit` and `base`.", - "arguments": [ - { - "name": "value", - "description": "The string of the duration with either binary or SI unit.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "unit", - "description": "The output units for the byte.", - "required": true, - "type": [ - "string" - ], - "enum": { - "B": "Bytes", - "kiB": "Kilobytes (1024 bytes)", - "MiB": "Megabytes (1024 ** 2 bytes)", - "GiB": "Gigabytes (1024 ** 3 bytes)", - "TiB": "Terabytes (1024 gigabytes)", - "PiB": "Petabytes (1024 ** 2 gigabytes)", - "EiB": "Exabytes (1024 ** 3 gigabytes)", - "kB": "Kilobytes (1 thousand bytes in SI)", - "MB": "Megabytes (1 million bytes in SI)", - "GB": "Gigabytes (1 billion bytes in SI)", - "TB": "Terabytes (1 thousand gigabytes in SI)", - "PB": "Petabytes (1 million gigabytes in SI)", - "EB": "Exabytes (1 billion gigabytes in SI)" - } - }, - { - "name": "base", - "description": "The base for the byte, either 2 or 10.", - "required": false, - "type": [ - "string" - ], - "default": "2" - } - ], - "return": { - "types": [ - "float" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted bytes." - ], - "examples": [ - { - "title": "Parse bytes (kilobytes)", - "source": "parse_bytes!(\"1024KiB\", unit: \"MiB\")", - "return": 1.0 - }, - { - "title": "Parse kilobytes in default binary units", - "source": "parse_bytes!(\"1KiB\", unit: \"B\")", - "return": 1024.0 - }, - { - "title": "Parse bytes in SI unit (terabytes)", - "source": "parse_bytes!(\"4TB\", unit: \"MB\", base: \"10\")", - "return": 4000000.0 - }, - { - "title": "Parse gigabytes in decimal units", - "source": "parse_bytes!(\"1GB\", unit: \"B\", base: \"10\")", - "return": 1000000000.0 - }, - { - "title": "Parse bytes in ambiguous unit (gigabytes)", - "source": "parse_bytes!(\"1GB\", unit: \"B\", base: \"2\")", - "return": 1073741824.0 - }, - { - "title": "Parse gigabytes in ambiguous decimal units", - "source": "parse_bytes!(\"1GB\", unit: \"MB\", base: \"2\")", - "return": 1024.0 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_cbor.cue b/website/cue/reference/remap/functions/parse_cbor.cue deleted file mode 100644 index fa39b0552cce1..0000000000000 --- a/website/cue/reference/remap/functions/parse_cbor.cue +++ /dev/null @@ -1,77 +0,0 @@ -{ - "remap": { - "functions": { - "parse_cbor": { - "anchor": "parse_cbor", - "name": "parse_cbor", - "category": "Parse", - "description": "Parses the `value` as [CBOR](https://cbor.io).", - "arguments": [ - { - "name": "value", - "description": "The CBOR payload to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string", - "integer", - "float", - "boolean", - "object", - "array", - "null" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid CBOR-formatted payload." - ], - "examples": [ - { - "title": "Parse CBOR", - "source": "parse_cbor!(decode_base64!(\"oWVmaWVsZGV2YWx1ZQ==\"))", - "return": { - "field": "value" - } - }, - { - "title": "array", - "source": "parse_cbor!(decode_base64!(\"gvUA\"))", - "return": [ - true, - 0 - ] - }, - { - "title": "string", - "source": "parse_cbor!(decode_base64!(\"ZWhlbGxv\"))", - "return": "hello" - }, - { - "title": "integer", - "source": "parse_cbor!(decode_base64!(\"GCo=\"))", - "return": 42 - }, - { - "title": "float", - "source": "parse_cbor!(decode_base64!(\"+0BFEKPXCj1x\"))", - "return": 42.13 - }, - { - "title": "boolean", - "source": "parse_cbor!(decode_base64!(\"9A==\"))", - "return": false - } - ], - "notices": [ - "Only CBOR types are returned." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_cef.cue b/website/cue/reference/remap/functions/parse_cef.cue deleted file mode 100644 index ecbc318a507fc..0000000000000 --- a/website/cue/reference/remap/functions/parse_cef.cue +++ /dev/null @@ -1,150 +0,0 @@ -{ - "remap": { - "functions": { - "parse_cef": { - "anchor": "parse_cef", - "name": "parse_cef", - "category": "Parse", - "description": "Parses the `value` in CEF (Common Event Format) format. Ignores everything up to CEF header. Empty values are returned as empty strings. Surrounding quotes are removed from values.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "translate_custom_fields", - "description": "Toggles translation of custom field pairs to `key:value`.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted CEF string." - ], - "examples": [ - { - "title": "Parse output generated by PTA", - "source": "parse_cef!(\n \"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft|8|suser=mike2@prod1.domain.com shost=prod1.domain.com src=1.1.1.1 duser=andy@dev1.domain.com dhost=dev1.domain.com dst=2.2.2.2 cs1Label=ExtraData cs1=None cs2Label=EventID cs2=52b06812ec3500ed864c461e deviceCustomDate1Label=detectionDate deviceCustomDate1=1388577900000 cs3Label=PTAlink cs3=https://1.1.1.1/incidents/52b06812ec3500ed864c461e cs4Label=ExternalLink cs4=None\"\n)\n", - "return": { - "cefVersion": "0", - "deviceVendor": "CyberArk", - "deviceProduct": "PTA", - "deviceVersion": "12.6", - "deviceEventClassId": "1", - "name": "Suspected credentials theft", - "severity": "8", - "suser": "mike2@prod1.domain.com", - "shost": "prod1.domain.com", - "src": "1.1.1.1", - "duser": "andy@dev1.domain.com", - "dhost": "dev1.domain.com", - "dst": "2.2.2.2", - "cs1Label": "ExtraData", - "cs1": "None", - "cs2Label": "EventID", - "cs2": "52b06812ec3500ed864c461e", - "deviceCustomDate1Label": "detectionDate", - "deviceCustomDate1": "1388577900000", - "cs3Label": "PTAlink", - "cs3": "https://1.1.1.1/incidents/52b06812ec3500ed864c461e", - "cs4Label": "ExternalLink", - "cs4": "None" - } - }, - { - "title": "Ignore syslog header", - "source": "parse_cef!(\n \"Sep 29 08:26:10 host CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2 spt=1232\"\n)\n", - "return": { - "cefVersion": "1", - "deviceVendor": "Security", - "deviceProduct": "threatmanager", - "deviceVersion": "1.0", - "deviceEventClassId": "100", - "name": "worm successfully stopped", - "severity": "10", - "src": "10.0.0.1", - "dst": "2.1.2.2", - "spt": "1232" - } - }, - { - "title": "Translate custom fields", - "source": "parse_cef!(\n \"CEF:0|Dev|firewall|2.2|1|Connection denied|5|c6a1=2345:0425:2CA1:0000:0000:0567:5673:23b5 c6a1Label=Device IPv6 Address\",\n translate_custom_fields: true\n)\n", - "return": { - "cefVersion": "0", - "deviceVendor": "Dev", - "deviceProduct": "firewall", - "deviceVersion": "2.2", - "deviceEventClassId": "1", - "name": "Connection denied", - "severity": "5", - "Device IPv6 Address": "2345:0425:2CA1:0000:0000:0567:5673:23b5" - } - }, - { - "title": "Parse CEF with only header", - "source": "parse_cef!(\"CEF:1|Security|threatmanager|1.0|100|worm successfully stopped|10|\")", - "return": { - "cefVersion": "1", - "deviceVendor": "Security", - "deviceProduct": "threatmanager", - "deviceVersion": "1.0", - "deviceEventClassId": "100", - "name": "worm successfully stopped", - "severity": "10" - } - }, - { - "title": "Parse CEF with empty value", - "source": "parse_cef!(\"CEF:0|CyberArk|PTA|12.6|1|Suspected credentials theft||suser=mike2@prod1.domain.com shost= src=1.1.1.1\")", - "return": { - "cefVersion": "0", - "deviceVendor": "CyberArk", - "deviceProduct": "PTA", - "deviceVersion": "12.6", - "deviceEventClassId": "1", - "name": "Suspected credentials theft", - "severity": "", - "suser": "mike2@prod1.domain.com", - "shost": "", - "src": "1.1.1.1" - } - }, - { - "title": "Parse CEF with escapes", - "source": "parse_cef!(s'CEF:0|security|threatmanager|1.0|100|Detected a \\| in message. No action needed.|10|src=10.0.0.1 msg=Detected a threat.\\n No action needed act=blocked a \\= dst=1.1.1.1')", - "return": { - "cefVersion": "0", - "deviceVendor": "security", - "deviceProduct": "threatmanager", - "deviceVersion": "1.0", - "deviceEventClassId": "100", - "name": "Detected a | in message. No action needed.", - "severity": "10", - "src": "10.0.0.1", - "msg": "Detected a threat.\n No action needed", - "act": "blocked a =", - "dst": "1.1.1.1" - } - } - ], - "notices": [ - "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_common_log.cue b/website/cue/reference/remap/functions/parse_common_log.cue deleted file mode 100644 index 16fe24074f688..0000000000000 --- a/website/cue/reference/remap/functions/parse_common_log.cue +++ /dev/null @@ -1,79 +0,0 @@ -{ - "remap": { - "functions": { - "parse_common_log": { - "anchor": "parse_common_log", - "name": "parse_common_log", - "category": "Parse", - "description": "Parses the `value` using the [Common Log Format](https://httpd.apache.org/docs/current/logs.html#common) (CLF).", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "timestamp_format", - "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) to use for\nencoding the timestamp.", - "required": false, - "type": [ - "string" - ], - "default": "%d/%b/%Y:%T %z" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` does not match the Common Log Format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`." - ], - "examples": [ - { - "title": "Parse using Common Log Format (with default timestamp format)", - "source": "parse_common_log!(s'127.0.0.1 bob frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326')", - "return": { - "host": "127.0.0.1", - "identity": "bob", - "message": "GET /apache_pb.gif HTTP/1.0", - "method": "GET", - "path": "/apache_pb.gif", - "protocol": "HTTP/1.0", - "size": 2326, - "status": 200, - "timestamp": "2000-10-10T20:55:36Z", - "user": "frank" - } - }, - { - "title": "Parse using Common Log Format (with custom timestamp format)", - "source": "parse_common_log!(\n s'127.0.0.1 bob frank [2000-10-10T20:55:36Z] \"GET /apache_pb.gif HTTP/1.0\" 200 2326',\n \"%+\"\n)\n", - "return": { - "host": "127.0.0.1", - "identity": "bob", - "message": "GET /apache_pb.gif HTTP/1.0", - "method": "GET", - "path": "/apache_pb.gif", - "protocol": "HTTP/1.0", - "size": 2326, - "status": 200, - "timestamp": "2000-10-10T20:55:36Z", - "user": "frank" - } - } - ], - "notices": [ - "Missing information in the log message may be indicated by `-`. These fields are omitted in the result." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_csv.cue b/website/cue/reference/remap/functions/parse_csv.cue deleted file mode 100644 index 42267e802285d..0000000000000 --- a/website/cue/reference/remap/functions/parse_csv.cue +++ /dev/null @@ -1,63 +0,0 @@ -{ - "remap": { - "functions": { - "parse_csv": { - "anchor": "parse_csv", - "name": "parse_csv", - "category": "Parse", - "description": "Parses a single CSV formatted row. Only the first row is parsed in case of multiline input value.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "delimiter", - "description": "The field delimiter to use when parsing. Must be a single-byte utf8 character.", - "required": false, - "type": [ - "string" - ], - "default": "," - } - ], - "return": { - "types": [ - "array" - ] - }, - "internal_failure_reasons": [ - "The delimiter must be a single-byte UTF-8 character.", - "`value` is not a valid CSV string." - ], - "examples": [ - { - "title": "Parse a single CSV formatted row", - "source": "parse_csv!(s'foo,bar,\"foo \"\", bar\"')", - "return": [ - "foo", - "bar", - "foo \", bar" - ] - }, - { - "title": "Parse a single CSV formatted row with custom delimiter", - "source": "parse_csv!(\"foo bar\", delimiter: \" \")", - "return": [ - "foo", - "bar" - ] - } - ], - "notices": [ - "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_dnstap.cue b/website/cue/reference/remap/functions/parse_dnstap.cue deleted file mode 100644 index 8ba18850083e7..0000000000000 --- a/website/cue/reference/remap/functions/parse_dnstap.cue +++ /dev/null @@ -1,148 +0,0 @@ -{ - "remap": { - "functions": { - "parse_dnstap": { - "anchor": "parse_dnstap", - "name": "parse_dnstap", - "category": "Parse", - "description": "Parses the `value` as base64 encoded DNSTAP data.", - "arguments": [ - { - "name": "value", - "description": "The base64 encoded representation of the DNSTAP data to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "lowercase_hostnames", - "description": "Whether to turn all hostnames found in resulting data lowercase, for consistency.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid base64 encoded string.", - "dnstap parsing failed for `value`" - ], - "examples": [ - { - "title": "Parse dnstap query message", - "source": "parse_dnstap!(\"ChVqYW1lcy1WaXJ0dWFsLU1hY2hpbmUSC0JJTkQgOS4xNi4zGgBy5wEIAxACGAEiEAAAAAAAAAAAAAAAAAAAAAAqECABBQJwlAAAAAAAAAAAADAw8+0CODVA7+zq9wVNMU3WNlI2kwIAAAABAAAAAAABCWZhY2Vib29rMQNjb20AAAEAAQAAKQIAAACAAAAMAAoACOxjCAG9zVgzWgUDY29tAGAAbQAAAAByZLM4AAAAAQAAAAAAAQJoNQdleGFtcGxlA2NvbQAABgABAAApBNABAUAAADkADwA1AAlubyBTRVAgbWF0Y2hpbmcgdGhlIERTIGZvdW5kIGZvciBkbnNzZWMtZmFpbGVkLm9yZy54AQ==\")", - "return": { - "dataType": "Message", - "dataTypeId": 1, - "extraInfo": "", - "messageType": "ResolverQuery", - "messageTypeId": 3, - "queryZone": "com.", - "requestData": { - "fullRcode": 0, - "header": { - "aa": false, - "ad": false, - "anCount": 0, - "arCount": 1, - "cd": false, - "id": 37634, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": 0, - "ra": false, - "rcode": 0, - "rd": false, - "tc": false - }, - "opt": { - "do": true, - "ednsVersion": 0, - "extendedRcode": 0, - "options": [ - { - "optCode": 10, - "optName": "Cookie", - "optValue": "7GMIAb3NWDM=" - } - ], - "udpPayloadSize": 512 - }, - "question": [ - { - "class": "IN", - "domainName": "facebook1.com.", - "questionType": "A", - "questionTypeId": 1 - } - ], - "rcodeName": "NoError" - }, - "responseData": { - "fullRcode": 16, - "header": { - "aa": false, - "ad": false, - "anCount": 0, - "arCount": 1, - "cd": false, - "id": 45880, - "nsCount": 0, - "opcode": 0, - "qdCount": 1, - "qr": 0, - "ra": false, - "rcode": 16, - "rd": false, - "tc": false - }, - "opt": { - "do": false, - "ednsVersion": 1, - "extendedRcode": 1, - "ede": [ - { - "extraText": "no SEP matching the DS found for dnssec-failed.org.", - "infoCode": 9, - "purpose": "DNSKEY Missing" - } - ], - "udpPayloadSize": 1232 - }, - "question": [ - { - "class": "IN", - "domainName": "h5.example.com.", - "questionType": "SOA", - "questionTypeId": 6 - } - ], - "rcodeName": "BADVERS" - }, - "responseAddress": "2001:502:7094::30", - "responsePort": 53, - "serverId": "james-Virtual-Machine", - "serverVersion": "BIND 9.16.3", - "socketFamily": "INET6", - "socketProtocol": "UDP", - "sourceAddress": "::", - "sourcePort": 46835, - "time": 1593489007920014129, - "timePrecision": "ns", - "timestamp": "2020-06-30T03:50:07.920014129Z" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_duration.cue b/website/cue/reference/remap/functions/parse_duration.cue deleted file mode 100644 index f9aaac0ab2d96..0000000000000 --- a/website/cue/reference/remap/functions/parse_duration.cue +++ /dev/null @@ -1,63 +0,0 @@ -{ - "remap": { - "functions": { - "parse_duration": { - "anchor": "parse_duration", - "name": "parse_duration", - "category": "Parse", - "description": "Parses the `value` into a human-readable duration format specified by `unit`.", - "arguments": [ - { - "name": "value", - "description": "The string of the duration.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "unit", - "description": "The output units for the duration.", - "required": true, - "type": [ - "string" - ], - "enum": { - "ns": "Nanoseconds (1 billion nanoseconds in a second)", - "us": "Microseconds (1 million microseconds in a second)", - "µs": "Microseconds (1 million microseconds in a second)", - "ms": "Milliseconds (1 thousand microseconds in a second)", - "cs": "Centiseconds (100 centiseconds in a second)", - "ds": "Deciseconds (10 deciseconds in a second)", - "s": "Seconds", - "m": "Minutes (60 seconds in a minute)", - "h": "Hours (60 minutes in an hour)", - "d": "Days (24 hours in a day)" - } - } - ], - "return": { - "types": [ - "float" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted duration." - ], - "examples": [ - { - "title": "Parse duration (milliseconds)", - "source": "parse_duration!(\"1005ms\", unit: \"s\")", - "return": 1.005 - }, - { - "title": "Parse multiple durations (seconds & milliseconds)", - "source": "parse_duration!(\"1s 1ms\", unit: \"ms\")", - "return": 1001.0 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_etld.cue b/website/cue/reference/remap/functions/parse_etld.cue deleted file mode 100644 index cad0880954498..0000000000000 --- a/website/cue/reference/remap/functions/parse_etld.cue +++ /dev/null @@ -1,86 +0,0 @@ -{ - "remap": { - "functions": { - "parse_etld": { - "anchor": "parse_etld", - "name": "parse_etld", - "category": "Parse", - "description": "Parses the [eTLD](https://developer.mozilla.org/en-US/docs/Glossary/eTLD) from `value` representing domain name.", - "arguments": [ - { - "name": "value", - "description": "The domain string.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "plus_parts", - "description": "Can be provided to get additional parts of the domain name. When 1 is passed,\neTLD+1 will be returned, which represents a domain registrable by a single\norganization. Higher numbers will return subdomains.", - "required": false, - "type": [ - "integer" - ], - "default": "0" - }, - { - "name": "psl", - "description": "Can be provided to use a different public suffix list.\n\nBy default, https://publicsuffix.org/list/public_suffix_list.dat is used.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "unable to determine eTLD for `value`" - ], - "examples": [ - { - "title": "Parse eTLD", - "source": "parse_etld!(\"sub.sussex.ac.uk\")", - "return": { - "etld": "ac.uk", - "etld_plus": "ac.uk", - "known_suffix": true - } - }, - { - "title": "Parse eTLD+1", - "source": "parse_etld!(\"sub.sussex.ac.uk\", plus_parts: 1)", - "return": { - "etld": "ac.uk", - "etld_plus": "sussex.ac.uk", - "known_suffix": true - } - }, - { - "title": "Parse eTLD with unknown suffix", - "source": "parse_etld!(\"vector.acmecorp\")", - "return": { - "etld": "acmecorp", - "etld_plus": "acmecorp", - "known_suffix": false - } - }, - { - "title": "Parse eTLD with custom PSL", - "source": "parse_etld!(\"vector.acmecorp\", psl: \"lib/tests/tests/functions/custom_public_suffix_list.dat\")", - "return": { - "etld": "acmecorp", - "etld_plus": "acmecorp", - "known_suffix": false - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_float.cue b/website/cue/reference/remap/functions/parse_float.cue deleted file mode 100644 index 516a45929ebdc..0000000000000 --- a/website/cue/reference/remap/functions/parse_float.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "parse_float": { - "anchor": "parse_float", - "name": "parse_float", - "category": "String", - "description": "Parses the string `value` representing a floating point number in base 10 to a float.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "float" - ] - }, - "internal_failure_reasons": [ - "`value` is not a string." - ], - "examples": [ - { - "title": "Parse negative integer", - "source": "parse_float!(\"-42\")", - "return": -42.0 - }, - { - "title": "Parse float", - "source": "parse_float!(\"42.38\")", - "return": 42.38 - }, - { - "title": "Scientific notation", - "source": "parse_float!(\"2.5e3\")", - "return": 2500.0 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_glog.cue b/website/cue/reference/remap/functions/parse_glog.cue deleted file mode 100644 index 51343d8678782..0000000000000 --- a/website/cue/reference/remap/functions/parse_glog.cue +++ /dev/null @@ -1,45 +0,0 @@ -{ - "remap": { - "functions": { - "parse_glog": { - "anchor": "parse_glog", - "name": "parse_glog", - "category": "Parse", - "description": "Parses the `value` using the [glog (Google Logging Library)](https://github.com/google/glog) format.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` does not match the `glog` format." - ], - "examples": [ - { - "title": "Parse using glog", - "source": "parse_glog!(\"I20210131 14:48:54.411655 15520 main.c++:9] Hello world!\")", - "return": { - "file": "main.c++", - "id": 15520, - "level": "info", - "line": 9, - "message": "Hello world!", - "timestamp": "2021-01-31T14:48:54.411655Z" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_grok.cue b/website/cue/reference/remap/functions/parse_grok.cue deleted file mode 100644 index 4f275aea9adf2..0000000000000 --- a/website/cue/reference/remap/functions/parse_grok.cue +++ /dev/null @@ -1,53 +0,0 @@ -{ - "remap": { - "functions": { - "parse_grok": { - "anchor": "parse_grok", - "name": "parse_grok", - "category": "Parse", - "description": "Parses the `value` using the [`grok`](https://github.com/daschl/grok/tree/master/patterns) format. All patterns [listed here](https://github.com/daschl/grok/tree/master/patterns) are supported.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "The [Grok pattern](https://github.com/daschl/grok/tree/master/patterns).", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` fails to parse using the provided `pattern`." - ], - "examples": [ - { - "title": "Parse using Grok", - "source": "value = \"2020-10-02T23:22:12.223222Z info Hello world\"\npattern = \"%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:message}\"\n\nparse_grok!(value, pattern)\n", - "return": { - "timestamp": "2020-10-02T23:22:12.223222Z", - "level": "info", - "message": "Hello world" - } - } - ], - "notices": [ - "We recommend using community-maintained Grok patterns when possible, as they're more\nlikely to be properly vetted and improved over time than bespoke patterns." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_groks.cue b/website/cue/reference/remap/functions/parse_groks.cue deleted file mode 100644 index 7d24d7d6721a1..0000000000000 --- a/website/cue/reference/remap/functions/parse_groks.cue +++ /dev/null @@ -1,81 +0,0 @@ -{ - "remap": { - "functions": { - "parse_groks": { - "anchor": "parse_groks", - "name": "parse_groks", - "category": "Parse", - "description": "Parses the `value` using multiple [`grok`](https://github.com/daschl/grok/tree/master/patterns) patterns. All patterns [listed here](https://github.com/daschl/grok/tree/master/patterns) are supported.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "patterns", - "description": "The [Grok patterns](https://github.com/daschl/grok/tree/master/patterns), which are tried in order until the first match.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "aliases", - "description": "The shared set of grok aliases that can be referenced in the patterns to simplify them.", - "required": false, - "type": [ - "object" - ], - "default": "{ }" - }, - { - "name": "alias_sources", - "description": "Path to the file containing aliases in a JSON format.", - "required": false, - "type": [ - "array" - ], - "default": "[]" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` fails to parse using the provided `pattern`.", - "`patterns` is not an array.", - "`aliases` is not an object.", - "`alias_sources` is not a string array or doesn't point to a valid file." - ], - "examples": [ - { - "title": "Parse using multiple Grok patterns", - "source": "parse_groks!(\n \"2020-10-02T23:22:12.223222Z info Hello world\",\n patterns: [\n \"%{common_prefix} %{_status} %{_message}\",\n \"%{common_prefix} %{_message}\",\n ],\n aliases: {\n \"common_prefix\": \"%{_timestamp} %{_loglevel}\",\n \"_timestamp\": \"%{TIMESTAMP_ISO8601:timestamp}\",\n \"_loglevel\": \"%{LOGLEVEL:level}\",\n \"_status\": \"%{POSINT:status}\",\n \"_message\": \"%{GREEDYDATA:message}\"\n }\n)\n", - "return": { - "timestamp": "2020-10-02T23:22:12.223222Z", - "level": "info", - "message": "Hello world" - } - }, - { - "title": "Parse using aliases from file", - "source": "parse_groks!(\n \"username=foo\",\n patterns: [ \"%{PATTERN_A}\" ],\n alias_sources: [ \"tests/data/grok/aliases.json\" ]\n)\n# aliases.json contents:\n# {\n# \"PATTERN_A\": \"%{PATTERN_B}\",\n# \"PATTERN_B\": \"username=%{USERNAME:username}\"\n# }\n", - "return": { - "username": "foo" - } - } - ], - "notices": [ - "We recommend using community-maintained Grok patterns when possible, as they're more\nlikely to be properly vetted and improved over time than bespoke patterns." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_influxdb.cue b/website/cue/reference/remap/functions/parse_influxdb.cue deleted file mode 100644 index d2a9859a1120d..0000000000000 --- a/website/cue/reference/remap/functions/parse_influxdb.cue +++ /dev/null @@ -1,106 +0,0 @@ -{ - "remap": { - "functions": { - "parse_influxdb": { - "anchor": "parse_influxdb", - "name": "parse_influxdb", - "category": "Parse", - "description": "Parses the `value` as an [InfluxDB line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) string, producing a list of Vector-compatible metrics.", - "arguments": [ - { - "name": "value", - "description": "The string representation of the InfluxDB line protocol to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid InfluxDB line protocol string.", - "field set contains a field value of type `string`.", - "field set contains a `NaN` field value." - ], - "examples": [ - { - "title": "Parse InfluxDB line protocol", - "source": "parse_influxdb!(\"cpu,host=A,region=us-west usage_system=64i,usage_user=10u,temperature=50.5,on=true,sleep=false 1590488773254420000\")", - "return": [ - { - "name": "cpu_usage_system", - "tags": { - "host": "A", - "region": "us-west" - }, - "timestamp": "2020-05-26T10:26:13.254420Z", - "kind": "absolute", - "gauge": { - "value": 64.0 - } - }, - { - "name": "cpu_usage_user", - "tags": { - "host": "A", - "region": "us-west" - }, - "timestamp": "2020-05-26T10:26:13.254420Z", - "kind": "absolute", - "gauge": { - "value": 10.0 - } - }, - { - "name": "cpu_temperature", - "tags": { - "host": "A", - "region": "us-west" - }, - "timestamp": "2020-05-26T10:26:13.254420Z", - "kind": "absolute", - "gauge": { - "value": 50.5 - } - }, - { - "name": "cpu_on", - "tags": { - "host": "A", - "region": "us-west" - }, - "timestamp": "2020-05-26T10:26:13.254420Z", - "kind": "absolute", - "gauge": { - "value": 1.0 - } - }, - { - "name": "cpu_sleep", - "tags": { - "host": "A", - "region": "us-west" - }, - "timestamp": "2020-05-26T10:26:13.254420Z", - "kind": "absolute", - "gauge": { - "value": 0.0 - } - } - ] - } - ], - "notices": [ - "This function will return a log event with the shape of a Vector-compatible metric,\nbut not a metric event itself. You will likely want to pipe the output of this\nfunction through a `log_to_metric` transform with the option `all_metrics` set to\n`true` to convert the metric-shaped log events to metric events so _real_ metrics\nare produced.", - "The only metric type that is produced is a `gauge`. Each metric name is prefixed\nwith the `measurement` field, followed by an underscore (`_`), and then the\n`field key` field.", - "`string` is the only type that is not supported as a field value, due to limitations\nof Vector's metric model." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_int.cue b/website/cue/reference/remap/functions/parse_int.cue deleted file mode 100644 index f6c04302bb09f..0000000000000 --- a/website/cue/reference/remap/functions/parse_int.cue +++ /dev/null @@ -1,67 +0,0 @@ -{ - "remap": { - "functions": { - "parse_int": { - "anchor": "parse_int", - "name": "parse_int", - "category": "Parse", - "description": "Parses the string `value` representing a number in an optional base/radix to an integer.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "base", - "description": "The base the number is in. Must be between 2 and 36 (inclusive).\n\nIf unspecified, the string prefix is used to\ndetermine the base: \"0b\", 8 for \"0\" or \"0o\", 16 for \"0x\",\nand 10 otherwise.", - "required": false, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "internal_failure_reasons": [ - "The base is not between 2 and 36.", - "The number cannot be parsed in the base." - ], - "examples": [ - { - "title": "Parse decimal", - "source": "parse_int!(\"-42\")", - "return": -42 - }, - { - "title": "Parse binary", - "source": "parse_int!(\"0b1001\")", - "return": 9 - }, - { - "title": "Parse octal", - "source": "parse_int!(\"0o42\")", - "return": 34 - }, - { - "title": "Parse hexadecimal", - "source": "parse_int!(\"0x2a\")", - "return": 42 - }, - { - "title": "Parse explicit base", - "source": "parse_int!(\"2a\", 17)", - "return": 44 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_json.cue b/website/cue/reference/remap/functions/parse_json.cue deleted file mode 100644 index a7130caffe730..0000000000000 --- a/website/cue/reference/remap/functions/parse_json.cue +++ /dev/null @@ -1,106 +0,0 @@ -{ - "remap": { - "functions": { - "parse_json": { - "anchor": "parse_json", - "name": "parse_json", - "category": "Parse", - "description": "Parses the provided `value` as JSON.\n\nOnly JSON types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the `parse_timestamp` function.", - "arguments": [ - { - "name": "value", - "description": "The string representation of the JSON to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "max_depth", - "description": "Number of layers to parse for nested JSON-formatted documents.\nThe value must be in the range of 1 to 128.", - "required": false, - "type": [ - "integer" - ] - }, - { - "name": "lossy", - "description": "Whether to parse the JSON in a lossy manner. Replaces invalid UTF-8 characters\nwith the Unicode character `�` (U+FFFD) if set to true, otherwise returns an error\nif there are any invalid UTF-8 characters present.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "string", - "integer", - "float", - "boolean", - "object", - "array", - "null" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid JSON-formatted payload." - ], - "examples": [ - { - "title": "Parse JSON", - "source": "parse_json!(s'{\"key\": \"val\"}')", - "return": { - "key": "val" - } - }, - { - "title": "Parse JSON array", - "source": "parse_json!(\"[true, 0]\")", - "return": [ - true, - 0 - ] - }, - { - "title": "Parse JSON string", - "source": "parse_json!(s'\"hello\"')", - "return": "hello" - }, - { - "title": "Parse JSON integer", - "source": "parse_json!(\"42\")", - "return": 42 - }, - { - "title": "Parse JSON float", - "source": "parse_json!(\"42.13\")", - "return": 42.13 - }, - { - "title": "Parse JSON boolean", - "source": "parse_json!(\"false\")", - "return": false - }, - { - "title": "Invalid JSON value", - "source": "parse_json!(\"{ INVALID }\")", - "raises": "function call error for \"parse_json\" at (0:26): unable to parse json: key must be a string at line 1 column 3" - }, - { - "title": "Parse JSON with max_depth", - "source": "parse_json!(s'{\"first_level\":{\"second_level\":\"finish\"}}', max_depth: 1)", - "return": { - "first_level": "{\"second_level\":\"finish\"}" - } - } - ], - "notices": [ - "Only JSON types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the [`parse_timestamp`](#parse_timestamp) function." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_key_value.cue b/website/cue/reference/remap/functions/parse_key_value.cue deleted file mode 100644 index 5ae24b41d6c02..0000000000000 --- a/website/cue/reference/remap/functions/parse_key_value.cue +++ /dev/null @@ -1,145 +0,0 @@ -{ - "remap": { - "functions": { - "parse_key_value": { - "anchor": "parse_key_value", - "name": "parse_key_value", - "category": "Parse", - "description": "Parses the `value` in key-value format. Also known as [logfmt](https://brandur.org/logfmt).\n\n* Keys and values can be wrapped with `\"`.\n* `\"` characters can be escaped using `\\`.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "key_value_delimiter", - "description": "The string that separates the key from the value.", - "required": false, - "type": [ - "string" - ], - "default": "=" - }, - { - "name": "field_delimiter", - "description": "The string that separates each key-value pair.", - "required": false, - "type": [ - "string" - ], - "default": " " - }, - { - "name": "whitespace", - "description": "Defines the acceptance of unnecessary whitespace surrounding the configured `key_value_delimiter`.", - "required": false, - "type": [ - "string" - ], - "enum": { - "lenient": "Ignore whitespace.", - "strict": "Parse whitespace as normal character." - }, - "default": "lenient" - }, - { - "name": "accept_standalone_key", - "description": "Whether a standalone key should be accepted, the resulting object associates such keys with the boolean value `true`.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted key-value string." - ], - "examples": [ - { - "title": "Parse simple key value pairs", - "source": "parse_key_value!(\"zork=zook zonk=nork\")", - "return": { - "zork": "zook", - "zonk": "nork" - } - }, - { - "title": "Parse logfmt log", - "source": "parse_key_value!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", - "return": { - "@timestamp": "Sun Jan 10 16:47:39 EST 2021", - "level": "info", - "msg": "Stopping all fetchers", - "tag#production": "stopping_fetchers", - "id": "ConsumerFetcherManager-1382721708341", - "module": "kafka.consumer.ConsumerFetcherManager" - } - }, - { - "title": "Parse comma delimited log", - "source": "parse_key_value!(\n \"path:\\\"/cart_link\\\", host:store.app.com, fwd: \\\"102.30.171.16\\\", dyno: web.1, connect:0ms, service:87ms, status:304, bytes:632, protocol:https\",\n field_delimiter: \",\",\n key_value_delimiter: \":\"\n)\n", - "return": { - "path": "/cart_link", - "host": "store.app.com", - "fwd": "102.30.171.16", - "dyno": "web.1", - "connect": "0ms", - "service": "87ms", - "status": "304", - "bytes": "632", - "protocol": "https" - } - }, - { - "title": "Parse comma delimited log with standalone keys", - "source": "parse_key_value!(\n \"env:prod,service:backend,region:eu-east1,beta\",\n field_delimiter: \",\",\n key_value_delimiter: \":\",\n)\n", - "return": { - "env": "prod", - "service": "backend", - "region": "eu-east1", - "beta": true - } - }, - { - "title": "Parse duplicate keys", - "source": "parse_key_value!(\n \"at=info,method=GET,path=\\\"/index\\\",status=200,tags=dev,tags=dummy\",\n field_delimiter: \",\",\n key_value_delimiter: \"=\",\n)\n", - "return": { - "at": "info", - "method": "GET", - "path": "/index", - "status": "200", - "tags": [ - "dev", - "dummy" - ] - } - }, - { - "title": "Parse with strict whitespace", - "source": "parse_key_value!(s'app=my-app ip=1.2.3.4 user= msg=hello-world', whitespace: \"strict\")", - "return": { - "app": "my-app", - "ip": "1.2.3.4", - "user": "", - "msg": "hello-world" - } - } - ], - "notices": [ - "All values are returned as strings or as an array of strings for duplicate keys. We\nrecommend manually coercing values to desired types as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_klog.cue b/website/cue/reference/remap/functions/parse_klog.cue deleted file mode 100644 index 91acbd1e20871..0000000000000 --- a/website/cue/reference/remap/functions/parse_klog.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "parse_klog": { - "anchor": "parse_klog", - "name": "parse_klog", - "category": "Parse", - "description": "Parses the `value` using the [klog](https://github.com/kubernetes/klog) format used by Kubernetes components.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` does not match the `klog` format." - ], - "examples": [ - { - "title": "Parse using klog", - "source": "parse_klog!(\"I0505 17:59:40.692994 28133 klog.go:70] hello from klog\")", - "return": { - "file": "klog.go", - "id": 28133, - "level": "info", - "line": 70, - "message": "hello from klog", - "timestamp": "2026-05-05T17:59:40.692994Z" - } - } - ], - "notices": [ - "This function resolves the year for messages. If the current month is January and the\nprovided month is December, it sets the year to the previous year. Otherwise, it sets\nthe year to the current year." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_linux_authorization.cue b/website/cue/reference/remap/functions/parse_linux_authorization.cue deleted file mode 100644 index f1a9b8db8bf78..0000000000000 --- a/website/cue/reference/remap/functions/parse_linux_authorization.cue +++ /dev/null @@ -1,47 +0,0 @@ -{ - "remap": { - "functions": { - "parse_linux_authorization": { - "anchor": "parse_linux_authorization", - "name": "parse_linux_authorization", - "category": "Parse", - "description": "Parses Linux authorization logs usually found under either `/var/log/auth.log` (for Debian-based systems) or `/var/log/secure` (for RedHat-based systems) according to [Syslog](https://en.wikipedia.org/wiki/Syslog) format.", - "arguments": [ - { - "name": "value", - "description": "The text containing the message to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted Syslog message." - ], - "examples": [ - { - "title": "Parse Linux authorization event", - "source": "parse_linux_authorization!(\n s'Mar 23 01:49:58 localhost sshd[1111]: Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar'\n)\n", - "return": { - "appname": "sshd", - "hostname": "localhost", - "message": "Accepted publickey for eng from 10.1.1.1 port 8888 ssh2: RSA SHA256:foobar", - "procid": 1111, - "timestamp": "2026-03-23T01:49:58Z" - } - } - ], - "notices": [ - "The function resolves the year for messages that don't include it. If the current month\nis January, and the message is for December, it will take the previous year. Otherwise,\ntake the current year." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_logfmt.cue b/website/cue/reference/remap/functions/parse_logfmt.cue deleted file mode 100644 index 0e6547561afcd..0000000000000 --- a/website/cue/reference/remap/functions/parse_logfmt.cue +++ /dev/null @@ -1,62 +0,0 @@ -{ - "remap": { - "functions": { - "parse_logfmt": { - "anchor": "parse_logfmt", - "name": "parse_logfmt", - "category": "Parse", - "description": "Parses the `value` in [logfmt](https://brandur.org/logfmt).\n\n* Keys and values can be wrapped using the `\"` character.\n* `\"` characters can be escaped by the `\\` character.\n* As per this [logfmt specification](https://pkg.go.dev/github.com/kr/logfmt#section-documentation), the `parse_logfmt` function accepts standalone keys and assigns them a Boolean value of `true`.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted key-value string" - ], - "examples": [ - { - "title": "Parse simple logfmt log", - "source": "parse_logfmt!(\"zork=zook zonk=nork\")", - "return": { - "zork": "zook", - "zonk": "nork" - } - }, - { - "title": "Parse logfmt log", - "source": "parse_logfmt!(\n \"@timestamp=\\\"Sun Jan 10 16:47:39 EST 2021\\\" level=info msg=\\\"Stopping all fetchers\\\" tag#production=stopping_fetchers id=ConsumerFetcherManager-1382721708341 module=kafka.consumer.ConsumerFetcherManager\"\n)\n", - "return": { - "@timestamp": "Sun Jan 10 16:47:39 EST 2021", - "level": "info", - "msg": "Stopping all fetchers", - "tag#production": "stopping_fetchers", - "id": "ConsumerFetcherManager-1382721708341", - "module": "kafka.consumer.ConsumerFetcherManager" - } - }, - { - "title": "Parse logfmt log with standalone key", - "source": "parse_logfmt!(\"zork=zook plonk zonk=nork\")", - "return": { - "plonk": true, - "zork": "zook", - "zonk": "nork" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_nginx_log.cue b/website/cue/reference/remap/functions/parse_nginx_log.cue deleted file mode 100644 index c57ffd8b3135f..0000000000000 --- a/website/cue/reference/remap/functions/parse_nginx_log.cue +++ /dev/null @@ -1,131 +0,0 @@ -{ - "remap": { - "functions": { - "parse_nginx_log": { - "anchor": "parse_nginx_log", - "name": "parse_nginx_log", - "category": "Parse", - "description": "Parses Nginx access and error log lines. Lines can be in [`combined`](https://nginx.org/en/docs/http/ngx_http_log_module.html), [`ingress_upstreaminfo`](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/log-format/), [`main`](https://hg.nginx.org/pkg-oss/file/tip/debian/debian/nginx.conf) or [`error`](https://github.com/nginx/nginx/blob/branches/stable-1.18/src/core/ngx_log.c#L102) format.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "format", - "description": "The format to use for parsing the log.", - "required": true, - "type": [ - "string" - ], - "enum": { - "combined": "Nginx combined format", - "error": "Default Nginx error format", - "ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)", - "main": "Nginx main format used by Docker images" - } - }, - { - "name": "timestamp_format", - "description": "The [date/time format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) to use for encoding the timestamp. The time is parsed\nin local time if the timestamp doesn't specify a timezone. The default format is `%d/%b/%Y:%T %z` for\ncombined logs and `%Y/%m/%d %H:%M:%S` for error logs.", - "required": false, - "type": [ - "string" - ], - "default": "%d/%b/%Y:%T %z" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` does not match the specified format.", - "`timestamp_format` is not a valid format string.", - "The timestamp in `value` fails to parse using the provided `timestamp_format`." - ], - "examples": [ - { - "title": "Parse via Nginx log format (combined)", - "source": "parse_nginx_log!(\n s'172.17.0.1 - alice [01/Apr/2021:12:02:31 +0000] \"POST /not-found HTTP/1.1\" 404 153 \"http://localhost/somewhere\" \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36\" \"2.75\"',\n \"combined\",\n)\n", - "return": { - "agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36", - "client": "172.17.0.1", - "compression": "2.75", - "referer": "http://localhost/somewhere", - "request": "POST /not-found HTTP/1.1", - "size": 153, - "status": 404, - "timestamp": "2021-04-01T12:02:31Z", - "user": "alice" - } - }, - { - "title": "Parse via Nginx log format (error)", - "source": "parse_nginx_log!(\n s'2021/04/01 13:02:31 [error] 31#31: *1 open() \"/usr/share/nginx/html/not-found\" failed (2: No such file or directory), client: 172.17.0.1, server: localhost, request: \"POST /not-found HTTP/1.1\", host: \"localhost:8081\"',\n \"error\"\n)\n", - "return": { - "cid": 1, - "client": "172.17.0.1", - "host": "localhost:8081", - "message": "open() \"/usr/share/nginx/html/not-found\" failed (2: No such file or directory)", - "pid": 31, - "request": "POST /not-found HTTP/1.1", - "server": "localhost", - "severity": "error", - "tid": 31, - "timestamp": "2021-04-01T13:02:31Z" - } - }, - { - "title": "Parse via Nginx log format (ingress_upstreaminfo)", - "source": "parse_nginx_log!(\n s'0.0.0.0 - bob [18/Mar/2023:15:00:00 +0000] \"GET /some/path HTTP/2.0\" 200 12312 \"https://10.0.0.1/some/referer\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36\" 462 0.050 [some-upstream-service-9000] [some-other-upstream-5000] 10.0.50.80:9000 19437 0.049 200 752178adb17130b291aefd8c386279e7',\n \"ingress_upstreaminfo\"\n)\n", - "return": { - "body_bytes_size": 12312, - "http_referer": "https://10.0.0.1/some/referer", - "http_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36", - "proxy_alternative_upstream_name": "some-other-upstream-5000", - "proxy_upstream_name": "some-upstream-service-9000", - "remote_addr": "0.0.0.0", - "remote_user": "bob", - "req_id": "752178adb17130b291aefd8c386279e7", - "request": "GET /some/path HTTP/2.0", - "request_length": 462, - "request_time": 0.05, - "status": 200, - "timestamp": "2023-03-18T15:00:00Z", - "upstream_addr": "10.0.50.80:9000", - "upstream_response_length": 19437, - "upstream_response_time": 0.049, - "upstream_status": 200 - } - }, - { - "title": "Parse via Nginx log format (main)", - "source": "parse_nginx_log!(\n s'172.24.0.3 - alice [31/Dec/2024:17:32:06 +0000] \"GET / HTTP/1.1\" 200 615 \"https://domain.tld/path\" \"curl/8.11.1\" \"1.2.3.4, 10.10.1.1\"',\n \"main\"\n)\n", - "return": { - "body_bytes_size": 615, - "http_referer": "https://domain.tld/path", - "http_user_agent": "curl/8.11.1", - "http_x_forwarded_for": "1.2.3.4, 10.10.1.1", - "remote_addr": "172.24.0.3", - "remote_user": "alice", - "request": "GET / HTTP/1.1", - "status": 200, - "timestamp": "2024-12-31T17:32:06Z" - } - } - ], - "notices": [ - "Missing information in the log message may be indicated by `-`. These fields are\nomitted in the result.", - "In case of `ingress_upstreaminfo` format the following fields may be safely omitted\nin the log message: `remote_addr`, `remote_user`, `http_referer`, `http_user_agent`,\n`proxy_alternative_upstream_name`, `upstream_addr`, `upstream_response_length`,\n`upstream_response_time`, `upstream_status`." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_proto.cue b/website/cue/reference/remap/functions/parse_proto.cue deleted file mode 100644 index 8dbe92f9b1dd4..0000000000000 --- a/website/cue/reference/remap/functions/parse_proto.cue +++ /dev/null @@ -1,66 +0,0 @@ -{ - "remap": { - "functions": { - "parse_proto": { - "anchor": "parse_proto", - "name": "parse_proto", - "category": "Parse", - "description": "Parses the `value` as a protocol buffer payload.", - "arguments": [ - { - "name": "value", - "description": "The protocol buffer payload to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "desc_file", - "description": "The path to the protobuf descriptor set file. Must be a literal string.\n\nThis file is the output of protoc -o ...", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "message_type", - "description": "The name of the message type to use for serializing.\n\nMust be a literal string.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid proto payload.", - "`desc_file` file does not exist.", - "`message_type` message type does not exist in the descriptor file." - ], - "examples": [ - { - "title": "Parse proto", - "source": "parse_proto!(decode_base64!(\"Cgdzb21lb25lIggKBjEyMzQ1Ng==\"), \"test_protobuf.desc\", \"test_protobuf.v1.Person\")", - "return": { - "name": "someone", - "phones": [ - { - "number": "123456" - } - ] - } - } - ], - "notices": [ - "Only proto messages are parsed and returned." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_query_string.cue b/website/cue/reference/remap/functions/parse_query_string.cue deleted file mode 100644 index 760f59ea0c599..0000000000000 --- a/website/cue/reference/remap/functions/parse_query_string.cue +++ /dev/null @@ -1,63 +0,0 @@ -{ - "remap": { - "functions": { - "parse_query_string": { - "anchor": "parse_query_string", - "name": "parse_query_string", - "category": "Parse", - "description": "Parses the `value` as a query string.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Parse simple query string", - "source": "parse_query_string(\"foo=1&bar=2\")", - "return": { - "foo": "1", - "bar": "2" - } - }, - { - "title": "Parse query string", - "source": "parse_query_string(\"foo=%2B1&bar=2&bar=3&xyz\")", - "return": { - "bar": [ - "2", - "3" - ], - "foo": "+1", - "xyz": "" - } - }, - { - "title": "Parse Ruby on Rails' query string", - "source": "parse_query_string(\"?foo%5b%5d=1&foo%5b%5d=2\")", - "return": { - "foo[]": [ - "1", - "2" - ] - } - } - ], - "notices": [ - "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit. Empty keys and values are allowed." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_regex.cue b/website/cue/reference/remap/functions/parse_regex.cue deleted file mode 100644 index 9fa91d1018210..0000000000000 --- a/website/cue/reference/remap/functions/parse_regex.cue +++ /dev/null @@ -1,100 +0,0 @@ -{ - "remap": { - "functions": { - "parse_regex": { - "anchor": "parse_regex", - "name": "parse_regex", - "category": "Parse", - "description": "Parses the `value` using the provided [Regex](https://en.wikipedia.org/wiki/Regular_expression) `pattern`.\n\nThis function differs from the `parse_regex_all` function in that it returns only the first match.", - "arguments": [ - { - "name": "value", - "description": "The string to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "The regular expression pattern to search against.", - "required": true, - "type": [ - "regex" - ] - }, - { - "name": "numeric_groups", - "description": "If true, the index of each group in the regular expression is also captured. Index `0`\ncontains the whole match.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ], - "rules": [ - "Matches return all capture groups corresponding to the leftmost matches in the text.", - "Raises an error if no match is found." - ] - }, - "internal_failure_reasons": [ - "`value` fails to parse using the provided `pattern`." - ], - "examples": [ - { - "title": "Parse using Regex (with capture groups)", - "source": "parse_regex!(\"first group and second group.\", r'(?P.*?) group')", - "return": { - "number": "first" - } - }, - { - "title": "Parse using Regex (without capture groups)", - "source": "parse_regex!(\"first group and second group.\", r'(\\w+) group', numeric_groups: true)", - "return": { - "0": "first group", - "1": "first" - } - }, - { - "title": "Parse using Regex with simple match", - "source": "parse_regex!(\"8.7.6.5 - zorp\", r'^(?P[\\w\\.]+) - (?P[\\w]+)')", - "return": { - "host": "8.7.6.5", - "user": "zorp" - } - }, - { - "title": "Parse using Regex with all numeric groups", - "source": "parse_regex!(\"8.7.6.5 - zorp\", r'^(?P[\\w\\.]+) - (?P[\\w]+)', numeric_groups: true)", - "return": { - "0": "8.7.6.5 - zorp", - "1": "8.7.6.5", - "2": "zorp", - "host": "8.7.6.5", - "user": "zorp" - } - }, - { - "title": "Parse using Regex with variables", - "source": "variable = r'^(?P[\\w\\.]+) - (?P[\\w]+)';\nparse_regex!(\"8.7.6.5 - zorp\", variable)\n", - "return": { - "host": "8.7.6.5", - "user": "zorp" - } - } - ], - "notices": [ - "VRL aims to provide purpose-specific [parsing functions](/docs/reference/vrl/functions/#parse-functions)\nfor common log formats. Before reaching for the `parse_regex` function, see if a VRL\n[`parse_*` function](/docs/reference/vrl/functions/#parse-functions) already exists\nfor your format. If not, we recommend\n[opening an issue](https://github.com/vectordotdev/vector/issues/new?labels=type%3A+new+feature)\nto request support for the desired format.", - "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_regex_all.cue b/website/cue/reference/remap/functions/parse_regex_all.cue deleted file mode 100644 index cba6e4f52dfd9..0000000000000 --- a/website/cue/reference/remap/functions/parse_regex_all.cue +++ /dev/null @@ -1,123 +0,0 @@ -{ - "remap": { - "functions": { - "parse_regex_all": { - "anchor": "parse_regex_all", - "name": "parse_regex_all", - "category": "Parse", - "description": "Parses the `value` using the provided [Regex](https://en.wikipedia.org/wiki/Regular_expression) `pattern`.\n\nThis function differs from the `parse_regex` function in that it returns _all_ matches, not just the first.", - "arguments": [ - { - "name": "value", - "description": "The string to search.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "pattern", - "description": "The regular expression pattern to search against.", - "required": true, - "type": [ - "regex" - ] - }, - { - "name": "numeric_groups", - "description": "If `true`, the index of each group in the regular expression is also captured. Index `0`\ncontains the whole match.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Matches return all capture groups corresponding to the leftmost matches in the text.", - "Raises an error if no match is found." - ] - }, - "internal_failure_reasons": [ - "`value` is not a string.", - "`pattern` is not a regex." - ], - "examples": [ - { - "title": "Parse using Regex (all matches)", - "source": "parse_regex_all!(\"first group and second group.\", r'(?P\\w+) group', numeric_groups: true)", - "return": [ - { - "number": "first", - "0": "first group", - "1": "first" - }, - { - "number": "second", - "0": "second group", - "1": "second" - } - ] - }, - { - "title": "Parse using Regex (simple match)", - "source": "parse_regex_all!(\"apples and carrots, peaches and peas\", r'(?P[\\w\\.]+) and (?P[\\w]+)')", - "return": [ - { - "fruit": "apples", - "veg": "carrots" - }, - { - "fruit": "peaches", - "veg": "peas" - } - ] - }, - { - "title": "Parse using Regex (all numeric groups)", - "source": "parse_regex_all!(\"apples and carrots, peaches and peas\", r'(?P[\\w\\.]+) and (?P[\\w]+)', numeric_groups: true)", - "return": [ - { - "fruit": "apples", - "veg": "carrots", - "0": "apples and carrots", - "1": "apples", - "2": "carrots" - }, - { - "fruit": "peaches", - "veg": "peas", - "0": "peaches and peas", - "1": "peaches", - "2": "peas" - } - ] - }, - { - "title": "Parse using Regex with variables", - "source": "variable = r'(?P[\\w\\.]+) and (?P[\\w]+)';\nparse_regex_all!(\"apples and carrots, peaches and peas\", variable)\n", - "return": [ - { - "fruit": "apples", - "veg": "carrots" - }, - { - "fruit": "peaches", - "veg": "peas" - } - ] - } - ], - "notices": [ - "VRL aims to provide purpose-specific [parsing functions](/docs/reference/vrl/functions/#parse-functions)\nfor common log formats. Before reaching for the `parse_regex` function, see if a VRL\n[`parse_*` function](/docs/reference/vrl/functions/#parse-functions) already exists\nfor your format. If not, we recommend\n[opening an issue](https://github.com/vectordotdev/vector/issues/new?labels=type%3A+new+feature)\nto request support for the desired format.", - "All values are returned as strings. We recommend manually coercing values to desired\ntypes as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_ruby_hash.cue b/website/cue/reference/remap/functions/parse_ruby_hash.cue deleted file mode 100644 index 327c6a0edacae..0000000000000 --- a/website/cue/reference/remap/functions/parse_ruby_hash.cue +++ /dev/null @@ -1,48 +0,0 @@ -{ - "remap": { - "functions": { - "parse_ruby_hash": { - "anchor": "parse_ruby_hash", - "name": "parse_ruby_hash", - "category": "Parse", - "description": "Parses the `value` as ruby hash.", - "arguments": [ - { - "name": "value", - "description": "The string representation of the ruby hash to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid ruby hash formatted payload." - ], - "examples": [ - { - "title": "Parse ruby hash", - "source": "parse_ruby_hash!(s'{ \"test\" => \"value\", \"testNum\" => 0.2, \"testObj\" => { \"testBool\" => true, \"testNull\" => nil } }')", - "return": { - "test": "value", - "testNum": 0.2, - "testObj": { - "testBool": true, - "testNull": null - } - } - } - ], - "notices": [ - "Only ruby types are returned. If you need to convert a `string` into a `timestamp`,\nconsider the [`parse_timestamp`](#parse_timestamp) function." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_syslog.cue b/website/cue/reference/remap/functions/parse_syslog.cue deleted file mode 100644 index 900d7b7419242..0000000000000 --- a/website/cue/reference/remap/functions/parse_syslog.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "parse_syslog": { - "anchor": "parse_syslog", - "name": "parse_syslog", - "category": "Parse", - "description": "Parses the `value` in [Syslog](https://en.wikipedia.org/wiki/Syslog) format.", - "arguments": [ - { - "name": "value", - "description": "The text containing the Syslog message to parse.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted Syslog message." - ], - "examples": [ - { - "title": "Parse Syslog log (5424)", - "source": "parse_syslog!(s'<13>1 2020-03-13T20:45:38.119Z dynamicwireless.name non 2426 ID931 [exampleSDID@32473 iut=\"3\" eventSource= \"Application\" eventID=\"1011\"] Try to override the THX port, maybe it will reboot the neural interface!')", - "return": { - "appname": "non", - "exampleSDID@32473": { - "eventID": "1011", - "eventSource": "Application", - "iut": "3" - }, - "facility": "user", - "hostname": "dynamicwireless.name", - "message": "Try to override the THX port, maybe it will reboot the neural interface!", - "msgid": "ID931", - "procid": 2426, - "severity": "notice", - "timestamp": "2020-03-13T20:45:38.119Z", - "version": 1 - } - } - ], - "notices": [ - "The function makes a best effort to parse the various Syslog formats that exists out\nin the wild. This includes [RFC 6587](https://tools.ietf.org/html/rfc6587),\n[RFC 5424](https://tools.ietf.org/html/rfc5424),\n[RFC 3164](https://tools.ietf.org/html/rfc3164), and other common variations (such\nas the Nginx Syslog style).", - "All values are returned as strings. We recommend manually coercing values to desired types as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_timestamp.cue b/website/cue/reference/remap/functions/parse_timestamp.cue deleted file mode 100644 index b51702e8c5a05..0000000000000 --- a/website/cue/reference/remap/functions/parse_timestamp.cue +++ /dev/null @@ -1,61 +0,0 @@ -{ - "remap": { - "functions": { - "parse_timestamp": { - "anchor": "parse_timestamp", - "name": "parse_timestamp", - "category": "Parse", - "description": "Parses the `value` in [strptime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) `format`.", - "arguments": [ - { - "name": "value", - "description": "The text of the timestamp.", - "required": true, - "type": [ - "string", - "timestamp" - ] - }, - { - "name": "format", - "description": "The [strptime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers) format.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "timezone", - "description": "The [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format. By default, this function parses the timestamp by global [`timezone` option](/docs/reference/configuration//global-options#timezone).\nThis argument overwrites the setting and is useful for parsing timestamps without a specified timezone, such as `16/10/2019 12:00:00`.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "timestamp" - ] - }, - "internal_failure_reasons": [ - "`value` fails to parse using the provided `format`.", - "`value` fails to parse using the provided `timezone`." - ], - "examples": [ - { - "title": "Parse timestamp", - "source": "parse_timestamp!(\"10-Oct-2020 16:00+00:00\", format: \"%v %R %:z\")", - "return": "t'2020-10-10T16:00:00Z'" - }, - { - "title": "Parse timestamp with timezone", - "source": "parse_timestamp!(\"16/10/2019 12:00:00\", format: \"%d/%m/%Y %H:%M:%S\", timezone: \"Asia/Taipei\")", - "return": "t'2019-10-16T04:00:00Z'" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_tokens.cue b/website/cue/reference/remap/functions/parse_tokens.cue deleted file mode 100644 index 126261d0f1c97..0000000000000 --- a/website/cue/reference/remap/functions/parse_tokens.cue +++ /dev/null @@ -1,47 +0,0 @@ -{ - "remap": { - "functions": { - "parse_tokens": { - "anchor": "parse_tokens", - "name": "parse_tokens", - "category": "Parse", - "description": "Parses the `value` in token format. A token is considered to be one of the following:\n\n* A word surrounded by whitespace.\n* Text delimited by double quotes: `\"..\"`. Quotes can be included in the token if they are escaped by a backslash (`\\`).\n* Text delimited by square brackets: `[..]`. Closing square brackets can be included in the token if they are escaped by a backslash (`\\`).", - "arguments": [ - { - "name": "value", - "description": "The string to tokenize.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted tokenized string." - ], - "examples": [ - { - "title": "Parse tokens", - "source": "parse_tokens(s'A sentence \"with \\\"a\\\" sentence inside\" and [some brackets]')", - "return": [ - "A", - "sentence", - "with \\\"a\\\" sentence inside", - "and", - "some brackets" - ] - } - ], - "notices": [ - "All token values are returned as strings. We recommend manually coercing values to\ndesired types as you see fit." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_url.cue b/website/cue/reference/remap/functions/parse_url.cue deleted file mode 100644 index 3014441fba4ed..0000000000000 --- a/website/cue/reference/remap/functions/parse_url.cue +++ /dev/null @@ -1,72 +0,0 @@ -{ - "remap": { - "functions": { - "parse_url": { - "anchor": "parse_url", - "name": "parse_url", - "category": "Parse", - "description": "Parses the `value` in [URL](https://en.wikipedia.org/wiki/URL) format.", - "arguments": [ - { - "name": "value", - "description": "The text of the URL.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "default_known_ports", - "description": "If true and the port number is not specified in the input URL\nstring (or matches the default port for the scheme), it is\npopulated from well-known ports for the following schemes:\n`http`, `https`, `ws`, `wss`, and `ftp`.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a properly formatted URL." - ], - "examples": [ - { - "title": "Parse URL", - "source": "parse_url!(\"ftp://foo:bar@example.com:4343/foobar?hello=world#123\")", - "return": { - "fragment": "123", - "host": "example.com", - "password": "bar", - "path": "/foobar", - "port": 4343, - "query": { - "hello": "world" - }, - "scheme": "ftp", - "username": "foo" - } - }, - { - "title": "Parse URL with default port", - "source": "parse_url!(\"https://example.com\", default_known_ports: true)", - "return": { - "fragment": null, - "host": "example.com", - "password": "", - "path": "/", - "port": 443, - "query": {}, - "scheme": "https", - "username": "" - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_user_agent.cue b/website/cue/reference/remap/functions/parse_user_agent.cue deleted file mode 100644 index 92c8ce01d640d..0000000000000 --- a/website/cue/reference/remap/functions/parse_user_agent.cue +++ /dev/null @@ -1,110 +0,0 @@ -{ - "remap": { - "functions": { - "parse_user_agent": { - "anchor": "parse_user_agent", - "name": "parse_user_agent", - "category": "Parse", - "description": "Parses the provided `value` as a user agent, which has\n[a loosely defined format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).\n\nParses on the basis of best effort. Returned schema depends only on the configured `mode`,\nso if the function fails to parse a field it will set it to `null`.", - "arguments": [ - { - "name": "value", - "description": "The string to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "mode", - "description": "Determines performance and reliability characteristics.", - "required": false, - "type": [ - "string" - ], - "enum": { - "fast": "Fastest mode but most unreliable. Uses parser from project [Woothee](https://github.com/woothee/woothee).", - "reliable": "Provides greater reliability than `fast` and retains it's speed in common cases.\nParses with [Woothee](https://github.com/woothee/woothee) parser and with parser from\n[uap project](https://github.com/ua-parser/uap-core) if there are some missing fields\nthat the first parser wasn't able to parse out but the second one maybe can.\n", - "enriched": "Parses with both parser from [Woothee](https://github.com/woothee/woothee) and parser from\n[uap project](https://github.com/ua-parser/uap-core) and combines results. Result has the full schema.\n" - }, - "default": "fast" - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Fast mode", - "source": "parse_user_agent(\n \"Mozilla Firefox 1.0.1 Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.6) Gecko/20050223 Firefox/1.0.1\"\n)\n", - "return": { - "browser": { - "family": "Firefox", - "version": "1.0.1" - }, - "device": { - "category": "pc" - }, - "os": { - "family": "Linux", - "version": null - } - } - }, - { - "title": "Reliable mode", - "source": "parse_user_agent(\n \"Mozilla/4.0 (compatible; MSIE 7.66; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\",\n mode: \"reliable\")\n", - "return": { - "browser": { - "family": "Internet Explorer", - "version": "7.66" - }, - "device": { - "category": "pc" - }, - "os": { - "family": "Windows XP", - "version": "NT 5.1" - } - } - }, - { - "title": "Enriched mode", - "source": "parse_user_agent(\n \"Opera/9.80 (J2ME/MIDP; Opera Mini/4.3.24214; iPhone; CPU iPhone OS 4_2_1 like Mac OS X; AppleWebKit/24.783; U; en) Presto/2.5.25 Version/10.54\",\n mode: \"enriched\"\n)\n", - "return": { - "browser": { - "family": "Opera Mini", - "major": "4", - "minor": "3", - "patch": "24214", - "version": "10.54" - }, - "device": { - "brand": "Apple", - "category": "smartphone", - "family": "iPhone", - "model": "iPhone" - }, - "os": { - "family": "iOS", - "major": "4", - "minor": "2", - "patch": "1", - "patch_minor": null, - "version": "4.2.1" - } - } - } - ], - "notices": [ - "All values are returned as strings or as null. We recommend manually coercing values\nto desired types as you see fit.", - "Different modes return different schema.", - "Field which were not parsed out are set as `null`." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/parse_xml.cue b/website/cue/reference/remap/functions/parse_xml.cue deleted file mode 100644 index 19c793edff73f..0000000000000 --- a/website/cue/reference/remap/functions/parse_xml.cue +++ /dev/null @@ -1,123 +0,0 @@ -{ - "remap": { - "functions": { - "parse_xml": { - "anchor": "parse_xml", - "name": "parse_xml", - "category": "Parse", - "description": "Parses the `value` as XML.", - "arguments": [ - { - "name": "value", - "description": "The string representation of the XML document to parse.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "trim", - "description": "Remove excess whitespace between XML elements.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "include_attr", - "description": "Include XML tag attributes in the returned object.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "attr_prefix", - "description": "String prefix to use for XML tag attribute keys.", - "required": false, - "type": [ - "string" - ], - "default": "@" - }, - { - "name": "text_key", - "description": "Key name to use for expanded text nodes.", - "required": false, - "type": [ - "string" - ], - "default": "text" - }, - { - "name": "always_use_text_key", - "description": "Always return text nodes as `{\"\": \"value\"}.`", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - }, - { - "name": "parse_bool", - "description": "Parse \"true\" and \"false\" as boolean.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "parse_null", - "description": "Parse \"null\" as null.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - }, - { - "name": "parse_number", - "description": "Parse numbers as integers/floats.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "object" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid XML document." - ], - "examples": [ - { - "title": "Parse XML", - "source": "value = s'Harry PotterJ K. Rowling2005';\n\nparse_xml!(value, text_key: \"value\", parse_number: false)\n", - "return": { - "book": { - "@category": "CHILDREN", - "author": "J K. Rowling", - "title": { - "@lang": "en", - "value": "Harry Potter" - }, - "year": "2005" - } - } - } - ], - "notices": [ - "Valid XML must contain exactly one root node. Always returns an object." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/pascalcase.cue b/website/cue/reference/remap/functions/pascalcase.cue deleted file mode 100644 index ed70ec52f2307..0000000000000 --- a/website/cue/reference/remap/functions/pascalcase.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "pascalcase": { - "anchor": "pascalcase", - "name": "pascalcase", - "category": "String", - "description": "Takes the `value` string, and turns it into PascalCase. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to PascalCase.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "original_case", - "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", - "required": false, - "type": [ - "string" - ], - "enum": { - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" - } - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "PascalCase a string without specifying original case", - "source": "pascalcase(\"input-string\")", - "return": "InputString" - }, - { - "title": "PascalCase a snake_case string", - "source": "pascalcase(\"foo_bar_baz\", \"snake_case\")", - "return": "FooBarBaz" - }, - { - "title": "PascalCase specifying the wrong original case (only capitalizes)", - "source": "pascalcase(\"foo_bar_baz\", \"kebab-case\")", - "return": "Foo_bar_baz" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/pop.cue b/website/cue/reference/remap/functions/pop.cue deleted file mode 100644 index 938735847dda2..0000000000000 --- a/website/cue/reference/remap/functions/pop.cue +++ /dev/null @@ -1,41 +0,0 @@ -{ - "remap": { - "functions": { - "pop": { - "anchor": "pop", - "name": "pop", - "category": "Array", - "description": "Removes the last item from the `value` array.", - "arguments": [ - { - "name": "value", - "description": "The target array.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "The original `value` is not modified." - ] - }, - "examples": [ - { - "title": "Pop an item from an array", - "source": "pop([1, 2, 3])", - "return": [ - 1, - 2 - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/push.cue b/website/cue/reference/remap/functions/push.cue deleted file mode 100644 index 65b08e3f43ca9..0000000000000 --- a/website/cue/reference/remap/functions/push.cue +++ /dev/null @@ -1,57 +0,0 @@ -{ - "remap": { - "functions": { - "push": { - "anchor": "push", - "name": "push", - "category": "Array", - "description": "Adds the `item` to the end of the `value` array.", - "arguments": [ - { - "name": "value", - "description": "The target array.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "item", - "description": "The item to push.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Returns a new array. The `value` is _not_ modified in place." - ] - }, - "examples": [ - { - "title": "Push an item onto an array", - "source": "push([1, 2], 3)", - "return": [ - 1, - 2, - 3 - ] - }, - { - "title": "Empty array", - "source": "push([], \"bar\")", - "return": [ - "bar" - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/random_bool.cue b/website/cue/reference/remap/functions/random_bool.cue deleted file mode 100644 index fc881cf0b0cb5..0000000000000 --- a/website/cue/reference/remap/functions/random_bool.cue +++ /dev/null @@ -1,26 +0,0 @@ -{ - "remap": { - "functions": { - "random_bool": { - "anchor": "random_bool", - "name": "random_bool", - "category": "Random", - "description": "Returns a random boolean.", - "arguments": [], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "Random boolean", - "source": "is_boolean(random_bool())", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/random_bytes.cue b/website/cue/reference/remap/functions/random_bytes.cue deleted file mode 100644 index c86937d9bfa26..0000000000000 --- a/website/cue/reference/remap/functions/random_bytes.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "random_bytes": { - "anchor": "random_bytes", - "name": "random_bytes", - "category": "Random", - "description": "A cryptographically secure random number generator. Returns a string value containing the number of random bytes requested.", - "arguments": [ - { - "name": "length", - "description": "The number of bytes to generate. Must not be larger than 64k.", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`length` is negative.", - "`length` is larger than the maximum value (64k)." - ], - "examples": [ - { - "title": "Generate random base 64 encoded bytes", - "source": "encode_base64(random_bytes(16))", - "return": "LNu0BBgUbh7XAlXbjSOomQ==" - }, - { - "title": "Generate 16 random bytes", - "source": "length(random_bytes(16))", - "return": 16 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/random_float.cue b/website/cue/reference/remap/functions/random_float.cue deleted file mode 100644 index 442bd341e481d..0000000000000 --- a/website/cue/reference/remap/functions/random_float.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "random_float": { - "anchor": "random_float", - "name": "random_float", - "category": "Random", - "description": "Returns a random float between [min, max).", - "arguments": [ - { - "name": "min", - "description": "Minimum value (inclusive).", - "required": true, - "type": [ - "float" - ] - }, - { - "name": "max", - "description": "Maximum value (exclusive).", - "required": true, - "type": [ - "float" - ] - } - ], - "return": { - "types": [ - "float" - ] - }, - "internal_failure_reasons": [ - "`max` is not greater than `min`." - ], - "examples": [ - { - "title": "Random float from 0.0 to 10.0, not including 10.0", - "source": "f = random_float(0.0, 10.0)\nf >= 0 && f < 10\n", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/random_int.cue b/website/cue/reference/remap/functions/random_int.cue deleted file mode 100644 index 785eec58b5c18..0000000000000 --- a/website/cue/reference/remap/functions/random_int.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "random_int": { - "anchor": "random_int", - "name": "random_int", - "category": "Random", - "description": "Returns a random integer between [min, max).", - "arguments": [ - { - "name": "min", - "description": "Minimum value (inclusive).", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "max", - "description": "Maximum value (exclusive).", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "internal_failure_reasons": [ - "`max` is not greater than `min`." - ], - "examples": [ - { - "title": "Random integer from 0 to 10, not including 10", - "source": "i = random_int(0, 10)\ni >= 0 && i < 10\n", - "return": true - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/redact.cue b/website/cue/reference/remap/functions/redact.cue deleted file mode 100644 index 5e9076a1d2543..0000000000000 --- a/website/cue/reference/remap/functions/redact.cue +++ /dev/null @@ -1,84 +0,0 @@ -{ - "remap": { - "functions": { - "redact": { - "anchor": "redact", - "name": "redact", - "category": "String", - "description": "Redact sensitive data in `value` such as:\n\n- [US social security card numbers](https://www.ssa.gov/history/ssn/geocard.html)\n- Other forms of personally identifiable information with custom patterns\n\nThis can help achieve compliance by ensuring sensitive data does not leave your network.", - "arguments": [ - { - "name": "value", - "description": "The value to redact sensitive data from.\n\nThe function's behavior depends on `value`'s type:\n\n- For strings, the sensitive data is redacted and a new string is returned.\n- For arrays, the sensitive data is redacted in each string element.\n- For objects, the sensitive data in each string value is masked, but the keys are not masked.\n\nFor arrays and objects, the function recurses into any nested arrays or objects. Any non-string elements are\nskipped.\n\nRedacted text is replaced with `[REDACTED]`.", - "required": true, - "type": [ - "string", - "object", - "array" - ] - }, - { - "name": "filters", - "description": "List of filters applied to `value`.\n\nEach filter can be specified in the following ways:\n\n- As a regular expression, which is used to redact text that match it.\n- As an object with a `type` key that corresponds to a named filter and additional keys for customizing that filter.\n- As a named filter, if it has no required parameters.\n\nNamed filters can be a:\n\n- `pattern`: Redacts text matching any regular expressions specified in the `patterns`\n\tkey, which is required. This is the expanded version of just passing a regular expression as a filter.\n- `us_social_security_number`: Redacts US social security card numbers.\n\nSee examples for more details.\n\nThis parameter must be a static expression so that the argument can be validated at compile-time\nto avoid runtime errors. You cannot use variables or other dynamic expressions with it.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "redactor", - "description": "Specifies what to replace the redacted strings with.\n\nIt is given as an object with a \"type\" key specifying the type of redactor to use\nand additional keys depending on the type. The following types are supported:\n\n- `full`: The default. Replace with the string \"[REDACTED]\".\n- `text`: Replace with a custom string. The `replacement` key is required, and must\n contain the string that is used as a replacement.\n- `sha2`: Hash the redacted text with SHA-2 as with [`sha2`](https://en.wikipedia.org/wiki/SHA-2). Supports two optional parameters:\n\t- `variant`: The variant of the algorithm to use. Defaults to SHA-512/256.\n\t- `encoding`: How to encode the hash as text. Can be base16 or base64.\n\t\tDefaults to base64.\n- `sha3`: Hash the redacted text with SHA-3 as with [`sha3`](https://en.wikipedia.org/wiki/SHA-3). Supports two optional parameters:\n\t- `variant`: The variant of the algorithm to use. Defaults to SHA3-512.\n\t- `encoding`: How to encode the hash as text. Can be base16 or base64.\n\t\tDefaults to base64.\n\n\nAs a convenience you can use a string as a shorthand for common redactor patterns:\n\n- `\"full\"` is equivalent to `{\"type\": \"full\"}`\n- `\"sha2\"` is equivalent to `{\"type\": \"sha2\", \"variant\": \"SHA-512/256\", \"encoding\": \"base64\"}`\n- `\"sha3\"` is equivalent to `{\"type\": \"sha3\", \"variant\": \"SHA3-512\", \"encoding\": \"base64\"}`\n\nThis parameter must be a static expression so that the argument can be validated at compile-time\nto avoid runtime errors. You cannot use variables or other dynamic expressions with it.", - "required": false, - "type": [ - "string", - "object" - ] - } - ], - "return": { - "types": [ - "string", - "object", - "array" - ] - }, - "examples": [ - { - "title": "Replace text using a regex", - "source": "redact(\"my id is 123456\", filters: [r'\\d+'])", - "return": "my id is [REDACTED]" - }, - { - "title": "Replace us social security numbers in any field", - "source": "redact({ \"name\": \"John Doe\", \"ssn\": \"123-12-1234\"}, filters: [\"us_social_security_number\"])", - "return": { - "name": "John Doe", - "ssn": "[REDACTED]" - } - }, - { - "title": "Replace with custom text", - "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: {\"type\": \"text\", \"replacement\": \"***\"})", - "return": "my id is ***" - }, - { - "title": "Replace with SHA-2 hash", - "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: \"sha2\")", - "return": "my id is GEtTedW1p6tC094dDKH+3B8P+xSnZz69AmpjaXRd63I=" - }, - { - "title": "Replace with SHA-3 hash", - "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: \"sha3\")", - "return": "my id is ZNCdmTDI7PeeUTFnpYjLdUObdizo+bIupZdl8yqnTKGdLx6X3JIqPUlUWUoFBikX+yTR+OcvLtAqWO11NPlNJw==" - }, - { - "title": "Replace with SHA-256 hash using hex encoding", - "source": "redact(\"my id is 123456\", filters: [r'\\d+'], redactor: {\"type\": \"sha2\", \"variant\": \"SHA-256\", \"encoding\": \"base16\"})", - "return": "my id is 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/remove.cue b/website/cue/reference/remap/functions/remove.cue deleted file mode 100644 index bd6d0082d39dd..0000000000000 --- a/website/cue/reference/remap/functions/remove.cue +++ /dev/null @@ -1,137 +0,0 @@ -{ - "remap": { - "functions": { - "remove": { - "anchor": "remove", - "name": "remove", - "category": "Path", - "description": "Dynamically remove the value for a given path.\n\nIf you know the path you want to remove, use\nthe `del` function and static paths such as `del(.foo.bar[1])`\nto remove the value at that path. The `del` function returns the\ndeleted value, and is more performant than `remove`.\nHowever, if you do not know the path names, use the dynamic\n`remove` function to remove the value at the provided path.", - "arguments": [ - { - "name": "value", - "description": "The object or array to remove data from.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "path", - "description": "An array of path segments to remove the value from.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "compact", - "description": "After deletion, if `compact` is `true`, any empty objects or\narrays left are also removed.", - "required": false, - "type": [ - "boolean" - ], - "default": "false" - } - ], - "return": { - "types": [ - "object", - "array" - ] - }, - "internal_failure_reasons": [ - "The `path` segment must be a string or an integer." - ], - "examples": [ - { - "title": "Single-segment top-level field", - "source": "remove!(value: { \"foo\": \"bar\" }, path: [\"foo\"])", - "return": {} - }, - { - "title": "Remove unknown field", - "source": "remove!(value: {\"foo\": \"bar\"}, path: [\"baz\"])", - "return": { - "foo": "bar" - } - }, - { - "title": "Multi-segment nested field", - "source": "remove!(value: { \"foo\": { \"bar\": \"baz\" } }, path: [\"foo\", \"bar\"])", - "return": { - "foo": {} - } - }, - { - "title": "Array indexing", - "source": "remove!(value: [\"foo\", \"bar\", \"baz\"], path: [-2])", - "return": [ - "foo", - "baz" - ] - }, - { - "title": "Compaction", - "source": "remove!(value: { \"foo\": { \"bar\": [42], \"baz\": true } }, path: [\"foo\", \"bar\", 0], compact: true)", - "return": { - "foo": { - "baz": true - } - } - }, - { - "title": "Compact object", - "source": "remove!(value: {\"foo\": { \"bar\": true }}, path: [\"foo\", \"bar\"], compact: true)", - "return": {} - }, - { - "title": "Compact array", - "source": "remove!(value: {\"foo\": [42], \"bar\": true }, path: [\"foo\", 0], compact: true)", - "return": { - "bar": true - } - }, - { - "title": "External target", - "source": "remove!(value: ., path: [\"foo\"])", - "input": { - "foo": true - }, - "return": {} - }, - { - "title": "Variable", - "source": "var = { \"foo\": true }\nremove!(value: var, path: [\"foo\"])\n", - "return": {} - }, - { - "title": "Missing index", - "source": "remove!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", \"bar\", 1, -1])", - "return": { - "foo": { - "bar": [ - 92, - 42 - ] - } - } - }, - { - "title": "Invalid indexing", - "source": "remove!(value: [42], path: [\"foo\"])", - "return": [ - 42 - ] - }, - { - "title": "Invalid segment type", - "source": "remove!(value: {\"foo\": { \"bar\": [92, 42] }}, path: [\"foo\", true])", - "raises": "function call error for \"remove\" at (0:65): path segment must be either string or integer, not boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/remove_secret.cue b/website/cue/reference/remap/functions/remove_secret.cue deleted file mode 100644 index 7d274ef5e96d3..0000000000000 --- a/website/cue/reference/remap/functions/remove_secret.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "remove_secret": { - "anchor": "remove_secret", - "name": "remove_secret", - "category": "Event", - "description": "Removes a secret from an event.", - "arguments": [ - { - "name": "key", - "description": "The name of the secret to remove.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "null" - ] - }, - "examples": [ - { - "title": "Remove the datadog api key", - "source": "remove_secret(\"datadog_api_key\")", - "return": null - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/replace.cue b/website/cue/reference/remap/functions/replace.cue deleted file mode 100644 index ca0956c2ff9a9..0000000000000 --- a/website/cue/reference/remap/functions/replace.cue +++ /dev/null @@ -1,81 +0,0 @@ -{ - "remap": { - "functions": { - "replace": { - "anchor": "replace", - "name": "replace", - "category": "String", - "description": "Replaces all matching instances of `pattern` in `value`.\n\nThe `pattern` argument accepts regular expression capture groups.\n\n**Note when using capture groups**:\n- You will need to escape the `$` by using `$$` to avoid Vector interpreting it as an\n [environment variable when loading configuration](/docs/reference/environment_variables/#escaping)\n- If you want a literal `$` in the replacement pattern, you will also need to escape this\n with `$$`. When combined with environment variable interpolation in config files this\n means you will need to use `$$$$` to have a literal `$` in the replacement pattern.", - "arguments": [ - { - "name": "value", - "description": "The original string.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "Replace all matches of this pattern. Can be a static string or a regular expression.", - "required": true, - "type": [ - "string", - "regex" - ] - }, - { - "name": "with", - "description": "The string that the matches are replaced with.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "count", - "description": "The maximum number of replacements to perform. `-1` means replace all matches.", - "required": false, - "type": [ - "integer" - ], - "default": "-1" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Replace literal text", - "source": "replace(\"Apples and Bananas\", \"and\", \"not\")", - "return": "Apples not Bananas" - }, - { - "title": "Replace using regular expression", - "source": "replace(\"Apples and Bananas\", r'(?i)bananas', \"Pineapples\")", - "return": "Apples and Pineapples" - }, - { - "title": "Replace first instance", - "source": "replace(\"Bananas and Bananas\", \"Bananas\", \"Pineapples\", count: 1)", - "return": "Pineapples and Bananas" - }, - { - "title": "Replace with capture groups", - "source": "# Note that in the context of Vector configuration files, an extra `$` escape character is required\n# (i.e. `$$num`) to avoid interpreting `num` as an environment variable.\nreplace(\"foo123bar\", r'foo(?P\\d+)bar', \"$num\")\n", - "return": "123" - }, - { - "title": "Replace all", - "source": "replace(\"foobar\", \"o\", \"i\")", - "return": "fiibar" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/replace_with.cue b/website/cue/reference/remap/functions/replace_with.cue deleted file mode 100644 index a6e506a18a4a8..0000000000000 --- a/website/cue/reference/remap/functions/replace_with.cue +++ /dev/null @@ -1,77 +0,0 @@ -{ - "remap": { - "functions": { - "replace_with": { - "anchor": "replace_with", - "name": "replace_with", - "category": "String", - "description": "Replaces all matching instances of `pattern` using a closure.\n\nThe `pattern` argument accepts a regular expression that can use capture groups.\n\nThe function uses the function closure syntax to compute the replacement values.\n\nThe closure takes a single parameter, which is an array, where the first item is always\npresent and contains the entire string that matched `pattern`. The items from index one on\ncontain the capture groups of the corresponding index. If a capture group is optional, the\nvalue may be null if it didn't match.\n\nThe value returned by the closure must be a string and will replace the section of\nthe input that was matched.\n\nThis returns a new string with the replacements, the original string is not mutated.", - "arguments": [ - { - "name": "value", - "description": "The original string.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "Replace all matches of this pattern. Must be a regular expression.", - "required": true, - "type": [ - "regex" - ] - }, - { - "name": "count", - "description": "The maximum number of replacements to perform. `-1` means replace all matches.", - "required": false, - "type": [ - "integer" - ], - "default": "-1" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Capitalize words", - "source": "replace_with(\"apples and bananas\", r'\\b(\\w)(\\w*)') -> |match| {\n upcase!(match.captures[0]) + string!(match.captures[1])\n}\n", - "return": "Apples And Bananas" - }, - { - "title": "Replace with hash", - "source": "replace_with(\"email from test@example.com\", r'\\w+@example.com') -> |match| {\n sha2(match.string, variant: \"SHA-512/224\")\n}\n", - "return": "email from adf6e1bc4415d24912bd93072ad34ef825a7b6eb3bf53f68def1fc17" - }, - { - "title": "Replace first instance", - "source": "replace_with(\"Apples and Apples\", r'(?i)apples|cones', count: 1) -> |match| {\n \"Pine\" + downcase(match.string)\n}\n", - "return": "Pineapples and Apples" - }, - { - "title": "Named capture group", - "source": "replace_with(\"level=error A message\", r'level=(?P\\w+)') -> |match| {\n lvl = upcase!(match.level)\n \"[{{lvl}}]\"\n}\n", - "return": "[ERROR] A message" - }, - { - "title": "Replace with processed capture group", - "source": "replace_with(s'Got message: {\"msg\": \"b\"}', r'message: (\\{.*\\})') -> |m| {\n to_string!(parse_json!(m.captures[0]).msg)\n}\n", - "return": "Got b" - }, - { - "title": "Replace with optional capture group", - "source": "replace_with(\"bar of chocolate and bar of gold\", r'bar( of gold)?') -> |m| {\n if m.captures[0] == null { \"pile\" } else { \"money\" }\n}\n", - "return": "pile of chocolate and money" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/reverse_dns.cue b/website/cue/reference/remap/functions/reverse_dns.cue deleted file mode 100644 index 00777d4ea6af1..0000000000000 --- a/website/cue/reference/remap/functions/reverse_dns.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "reverse_dns": { - "anchor": "reverse_dns", - "name": "reverse_dns", - "category": "System", - "description": "Performs a reverse DNS lookup on the provided IP address to retrieve the associated hostname.", - "arguments": [ - { - "name": "value", - "description": "The IP address (IPv4 or IPv6) to perform the reverse DNS lookup on.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Example", - "source": "reverse_dns!(\"127.0.0.1\")", - "return": "localhost" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/round.cue b/website/cue/reference/remap/functions/round.cue deleted file mode 100644 index 76508c132c214..0000000000000 --- a/website/cue/reference/remap/functions/round.cue +++ /dev/null @@ -1,64 +0,0 @@ -{ - "remap": { - "functions": { - "round": { - "anchor": "round", - "name": "round", - "category": "Number", - "description": "Rounds the `value` to the specified `precision`.", - "arguments": [ - { - "name": "value", - "description": "The number to round.", - "required": true, - "type": [ - "integer", - "float" - ] - }, - { - "name": "precision", - "description": "The number of decimal places to round to.", - "required": false, - "type": [ - "integer" - ], - "default": "0" - } - ], - "return": { - "types": [ - "integer", - "float" - ], - "rules": [ - "If `precision` is `0`, then an integer is returned, otherwise a float is returned." - ] - }, - "examples": [ - { - "title": "Round a number (without precision)", - "source": "round(4.345)", - "return": 4.0 - }, - { - "title": "Round a number (with precision)", - "source": "round(4.345, precision: 2)", - "return": 4.35 - }, - { - "title": "Round up", - "source": "round(5.5)", - "return": 6.0 - }, - { - "title": "Round down", - "source": "round(5.45)", - "return": 5.0 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/screamingsnakecase.cue b/website/cue/reference/remap/functions/screamingsnakecase.cue deleted file mode 100644 index 81cb29c9dd768..0000000000000 --- a/website/cue/reference/remap/functions/screamingsnakecase.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "screamingsnakecase": { - "anchor": "screamingsnakecase", - "name": "screamingsnakecase", - "category": "String", - "description": "Takes the `value` string, and turns it into SCREAMING_SNAKE case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to SCREAMING_SNAKE case.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "original_case", - "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", - "required": false, - "type": [ - "string" - ], - "enum": { - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" - } - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "SCREAMING_SNAKE_CASE a string without specifying original case", - "source": "screamingsnakecase(\"input-string\")", - "return": "INPUT_STRING" - }, - { - "title": "SCREAMING_SNAKE_CASE a snake_case string", - "source": "screamingsnakecase(\"foo_bar_baz\", \"snake_case\")", - "return": "FOO_BAR_BAZ" - }, - { - "title": "SCREAMING_SNAKE_CASE specifying the wrong original case (capitalizes but doesn't include `_` properly)", - "source": "screamingsnakecase(\"FooBarBaz\", \"kebab-case\")", - "return": "FOOBARBAZ" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/seahash.cue b/website/cue/reference/remap/functions/seahash.cue deleted file mode 100644 index 57967f696f9a0..0000000000000 --- a/website/cue/reference/remap/functions/seahash.cue +++ /dev/null @@ -1,40 +0,0 @@ -{ - "remap": { - "functions": { - "seahash": { - "anchor": "seahash", - "name": "seahash", - "category": "Cryptography", - "description": "Calculates a [Seahash](https://docs.rs/seahash/latest/seahash/) hash of the `value`.\n**Note**: Due to limitations in the underlying VRL data types, this function converts the unsigned 64-bit integer SeaHash result to a signed 64-bit integer. Results higher than the signed 64-bit integer maximum value wrap around to negative values.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "examples": [ - { - "title": "Calculate seahash", - "source": "seahash(\"foobar\")", - "return": 5348458858952426560 - }, - { - "title": "Calculate negative seahash", - "source": "seahash(\"bar\")", - "return": -2796170501982571315 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/set.cue b/website/cue/reference/remap/functions/set.cue deleted file mode 100644 index f4cc64e9c8043..0000000000000 --- a/website/cue/reference/remap/functions/set.cue +++ /dev/null @@ -1,128 +0,0 @@ -{ - "remap": { - "functions": { - "set": { - "anchor": "set", - "name": "set", - "category": "Path", - "description": "Dynamically insert data into the path of a given object or array.\n\nIf you know the path you want to assign a value to,\nuse static path assignments such as `.foo.bar[1] = true` for\nimproved performance and readability. However, if you do not\nknow the path names, use the dynamic `set` function to\ninsert the data into the object or array.", - "arguments": [ - { - "name": "value", - "description": "The object or array to insert data into.", - "required": true, - "type": [ - "object", - "array" - ] - }, - { - "name": "path", - "description": "An array of path segments to insert the value into.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "data", - "description": "The data to be inserted.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "object", - "array" - ] - }, - "internal_failure_reasons": [ - "The `path` segment must be a string or an integer." - ], - "examples": [ - { - "title": "Single-segment top-level field", - "source": "set!(value: { \"foo\": \"bar\" }, path: [\"foo\"], data: \"baz\")", - "return": { - "foo": "baz" - } - }, - { - "title": "Multi-segment nested field", - "source": "set!(value: { \"foo\": { \"bar\": \"baz\" } }, path: [\"foo\", \"bar\"], data: \"qux\")", - "return": { - "foo": { - "bar": "qux" - } - } - }, - { - "title": "Array", - "source": "set!(value: [\"foo\", \"bar\", \"baz\"], path: [-2], data: 42)", - "return": [ - "foo", - 42, - "baz" - ] - }, - { - "title": "Nested fields", - "source": "set!(value: {}, path: [\"foo\", \"bar\"], data: \"baz\")", - "return": { - "foo": { - "bar": "baz" - } - } - }, - { - "title": "Nested indexing", - "source": "set!(value: {\"foo\": { \"bar\": [] }}, path: [\"foo\", \"bar\", 1], data: \"baz\")", - "return": { - "foo": { - "bar": [ - null, - "baz" - ] - } - } - }, - { - "title": "External target", - "source": "set!(value: ., path: [\"bar\"], data: \"baz\")", - "input": { - "foo": true - }, - "return": { - "foo": true, - "bar": "baz" - } - }, - { - "title": "Variable", - "source": "var = { \"foo\": true }\nset!(value: var, path: [\"bar\"], data: \"baz\")\n", - "return": { - "foo": true, - "bar": "baz" - } - }, - { - "title": "Invalid indexing", - "source": "set!(value: [], path: [\"foo\"], data: \"baz\")", - "return": { - "foo": "baz" - } - }, - { - "title": "Invalid segment type", - "source": "set!({\"foo\": { \"bar\": [92, 42] }}, [\"foo\", true], \"baz\")", - "raises": "function call error for \"set\" at (0:56): path segment must be either string or integer, not boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/set_secret.cue b/website/cue/reference/remap/functions/set_secret.cue deleted file mode 100644 index e6a263db96ea3..0000000000000 --- a/website/cue/reference/remap/functions/set_secret.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "set_secret": { - "anchor": "set_secret", - "name": "set_secret", - "category": "Event", - "description": "Sets the given secret in the event.", - "arguments": [ - { - "name": "key", - "description": "The name of the secret.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "secret", - "description": "The secret value.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "null" - ] - }, - "examples": [ - { - "title": "Set the datadog api key", - "source": "set_secret(\"datadog_api_key\", \"secret-value\")", - "return": null - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/set_semantic_meaning.cue b/website/cue/reference/remap/functions/set_semantic_meaning.cue deleted file mode 100644 index 77d120d630cb6..0000000000000 --- a/website/cue/reference/remap/functions/set_semantic_meaning.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "set_semantic_meaning": { - "anchor": "set_semantic_meaning", - "name": "set_semantic_meaning", - "category": "Event", - "description": "Sets a semantic meaning for an event.", - "arguments": [ - { - "name": "target", - "description": "The path of the value that is assigned a meaning.", - "required": true, - "type": [ - "any" - ] - }, - { - "name": "meaning", - "description": "The name of the meaning to assign.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "null" - ] - }, - "examples": [ - { - "title": "Sets custom field semantic meaning", - "source": "set_semantic_meaning(.foo, \"bar\")", - "return": null - } - ], - "notices": [ - "This function assigns meaning at startup, and has _no_ runtime behavior. It is suggested\nto put all calls to this function at the beginning of a VRL function. The function\ncannot be conditionally called. For example, using an if statement cannot stop the\nmeaning from being assigned." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/sha1.cue b/website/cue/reference/remap/functions/sha1.cue deleted file mode 100644 index 5be47941e74fb..0000000000000 --- a/website/cue/reference/remap/functions/sha1.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "sha1": { - "anchor": "sha1", - "name": "sha1", - "category": "Cryptography", - "description": "Calculates a [SHA-1](https://en.wikipedia.org/wiki/SHA-1) hash of the `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Calculate sha1 hash", - "source": "sha1(\"foo\")", - "return": "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/sha2.cue b/website/cue/reference/remap/functions/sha2.cue deleted file mode 100644 index 5a29325454060..0000000000000 --- a/website/cue/reference/remap/functions/sha2.cue +++ /dev/null @@ -1,62 +0,0 @@ -{ - "remap": { - "functions": { - "sha2": { - "anchor": "sha2", - "name": "sha2", - "category": "Cryptography", - "description": "Calculates a [SHA-2](https://en.wikipedia.org/wiki/SHA-2) hash of the `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "variant", - "description": "The variant of the algorithm to use.", - "required": false, - "type": [ - "string" - ], - "enum": { - "SHA-224": "SHA-224 algorithm", - "SHA-256": "SHA-256 algorithm", - "SHA-384": "SHA-384 algorithm", - "SHA-512": "SHA-512 algorithm", - "SHA-512/224": "SHA-512/224 algorithm", - "SHA-512/256": "SHA-512/256 algorithm" - }, - "default": "SHA-512/256" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Calculate sha2 hash using default variant", - "source": "sha2(\"foobar\")", - "return": "d014c752bc2be868e16330f47e0c316a5967bcbc9c286a457761d7055b9214ce" - }, - { - "title": "Calculate sha2 hash with SHA-512/224", - "source": "sha2(\"foo\", variant: \"SHA-512/224\")", - "return": "d68f258d37d670cfc1ec1001a0394784233f88f056994f9a7e5e99be" - }, - { - "title": "Calculate sha2 hash with SHA-384", - "source": "sha2(\"foobar\", \"SHA-384\")", - "return": "3c9c30d9f665e74d515c842960d4a451c83a0125fd3de7392d7b37231af10c72ea58aedfcdf89a5765bf902af93ecf06" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/sha3.cue b/website/cue/reference/remap/functions/sha3.cue deleted file mode 100644 index 939aeb8784e0b..0000000000000 --- a/website/cue/reference/remap/functions/sha3.cue +++ /dev/null @@ -1,60 +0,0 @@ -{ - "remap": { - "functions": { - "sha3": { - "anchor": "sha3", - "name": "sha3", - "category": "Cryptography", - "description": "Calculates a [SHA-3](https://en.wikipedia.org/wiki/SHA-3) hash of the `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "variant", - "description": "The variant of the algorithm to use.", - "required": false, - "type": [ - "string" - ], - "enum": { - "SHA3-224": "SHA3-224 algorithm", - "SHA3-256": "SHA3-256 algorithm", - "SHA3-384": "SHA3-384 algorithm", - "SHA3-512": "SHA3-512 algorithm" - }, - "default": "SHA3-512" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Calculate sha3 hash using default variant", - "source": "sha3(\"foobar\")", - "return": "ff32a30c3af5012ea395827a3e99a13073c3a8d8410a708568ff7e6eb85968fccfebaea039bc21411e9d43fdb9a851b529b9960ffea8679199781b8f45ca85e2" - }, - { - "title": "Calculate sha3 hash with SHA3-224", - "source": "sha3(\"foo\", variant: \"SHA3-224\")", - "return": "f4f6779e153c391bbd29c95e72b0708e39d9166c7cea51d1f10ef58a" - }, - { - "title": "Calculate sha3 hash with SHA3-384", - "source": "sha3(\"foobar\", \"SHA3-384\")", - "return": "0fa8abfbdaf924ad307b74dd2ed183b9a4a398891a2f6bac8fd2db7041b77f068580f9c6c66f699b496c2da1cbcc7ed8" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/shannon_entropy.cue b/website/cue/reference/remap/functions/shannon_entropy.cue deleted file mode 100644 index edf23df5ba6c6..0000000000000 --- a/website/cue/reference/remap/functions/shannon_entropy.cue +++ /dev/null @@ -1,64 +0,0 @@ -{ - "remap": { - "functions": { - "shannon_entropy": { - "anchor": "shannon_entropy", - "name": "shannon_entropy", - "category": "String", - "description": "Generates [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_(information_theory)) from given string. It can generate it based on string bytes, codepoints, or graphemes.", - "arguments": [ - { - "name": "value", - "description": "The input string.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "segmentation", - "description": "Defines how to split the string to calculate entropy, based on occurrences of\nsegments.\n\nByte segmentation is the fastest, but it might give undesired results when handling\nUTF-8 strings, while grapheme segmentation is the slowest, but most correct in these\ncases.", - "required": false, - "type": [ - "string" - ], - "enum": { - "byte": "Considers individual bytes when calculating entropy", - "codepoint": "Considers codepoints when calculating entropy", - "grapheme": "Considers graphemes when calculating entropy" - }, - "default": "byte" - } - ], - "return": { - "types": [ - "float" - ] - }, - "examples": [ - { - "title": "Simple byte segmentation example", - "source": "floor(shannon_entropy(\"vector.dev\"), precision: 4)", - "return": 2.9219 - }, - { - "title": "UTF-8 string with bytes segmentation", - "source": "floor(shannon_entropy(\"test123%456.فوائد.net.\"), precision: 4)", - "return": 4.0784 - }, - { - "title": "UTF-8 string with grapheme segmentation", - "source": "floor(shannon_entropy(\"test123%456.فوائد.net.\", segmentation: \"grapheme\"), precision: 4)", - "return": 3.9362 - }, - { - "title": "UTF-8 emoji (7 Unicode scalar values) with grapheme segmentation", - "source": "shannon_entropy(\"👨‍👩‍👧‍👦\", segmentation: \"grapheme\")", - "return": 0.0 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/sieve.cue b/website/cue/reference/remap/functions/sieve.cue deleted file mode 100644 index e6349907ecfef..0000000000000 --- a/website/cue/reference/remap/functions/sieve.cue +++ /dev/null @@ -1,71 +0,0 @@ -{ - "remap": { - "functions": { - "sieve": { - "anchor": "sieve", - "name": "sieve", - "category": "String", - "description": "Keeps only matches of `pattern` in `value`.\n\nThis can be used to define patterns that are allowed in the string and\nremove everything else.", - "arguments": [ - { - "name": "value", - "description": "The original string.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "permitted_characters", - "description": "Keep all matches of this pattern.", - "required": true, - "type": [ - "regex" - ] - }, - { - "name": "replace_single", - "description": "The string to use to replace single rejected characters.", - "required": false, - "type": [ - "string" - ], - "default": "" - }, - { - "name": "replace_repeated", - "description": "The string to use to replace multiple sequential instances of rejected characters.", - "required": false, - "type": [ - "string" - ], - "default": "" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Keep only lowercase letters", - "source": "sieve(\"vector.dev/lowerUPPER\", permitted_characters: r'[a-z]')", - "return": "vectordevlower" - }, - { - "title": "Sieve with regex", - "source": "sieve(\"test123%456.فوائد.net.\", r'[a-z0-9.]')", - "return": "test123456..net." - }, - { - "title": "Custom replacements", - "source": "sieve(\"test123%456.فوائد.net.\", r'[a-z.0-9]', replace_single: \"X\", replace_repeated: \"\")", - "return": "test123X456..net." - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/slice.cue b/website/cue/reference/remap/functions/slice.cue deleted file mode 100644 index 87207adc893b7..0000000000000 --- a/website/cue/reference/remap/functions/slice.cue +++ /dev/null @@ -1,72 +0,0 @@ -{ - "remap": { - "functions": { - "slice": { - "anchor": "slice", - "name": "slice", - "category": "String", - "description": "Returns a slice of `value` between the `start` and `end` positions.\n\nIf the `start` and `end` parameters are negative, they refer to positions counting from the right of the\nstring or array. If `end` refers to a position that is greater than the length of the string or array,\na slice up to the end of the string or array is returned.", - "arguments": [ - { - "name": "value", - "description": "The string or array to slice.", - "required": true, - "type": [ - "string", - "array" - ] - }, - { - "name": "start", - "description": "The inclusive start position. A zero-based index that can be negative.", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "end", - "description": "The exclusive end position. A zero-based index that can be negative.", - "required": false, - "type": [ - "integer" - ], - "default": "String length" - } - ], - "return": { - "types": [ - "string", - "array" - ] - }, - "examples": [ - { - "title": "Slice a string (positive index)", - "source": "slice!(\"Supercalifragilisticexpialidocious\", start: 5, end: 13)", - "return": "califrag" - }, - { - "title": "Slice a string (negative index)", - "source": "slice!(\"Supercalifragilisticexpialidocious\", start: 5, end: -14)", - "return": "califragilistic" - }, - { - "title": "String start", - "source": "slice!(\"foobar\", 3)", - "return": "bar" - }, - { - "title": "Array start", - "source": "slice!([0, 1, 2], 1)", - "return": [ - 1, - 2 - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/snakecase.cue b/website/cue/reference/remap/functions/snakecase.cue deleted file mode 100644 index fcb10bdcc7979..0000000000000 --- a/website/cue/reference/remap/functions/snakecase.cue +++ /dev/null @@ -1,77 +0,0 @@ -{ - "remap": { - "functions": { - "snakecase": { - "anchor": "snakecase", - "name": "snakecase", - "category": "String", - "description": "Takes the `value` string, and turns it into snake_case. Optionally, you can pass in the existing case of the function, or else we will try to figure out the case automatically.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to snake_case.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "original_case", - "description": "Optional hint on the original case type. Must be one of: kebab-case, camelCase, PascalCase, SCREAMING_SNAKE, snake_case", - "required": false, - "type": [ - "string" - ], - "enum": { - "kebab-case": "[kebab-case](https://en.wikipedia.org/wiki/Letter_case#Kebab_case)", - "camelCase": "[camelCase](https://en.wikipedia.org/wiki/Camel_case)", - "PascalCase": "[PascalCase](https://en.wikipedia.org/wiki/Camel_case)", - "SCREAMING_SNAKE": "[SCREAMING_SNAKE](https://en.wikipedia.org/wiki/Snake_case)", - "snake_case": "[snake_case](https://en.wikipedia.org/wiki/Snake_case)" - } - }, - { - "name": "excluded_boundaries", - "description": "Case boundaries to exclude during conversion.", - "required": false, - "type": [ - "array" - ], - "enum": { - "lower_upper": "Lowercase to uppercase transitions (e.g., 'camelCase' → 'camel' + 'case')", - "upper_lower": "Uppercase to lowercase transitions (e.g., 'CamelCase' → 'Camel' + 'Case')", - "acronym": "Acronyms from words (e.g., 'XMLHttpRequest' → 'xmlhttp' + 'request')", - "lower_digit": "Lowercase to digit transitions (e.g., 'foo2bar' → 'foo2_bar')", - "upper_digit": "Uppercase to digit transitions (e.g., 'versionV2' → 'version_v2')", - "digit_lower": "Digit to lowercase transitions (e.g., 'Foo123barBaz' → 'foo' + '123bar' + 'baz')", - "digit_upper": "Digit to uppercase transitions (e.g., 'Version123Test' → 'version' + '123test')" - } - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "snake_case a string", - "source": "snakecase(\"input-string\")", - "return": "input_string" - }, - { - "title": "snake_case a string with original case", - "source": "snakecase(\"input-string\", original_case: \"kebab-case\")", - "return": "input_string" - }, - { - "title": "snake_case with excluded boundaries", - "source": "snakecase(\"s3BucketDetails\", excluded_boundaries: [\"lower_digit\"])", - "return": "s3_bucket_details" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/split.cue b/website/cue/reference/remap/functions/split.cue deleted file mode 100644 index d61906700e347..0000000000000 --- a/website/cue/reference/remap/functions/split.cue +++ /dev/null @@ -1,84 +0,0 @@ -{ - "remap": { - "functions": { - "split": { - "anchor": "split", - "name": "split", - "category": "String", - "description": "Splits the `value` string using `pattern`.", - "arguments": [ - { - "name": "value", - "description": "The string to split.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "pattern", - "description": "The string is split whenever this pattern is matched.", - "required": true, - "type": [ - "string", - "regex" - ] - }, - { - "name": "limit", - "description": "The maximum number of substrings to return.", - "required": false, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "If `limit` is specified, the remainder of the string is returned unsplit after `limit` has been reached." - ] - }, - "examples": [ - { - "title": "Split a string (no limit)", - "source": "split(\"apples and pears and bananas\", \" and \")", - "return": [ - "apples", - "pears", - "bananas" - ] - }, - { - "title": "Split a string (with a limit)", - "source": "split(\"apples and pears and bananas\", \" and \", limit: 2)", - "return": [ - "apples", - "pears and bananas" - ] - }, - { - "title": "Split string", - "source": "split(\"foobar\", \"b\")", - "return": [ - "foo", - "ar" - ] - }, - { - "title": "Split regex", - "source": "split(\"barbaz\", r'ba')", - "return": [ - "", - "r", - "z" - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/split_path.cue b/website/cue/reference/remap/functions/split_path.cue deleted file mode 100644 index eb15748b81478..0000000000000 --- a/website/cue/reference/remap/functions/split_path.cue +++ /dev/null @@ -1,63 +0,0 @@ -{ - "remap": { - "functions": { - "split_path": { - "anchor": "split_path", - "name": "split_path", - "category": "String", - "description": "Splits the given `path` into its constituent components, returning an array of strings. Each component represents a part of the file system path hierarchy.", - "arguments": [ - { - "name": "value", - "description": "The path to split into components.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid string." - ], - "examples": [ - { - "title": "Split path with trailing slash", - "source": "split_path(\"/home/user/\")", - "return": [ - "/", - "home", - "user" - ] - }, - { - "title": "Split path from file path", - "source": "split_path(\"/home/user\")", - "return": [ - "/", - "home", - "user" - ] - }, - { - "title": "Split path from root", - "source": "split_path(\"/\")", - "return": [ - "/" - ] - }, - { - "title": "Empty path returns empty array", - "source": "split_path(\"\")", - "return": [] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/starts_with.cue b/website/cue/reference/remap/functions/starts_with.cue deleted file mode 100644 index 8c9d877cda650..0000000000000 --- a/website/cue/reference/remap/functions/starts_with.cue +++ /dev/null @@ -1,62 +0,0 @@ -{ - "remap": { - "functions": { - "starts_with": { - "anchor": "starts_with", - "name": "starts_with", - "category": "String", - "description": "Determines whether `value` begins with `substring`.", - "arguments": [ - { - "name": "value", - "description": "The string to search.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "substring", - "description": "The substring that the `value` must start with.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "case_sensitive", - "description": "Whether the match should be case sensitive.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "boolean" - ] - }, - "examples": [ - { - "title": "String starts with (case sensitive)", - "source": "starts_with(\"The Needle In The Haystack\", \"The Needle\")", - "return": true - }, - { - "title": "String starts with (case insensitive)", - "source": "starts_with(\"The Needle In The Haystack\", \"the needle\", case_sensitive: false)", - "return": true - }, - { - "title": "String starts with (case sensitive failure)", - "source": "starts_with(\"foobar\", \"F\")", - "return": false - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/string.cue b/website/cue/reference/remap/functions/string.cue deleted file mode 100644 index 64d22a4a55f1d..0000000000000 --- a/website/cue/reference/remap/functions/string.cue +++ /dev/null @@ -1,47 +0,0 @@ -{ - "remap": { - "functions": { - "string": { - "anchor": "string", - "name": "string", - "category": "Type", - "description": "Returns `value` if it is a string, otherwise returns an error. This enables the type checker to guarantee that the returned value is a string and can be used in any function that expects a string.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a string.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "string" - ], - "rules": [ - "Returns the `value` if it's a string.", - "Raises an error if not a string." - ] - }, - "internal_failure_reasons": [ - "`value` is not a string." - ], - "examples": [ - { - "title": "Declare a string type", - "source": ". = { \"message\": \"{\\\"field\\\": \\\"value\\\"}\" }\nstring(.message)\n", - "return": "{\"field\": \"value\"}" - }, - { - "title": "Invalid type", - "source": "string!(true)", - "raises": "function call error for \"string\" at (0:13): expected string, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue b/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue deleted file mode 100644 index faaadd3549bb6..0000000000000 --- a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue +++ /dev/null @@ -1,28 +0,0 @@ -{ - "remap": { - "functions": { - "strip_ansi_escape_codes": { - "anchor": "strip_ansi_escape_codes", - "name": "strip_ansi_escape_codes", - "category": "String", - "description": "Strips [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to strip.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/strip_whitespace.cue b/website/cue/reference/remap/functions/strip_whitespace.cue deleted file mode 100644 index b66163e0ee6d2..0000000000000 --- a/website/cue/reference/remap/functions/strip_whitespace.cue +++ /dev/null @@ -1,50 +0,0 @@ -{ - "remap": { - "functions": { - "strip_whitespace": { - "anchor": "strip_whitespace", - "name": "strip_whitespace", - "category": "String", - "description": "Strips whitespace from the start and end of `value`, where whitespace is defined by the [Unicode `White_Space` property](https://en.wikipedia.org/wiki/Unicode_character_property#Whitespace).", - "arguments": [ - { - "name": "value", - "description": "The string to trim.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Strip whitespace", - "source": "strip_whitespace(\" A sentence. \")", - "return": "A sentence." - }, - { - "title": "Start whitespace", - "source": "strip_whitespace(\" foobar\")", - "return": "foobar" - }, - { - "title": "End whitespace", - "source": "strip_whitespace(\"foo bar \")", - "return": "foo bar" - }, - { - "title": "Newlines", - "source": "strip_whitespace(\"\\n\\nfoo bar\\n \")", - "return": "foo bar" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/strlen.cue b/website/cue/reference/remap/functions/strlen.cue deleted file mode 100644 index bb24107deaa62..0000000000000 --- a/website/cue/reference/remap/functions/strlen.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "strlen": { - "anchor": "strlen", - "name": "strlen", - "category": "Enumerate", - "description": "Returns the number of UTF-8 characters in `value`. This differs from\n`length` which counts the number of bytes of a string.\n\n**Note**: This is the count of [Unicode scalar values](https://www.unicode.org/glossary/#unicode_scalar_value)\nwhich can sometimes differ from [Unicode code points](https://www.unicode.org/glossary/#code_point).", - "arguments": [ - { - "name": "value", - "description": "The string.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "examples": [ - { - "title": "Count Unicode scalar values", - "source": "strlen(\"ñandú\")", - "return": 5 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/tag_types_externally.cue b/website/cue/reference/remap/functions/tag_types_externally.cue deleted file mode 100644 index 237bf7f442bf4..0000000000000 --- a/website/cue/reference/remap/functions/tag_types_externally.cue +++ /dev/null @@ -1,70 +0,0 @@ -{ - "remap": { - "functions": { - "tag_types_externally": { - "anchor": "tag_types_externally", - "name": "tag_types_externally", - "category": "Type", - "description": "Adds type information to all (nested) scalar values in the provided `value`.\n\nThe type information is added externally, meaning that `value` has the form of `\"type\": value` after this\ntransformation.", - "arguments": [ - { - "name": "value", - "description": "The value to tag with types.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "object", - "array", - "null" - ] - }, - "examples": [ - { - "title": "Tag types externally (scalar)", - "source": "tag_types_externally(123)", - "return": { - "integer": 123 - } - }, - { - "title": "Tag types externally (object)", - "source": "tag_types_externally({\n \"message\": \"Hello world\",\n \"request\": {\n \"duration_ms\": 67.9\n }\n})\n", - "return": { - "message": { - "string": "Hello world" - }, - "request": { - "duration_ms": { - "float": 67.9 - } - } - } - }, - { - "title": "Tag types externally (array)", - "source": "tag_types_externally([\"foo\", \"bar\"])", - "return": [ - { - "string": "foo" - }, - { - "string": "bar" - } - ] - }, - { - "title": "Tag types externally (null)", - "source": "tag_types_externally(null)", - "return": null - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/tally.cue b/website/cue/reference/remap/functions/tally.cue deleted file mode 100644 index 9038246e3a84f..0000000000000 --- a/website/cue/reference/remap/functions/tally.cue +++ /dev/null @@ -1,39 +0,0 @@ -{ - "remap": { - "functions": { - "tally": { - "anchor": "tally", - "name": "tally", - "category": "Enumerate", - "description": "Counts the occurrences of each string value in the provided array and returns an object with the counts.", - "arguments": [ - { - "name": "value", - "description": "The array of strings to count occurrences for.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "tally", - "source": "tally!([\"foo\", \"bar\", \"foo\", \"baz\"])", - "return": { - "foo": 2, - "bar": 1, - "baz": 1 - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/tally_value.cue b/website/cue/reference/remap/functions/tally_value.cue deleted file mode 100644 index d4349fcd1efb0..0000000000000 --- a/website/cue/reference/remap/functions/tally_value.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "tally_value": { - "anchor": "tally_value", - "name": "tally_value", - "category": "Enumerate", - "description": "Counts the number of times a specific value appears in the provided array.", - "arguments": [ - { - "name": "array", - "description": "The array to search through.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "value", - "description": "The value to count occurrences of in the array.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "examples": [ - { - "title": "count matching values", - "source": "tally_value([\"foo\", \"bar\", \"foo\", \"baz\"], \"foo\")", - "return": 2 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/timestamp.cue b/website/cue/reference/remap/functions/timestamp.cue deleted file mode 100644 index 740dc5e4d6909..0000000000000 --- a/website/cue/reference/remap/functions/timestamp.cue +++ /dev/null @@ -1,47 +0,0 @@ -{ - "remap": { - "functions": { - "timestamp": { - "anchor": "timestamp", - "name": "timestamp", - "category": "Type", - "description": "Returns `value` if it is a timestamp, otherwise returns an error. This enables the type checker to guarantee that the returned value is a timestamp and can be used in any function that expects a timestamp.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it is a timestamp.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "timestamp" - ], - "rules": [ - "Returns the `value` if it's a timestamp.", - "Raises an error if not a timestamp." - ] - }, - "internal_failure_reasons": [ - "`value` is not a timestamp." - ], - "examples": [ - { - "title": "Declare a timestamp type", - "source": "timestamp(t'2020-10-10T16:00:00Z')", - "return": "t'2020-10-10T16:00:00Z'" - }, - { - "title": "Invalid type", - "source": "timestamp!(true)", - "raises": "function call error for \"timestamp\" at (0:16): expected timestamp, got boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_bool.cue b/website/cue/reference/remap/functions/to_bool.cue deleted file mode 100644 index dd473e3c7c5f3..0000000000000 --- a/website/cue/reference/remap/functions/to_bool.cue +++ /dev/null @@ -1,136 +0,0 @@ -{ - "remap": { - "functions": { - "to_bool": { - "anchor": "to_bool", - "name": "to_bool", - "category": "Coerce", - "description": "Coerces the `value` into a boolean.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a Boolean.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "If `value` is `\"true\"`, `\"t\"`, `\"yes\"`, or `\"y\"`, `true` is returned.", - "If `value` is `\"false\"`, `\"f\"`, `\"no\"`, `\"n\"`, or `\"0\"`, `false` is returned.", - "If `value` is `0.0`, `false` is returned, otherwise `true` is returned.", - "If `value` is `0`, `false` is returned, otherwise `true` is returned.", - "If `value` is `null`, `false` is returned.", - "If `value` is a Boolean, it's returned unchanged." - ] - }, - "internal_failure_reasons": [ - "`value` is not a supported boolean representation." - ], - "examples": [ - { - "title": "Coerce to a Boolean (string)", - "source": "to_bool!(\"yes\")", - "return": true - }, - { - "title": "Coerce to a Boolean (float)", - "source": "to_bool(0.0)", - "return": false - }, - { - "title": "Coerce to a Boolean (int)", - "source": "to_bool(0)", - "return": false - }, - { - "title": "Coerce to a Boolean (null)", - "source": "to_bool(null)", - "return": false - }, - { - "title": "Coerce to a Boolean (Boolean)", - "source": "to_bool(true)", - "return": true - }, - { - "title": "Integer (other)", - "source": "to_bool(2)", - "return": true - }, - { - "title": "Float (other)", - "source": "to_bool(5.6)", - "return": true - }, - { - "title": "False", - "source": "to_bool(false)", - "return": false - }, - { - "title": "True string", - "source": "to_bool!(s'true')", - "return": true - }, - { - "title": "Y string", - "source": "to_bool!(s'y')", - "return": true - }, - { - "title": "Non-zero integer string", - "source": "to_bool!(s'1')", - "return": true - }, - { - "title": "False string", - "source": "to_bool!(s'false')", - "return": false - }, - { - "title": "No string", - "source": "to_bool!(s'no')", - "return": false - }, - { - "title": "N string", - "source": "to_bool!(s'n')", - "return": false - }, - { - "title": "Invalid string", - "source": "to_bool!(s'foobar')", - "raises": "function call error for \"to_bool\" at (0:19): Invalid boolean value \"foobar\"" - }, - { - "title": "Timestamp", - "source": "to_bool!(t'2020-01-01T00:00:00Z')", - "raises": "function call error for \"to_bool\" at (0:33): unable to coerce timestamp into boolean" - }, - { - "title": "Array", - "source": "to_bool!([])", - "raises": "function call error for \"to_bool\" at (0:12): unable to coerce array into boolean" - }, - { - "title": "Object", - "source": "to_bool!({})", - "raises": "function call error for \"to_bool\" at (0:12): unable to coerce object into boolean" - }, - { - "title": "Regex", - "source": "to_bool!(r'foo')", - "raises": "function call error for \"to_bool\" at (0:16): unable to coerce regex into boolean" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_float.cue b/website/cue/reference/remap/functions/to_float.cue deleted file mode 100644 index 99a74d4fdee34..0000000000000 --- a/website/cue/reference/remap/functions/to_float.cue +++ /dev/null @@ -1,95 +0,0 @@ -{ - "remap": { - "functions": { - "to_float": { - "anchor": "to_float", - "name": "to_float", - "category": "Coerce", - "description": "Coerces the `value` into a float.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a float. Must be convertible to a float, otherwise an error is raised.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "float" - ], - "rules": [ - "If `value` is a float, it will be returned as-is.", - "If `value` is an integer, it will be returned as as a float.", - "If `value` is a string, it must be the string representation of an float or else an error is raised.", - "If `value` is a boolean, `0.0` is returned for `false` and `1.0` is returned for `true`.", - "If `value` is a timestamp, a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) with fractional seconds is returned." - ] - }, - "internal_failure_reasons": [ - "`value` is not a supported float representation." - ], - "examples": [ - { - "title": "Coerce to a float", - "source": "to_float!(\"3.145\")", - "return": 3.145 - }, - { - "title": "Coerce to a float (timestamp)", - "source": "to_float(t'2020-12-30T22:20:53.824727Z')", - "return": 1609366853.824727 - }, - { - "title": "Integer", - "source": "to_float(5)", - "return": 5.0 - }, - { - "title": "Float", - "source": "to_float(5.6)", - "return": 5.6 - }, - { - "title": "True", - "source": "to_float(true)", - "return": 1.0 - }, - { - "title": "False", - "source": "to_float(false)", - "return": 0.0 - }, - { - "title": "Null", - "source": "to_float(null)", - "return": 0.0 - }, - { - "title": "Invalid string", - "source": "to_float!(s'foobar')", - "raises": "function call error for \"to_float\" at (0:20): Invalid floating point number \"foobar\": invalid float literal" - }, - { - "title": "Array", - "source": "to_float!([])", - "raises": "function call error for \"to_float\" at (0:13): unable to coerce array into float" - }, - { - "title": "Object", - "source": "to_float!({})", - "raises": "function call error for \"to_float\" at (0:13): unable to coerce object into float" - }, - { - "title": "Regex", - "source": "to_float!(r'foo')", - "raises": "function call error for \"to_float\" at (0:17): unable to coerce regex into float" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_int.cue b/website/cue/reference/remap/functions/to_int.cue deleted file mode 100644 index 1e2236b81849e..0000000000000 --- a/website/cue/reference/remap/functions/to_int.cue +++ /dev/null @@ -1,97 +0,0 @@ -{ - "remap": { - "functions": { - "to_int": { - "anchor": "to_int", - "name": "to_int", - "category": "Coerce", - "description": "Coerces the `value` into an integer.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to an integer.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "integer" - ], - "rules": [ - "If `value` is an integer, it will be returned as-is.", - "If `value` is a float, it will be truncated to its integer portion.", - "If `value` is a string, it must be the string representation of an integer or else an error is raised.", - "If `value` is a boolean, `0` is returned for `false` and `1` is returned for `true`.", - "If `value` is a timestamp, a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) (in seconds) is returned.", - "If `value` is null, `0` is returned." - ] - }, - "internal_failure_reasons": [ - "`value` is a string but the text is not an integer.", - "`value` is not a string, int, or timestamp." - ], - "examples": [ - { - "title": "Coerce to an int (string)", - "source": "to_int!(\"2\")", - "return": 2 - }, - { - "title": "Coerce to an int (timestamp)", - "source": "to_int(t'2020-12-30T22:20:53.824727Z')", - "return": 1609366853 - }, - { - "title": "Integer", - "source": "to_int(5)", - "return": 5 - }, - { - "title": "Float", - "source": "to_int(5.6)", - "return": 5 - }, - { - "title": "True", - "source": "to_int(true)", - "return": 1 - }, - { - "title": "False", - "source": "to_int(false)", - "return": 0 - }, - { - "title": "Null", - "source": "to_int(null)", - "return": 0 - }, - { - "title": "Invalid string", - "source": "to_int!(s'foobar')", - "raises": "function call error for \"to_int\" at (0:18): Invalid integer \"foobar\": invalid digit found in string" - }, - { - "title": "Array", - "source": "to_int!([])", - "raises": "function call error for \"to_int\" at (0:11): unable to coerce array into integer" - }, - { - "title": "Object", - "source": "to_int!({})", - "raises": "function call error for \"to_int\" at (0:11): unable to coerce object into integer" - }, - { - "title": "Regex", - "source": "to_int!(r'foo')", - "raises": "function call error for \"to_int\" at (0:15): unable to coerce regex into integer" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_regex.cue b/website/cue/reference/remap/functions/to_regex.cue deleted file mode 100644 index 850eb2148ff14..0000000000000 --- a/website/cue/reference/remap/functions/to_regex.cue +++ /dev/null @@ -1,44 +0,0 @@ -{ - "remap": { - "functions": { - "to_regex": { - "anchor": "to_regex", - "name": "to_regex", - "category": "Coerce", - "description": "Coerces the `value` into a regex.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a regex.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "regex" - ], - "rules": [ - "If `value` is a string that contains a valid regex, returns the regex constructed with this string." - ] - }, - "internal_failure_reasons": [ - "`value` is not a string." - ], - "examples": [ - { - "title": "Coerce to a regex", - "source": "to_regex!(\"^foo$\")", - "return": "r'^foo$'" - } - ], - "notices": [ - "Compiling a regular expression is an expensive operation and can limit Vector's\nthroughput. Don't use this function unless you are absolutely sure there is no other\nway!" - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_string.cue b/website/cue/reference/remap/functions/to_string.cue deleted file mode 100644 index 80a79e9a72005..0000000000000 --- a/website/cue/reference/remap/functions/to_string.cue +++ /dev/null @@ -1,89 +0,0 @@ -{ - "remap": { - "functions": { - "to_string": { - "anchor": "to_string", - "name": "to_string", - "category": "Coerce", - "description": "Coerces the `value` into a string.", - "arguments": [ - { - "name": "value", - "description": "The value to convert to a string.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "string" - ], - "rules": [ - "If `value` is an integer or float, returns the string representation.", - "If `value` is a boolean, returns `\"true\"` or `\"false\"`.", - "If `value` is a timestamp, returns an [RFC 3339](\\(urls.rfc3339)) representation.", - "If `value` is a null, returns `\"\"`." - ] - }, - "internal_failure_reasons": [ - "`value` is not an integer, float, boolean, string, timestamp, or null." - ], - "examples": [ - { - "title": "Coerce to a string (Boolean)", - "source": "to_string(true)", - "return": "s'true'" - }, - { - "title": "Coerce to a string (int)", - "source": "to_string(52)", - "return": "s'52'" - }, - { - "title": "Coerce to a string (float)", - "source": "to_string(52.2)", - "return": "s'52.2'" - }, - { - "title": "String", - "source": "to_string(s'foo')", - "return": "foo" - }, - { - "title": "False", - "source": "to_string(false)", - "return": "s'false'" - }, - { - "title": "Null", - "source": "to_string(null)", - "return": "" - }, - { - "title": "Timestamp", - "source": "to_string(t'2020-01-01T00:00:00Z')", - "return": "2020-01-01T00:00:00Z" - }, - { - "title": "Array", - "source": "to_string!([])", - "raises": "function call error for \"to_string\" at (0:14): unable to coerce array into string" - }, - { - "title": "Object", - "source": "to_string!({})", - "raises": "function call error for \"to_string\" at (0:14): unable to coerce object into string" - }, - { - "title": "Regex", - "source": "to_string!(r'foo')", - "raises": "function call error for \"to_string\" at (0:18): unable to coerce regex into string" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_syslog_facility.cue b/website/cue/reference/remap/functions/to_syslog_facility.cue deleted file mode 100644 index ea49fd0b9971a..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_facility.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "to_syslog_facility": { - "anchor": "to_syslog_facility", - "name": "to_syslog_facility", - "category": "Convert", - "description": "Converts the `value`, a Syslog [facility code](https://en.wikipedia.org/wiki/Syslog#Facility), into its corresponding Syslog keyword. For example, `0` into `\"kern\"`, `1` into `\"user\"`, etc.", - "arguments": [ - { - "name": "value", - "description": "The facility code.", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid Syslog [facility code](https://en.wikipedia.org/wiki/Syslog#Facility)." - ], - "examples": [ - { - "title": "Coerce to a Syslog facility", - "source": "to_syslog_facility!(4)", - "return": "auth" - }, - { - "title": "invalid", - "source": "to_syslog_facility!(500)", - "raises": "function call error for \"to_syslog_facility\" at (0:24): facility code 500 not valid" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_syslog_facility_code.cue b/website/cue/reference/remap/functions/to_syslog_facility_code.cue deleted file mode 100644 index 2d886a893e0aa..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_facility_code.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "to_syslog_facility_code": { - "anchor": "to_syslog_facility_code", - "name": "to_syslog_facility_code", - "category": "Convert", - "description": "Converts the `value`, a Syslog [facility keyword](https://en.wikipedia.org/wiki/Syslog#Facility), into a Syslog integer facility code (`0` to `23`).", - "arguments": [ - { - "name": "value", - "description": "The Syslog facility keyword to convert.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "integer" - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid Syslog facility keyword." - ], - "examples": [ - { - "title": "Coerce to Syslog facility code", - "source": "to_syslog_facility_code!(\"authpriv\")", - "return": 10 - }, - { - "title": "invalid", - "source": "to_syslog_facility_code!(s'foobar')", - "raises": "function call error for \"to_syslog_facility_code\" at (0:35): syslog facility 'foobar' not valid" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_syslog_level.cue b/website/cue/reference/remap/functions/to_syslog_level.cue deleted file mode 100644 index 4d7e3fa894a66..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_level.cue +++ /dev/null @@ -1,43 +0,0 @@ -{ - "remap": { - "functions": { - "to_syslog_level": { - "anchor": "to_syslog_level", - "name": "to_syslog_level", - "category": "Convert", - "description": "Converts the `value`, a Syslog [severity level](https://en.wikipedia.org/wiki/Syslog#Severity_level), into its corresponding keyword, i.e. 0 into `\"emerg\"`, 1 into `\"alert\"`, etc.", - "arguments": [ - { - "name": "value", - "description": "The severity level.", - "required": true, - "type": [ - "integer" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` isn't a valid Syslog [severity level](https://en.wikipedia.org/wiki/Syslog#Severity_level)." - ], - "examples": [ - { - "title": "Coerce to a Syslog level", - "source": "to_syslog_level!(5)", - "return": "notice" - }, - { - "title": "invalid", - "source": "to_syslog_level!(500)", - "raises": "function call error for \"to_syslog_level\" at (0:21): severity level 500 not valid" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_syslog_severity.cue b/website/cue/reference/remap/functions/to_syslog_severity.cue deleted file mode 100644 index e30006ce6b201..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_severity.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "to_syslog_severity": { - "anchor": "to_syslog_severity", - "name": "to_syslog_severity", - "category": "Convert", - "description": "Converts the `value`, a Syslog [log level keyword](https://en.wikipedia.org/wiki/Syslog#Severity_level), into a Syslog integer severity level (`0` to `7`).", - "arguments": [ - { - "name": "value", - "description": "The Syslog level keyword to convert.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "integer" - ], - "rules": [ - "The now-deprecated keywords `panic`, `error`, and `warn` are converted to `0`, `3`, and `4` respectively." - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid Syslog level keyword." - ], - "examples": [ - { - "title": "Coerce to Syslog severity", - "source": "to_syslog_severity!(\"alert\")", - "return": 1 - }, - { - "title": "invalid", - "source": "to_syslog_severity!(s'foobar')", - "raises": "function call error for \"to_syslog_severity\" at (0:30): syslog level foobar not valid" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/to_unix_timestamp.cue b/website/cue/reference/remap/functions/to_unix_timestamp.cue deleted file mode 100644 index 5d1e402d88c52..0000000000000 --- a/website/cue/reference/remap/functions/to_unix_timestamp.cue +++ /dev/null @@ -1,67 +0,0 @@ -{ - "remap": { - "functions": { - "to_unix_timestamp": { - "anchor": "to_unix_timestamp", - "name": "to_unix_timestamp", - "category": "Convert", - "description": "Converts the `value` timestamp into a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time).\n\nReturns the number of seconds since the Unix epoch by default. To return the number in milliseconds or nanoseconds, set the `unit` argument to `milliseconds` or `nanoseconds`.", - "arguments": [ - { - "name": "value", - "description": "The timestamp to convert into a Unix timestamp.", - "required": true, - "type": [ - "timestamp" - ] - }, - { - "name": "unit", - "description": "The time unit.", - "required": false, - "type": [ - "string" - ], - "enum": { - "seconds": "Express Unix time in seconds", - "milliseconds": "Express Unix time in milliseconds", - "nanoseconds": "Express Unix time in nanoseconds" - }, - "default": "seconds" - } - ], - "return": { - "types": [ - "integer" - ] - }, - "internal_failure_reasons": [ - "`value` cannot be represented in nanoseconds. Result is too large or too small for a 64 bit integer." - ], - "examples": [ - { - "title": "Convert to a Unix timestamp (seconds)", - "source": "to_unix_timestamp(t'2021-01-01T00:00:00+00:00')", - "return": 1609459200 - }, - { - "title": "Convert to a Unix timestamp (milliseconds)", - "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"milliseconds\")", - "return": 1609459200000 - }, - { - "title": "Convert to a Unix timestamp (microseconds)", - "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"microseconds\")", - "return": 1609459200000000 - }, - { - "title": "Convert to a Unix timestamp (nanoseconds)", - "source": "to_unix_timestamp(t'2021-01-01T00:00:00Z', unit: \"nanoseconds\")", - "return": 1609459200000000000 - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/truncate.cue b/website/cue/reference/remap/functions/truncate.cue deleted file mode 100644 index 494ba1c1d10aa..0000000000000 --- a/website/cue/reference/remap/functions/truncate.cue +++ /dev/null @@ -1,64 +0,0 @@ -{ - "remap": { - "functions": { - "truncate": { - "anchor": "truncate", - "name": "truncate", - "category": "String", - "description": "Truncates the `value` string up to the `limit` number of characters.", - "arguments": [ - { - "name": "value", - "description": "The string to truncate.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "limit", - "description": "The number of characters to truncate the string after.", - "required": true, - "type": [ - "integer" - ] - }, - { - "name": "suffix", - "description": "A custom suffix (`...`) is appended to truncated strings.\nIf `ellipsis` is set to `true`, this parameter is ignored for backwards compatibility.", - "required": false, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ], - "rules": [ - "The string is returned unchanged its length is less than `limit`." - ] - }, - "examples": [ - { - "title": "Truncate a string", - "source": "truncate(\"A rather long sentence.\", limit: 11, suffix: \"...\")", - "return": "A rather lo..." - }, - { - "title": "Truncate a string (custom suffix)", - "source": "truncate(\"A rather long sentence.\", limit: 11, suffix: \"[TRUNCATED]\")", - "return": "A rather lo[TRUNCATED]" - }, - { - "title": "Truncate", - "source": "truncate(\"foobar\", 3)", - "return": "foo" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/type_def.cue b/website/cue/reference/remap/functions/type_def.cue deleted file mode 100644 index 63df82e44e916..0000000000000 --- a/website/cue/reference/remap/functions/type_def.cue +++ /dev/null @@ -1,37 +0,0 @@ -{ - "remap": { - "functions": { - "type_def": { - "anchor": "type_def", - "name": "type_def", - "category": "Type", - "description": "Returns the type definition of an expression at runtime.\n\nThis is a debug function that is *UNSTABLE*. Behavior is *NOT* guaranteed even though it is technically usable.", - "arguments": [ - { - "name": "value", - "description": "The expression to get the type definition for.", - "required": true, - "type": [ - "any" - ] - } - ], - "return": { - "types": [ - "any" - ] - }, - "examples": [ - { - "title": "return type definition", - "source": "type_def(42)", - "return": { - "integer": true - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/unflatten.cue b/website/cue/reference/remap/functions/unflatten.cue deleted file mode 100644 index bd7f8933cf395..0000000000000 --- a/website/cue/reference/remap/functions/unflatten.cue +++ /dev/null @@ -1,106 +0,0 @@ -{ - "remap": { - "functions": { - "unflatten": { - "anchor": "unflatten", - "name": "unflatten", - "category": "Enumerate", - "description": "Unflattens the `value` into a nested representation.", - "arguments": [ - { - "name": "value", - "description": "The array or object to unflatten.", - "required": true, - "type": [ - "object" - ] - }, - { - "name": "separator", - "description": "The separator to split flattened keys.", - "required": false, - "type": [ - "string" - ], - "default": "." - }, - { - "name": "recursive", - "description": "Whether to recursively unflatten the object values.", - "required": false, - "type": [ - "boolean" - ], - "default": "true" - } - ], - "return": { - "types": [ - "object" - ] - }, - "examples": [ - { - "title": "Unflatten", - "source": "unflatten({\n \"foo.bar.baz\": true,\n \"foo.bar.qux\": false,\n \"foo.quux\": 42\n})\n", - "return": { - "foo": { - "bar": { - "baz": true, - "qux": false - }, - "quux": 42 - } - } - }, - { - "title": "Unflatten recursively", - "source": "unflatten({\n \"flattened.parent\": {\n \"foo.bar\": true,\n \"foo.baz\": false\n }\n})\n", - "return": { - "flattened": { - "parent": { - "foo": { - "bar": true, - "baz": false - } - } - } - } - }, - { - "title": "Unflatten non-recursively", - "source": "unflatten({\n \"flattened.parent\": {\n \"foo.bar\": true,\n \"foo.baz\": false\n }\n}, recursive: false)\n", - "return": { - "flattened": { - "parent": { - "foo.bar": true, - "foo.baz": false - } - } - } - }, - { - "title": "Ignore inconsistent keys values", - "source": "unflatten({\n \"a\": 3,\n \"a.b\": 2,\n \"a.c\": 4\n})\n", - "return": { - "a": { - "b": 2, - "c": 4 - } - } - }, - { - "title": "Unflatten with custom separator", - "source": "unflatten({ \"foo_bar\": true }, \"_\")", - "return": { - "foo": { - "bar": true - } - } - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/unique.cue b/website/cue/reference/remap/functions/unique.cue deleted file mode 100644 index 1bd60b66c86fa..0000000000000 --- a/website/cue/reference/remap/functions/unique.cue +++ /dev/null @@ -1,39 +0,0 @@ -{ - "remap": { - "functions": { - "unique": { - "anchor": "unique", - "name": "unique", - "category": "Enumerate", - "description": "Returns the unique values for an array.\n\nThe first occurrence of each element is kept.", - "arguments": [ - { - "name": "value", - "description": "The array to return unique elements from.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "array" - ] - }, - "examples": [ - { - "title": "Unique", - "source": "unique([\"foo\", \"bar\", \"foo\", \"baz\"])", - "return": [ - "foo", - "bar", - "baz" - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/unnest.cue b/website/cue/reference/remap/functions/unnest.cue deleted file mode 100644 index 7fce74904195e..0000000000000 --- a/website/cue/reference/remap/functions/unnest.cue +++ /dev/null @@ -1,68 +0,0 @@ -{ - "remap": { - "functions": { - "unnest": { - "anchor": "unnest", - "name": "unnest", - "category": "Object", - "description": "Unnest an array field from an object to create an array of objects using that field; keeping all other fields.\n\nAssigning the array result of this to `.` results in multiple events being emitted from `remap`. See the\n[`remap` transform docs](/docs/reference/configuration/transforms/remap/#emitting-multiple-log-events) for more details.\n\nThis is also referred to as `explode` in some languages.", - "arguments": [ - { - "name": "path", - "description": "The path of the field to unnest.", - "required": true, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Returns an array of objects that matches the original object, but each with the specified path replaced with a single element from the original path." - ] - }, - "internal_failure_reasons": [ - "The field path referred to is not an array." - ], - "examples": [ - { - "title": "Unnest an array field", - "source": ". = {\"hostname\": \"localhost\", \"messages\": [\"message 1\", \"message 2\"]}\n. = unnest(.messages)\n", - "return": [ - { - "hostname": "localhost", - "messages": "message 1" - }, - { - "hostname": "localhost", - "messages": "message 2" - } - ] - }, - { - "title": "Unnest a nested array field", - "source": ". = {\"hostname\": \"localhost\", \"event\": {\"messages\": [\"message 1\", \"message 2\"]}}\n. = unnest(.event.messages)\n", - "return": [ - { - "hostname": "localhost", - "event": { - "messages": "message 1" - } - }, - { - "hostname": "localhost", - "event": { - "messages": "message 2" - } - } - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/upcase.cue b/website/cue/reference/remap/functions/upcase.cue deleted file mode 100644 index 510f9b527a149..0000000000000 --- a/website/cue/reference/remap/functions/upcase.cue +++ /dev/null @@ -1,35 +0,0 @@ -{ - "remap": { - "functions": { - "upcase": { - "anchor": "upcase", - "name": "upcase", - "category": "String", - "description": "Upcases `value`, where upcase is defined according to the Unicode Derived Core Property Uppercase.", - "arguments": [ - { - "name": "value", - "description": "The string to convert to uppercase.", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Upcase a string", - "source": "upcase(\"Hello, World!\")", - "return": "HELLO, WORLD!" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue b/website/cue/reference/remap/functions/uuid_from_friendly_id.cue deleted file mode 100644 index 4863b3ad4826c..0000000000000 --- a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue +++ /dev/null @@ -1,39 +0,0 @@ -{ - "remap": { - "functions": { - "uuid_from_friendly_id": { - "anchor": "uuid_from_friendly_id", - "name": "uuid_from_friendly_id", - "category": "Random", - "description": "Convert a Friendly ID (base62 encoding a 128-bit word) to a UUID.", - "arguments": [ - { - "name": "value", - "description": "A string that is a Friendly ID", - "required": true, - "type": [ - "string" - ] - } - ], - "return": { - "types": [ - "string" - ] - }, - "internal_failure_reasons": [ - "`value` is a string but the text uses characters outside of class [0-9A-Za-z].", - "`value` is a base62 encoding of an integer, but the integer is greater than or equal to 2^128." - ], - "examples": [ - { - "title": "Convert a Friendly ID to a UUID", - "source": "uuid_from_friendly_id!(\"3s87yEvnmkiPBMHsj8bwwc\")", - "return": "7f41deed-d5e2-8b5e-7a13-ab4ff93cfad2" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/uuid_v4.cue b/website/cue/reference/remap/functions/uuid_v4.cue deleted file mode 100644 index df34c565252a9..0000000000000 --- a/website/cue/reference/remap/functions/uuid_v4.cue +++ /dev/null @@ -1,26 +0,0 @@ -{ - "remap": { - "functions": { - "uuid_v4": { - "anchor": "uuid_v4", - "name": "uuid_v4", - "category": "Random", - "description": "Generates a random [UUIDv4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) string.", - "arguments": [], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Create a UUIDv4", - "source": "uuid_v4()", - "return": "1d262f4f-199b-458d-879f-05fd0a5f0683" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/uuid_v7.cue b/website/cue/reference/remap/functions/uuid_v7.cue deleted file mode 100644 index 76df69cb4d665..0000000000000 --- a/website/cue/reference/remap/functions/uuid_v7.cue +++ /dev/null @@ -1,46 +0,0 @@ -{ - "remap": { - "functions": { - "uuid_v7": { - "anchor": "uuid_v7", - "name": "uuid_v7", - "category": "Random", - "description": "Generates a random [UUIDv7](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#name-uuid-version-7) string.", - "arguments": [ - { - "name": "timestamp", - "description": "The timestamp used to generate the UUIDv7.", - "required": false, - "type": [ - "timestamp" - ], - "default": "`now()`" - } - ], - "return": { - "types": [ - "string" - ] - }, - "examples": [ - { - "title": "Create a UUIDv7 with implicit `now()`", - "source": "uuid_v7()", - "return": "0135ddb4-a444-794c-a7a2-088f260104c0" - }, - { - "title": "Create a UUIDv7 with explicit `now()`", - "source": "uuid_v7(now())", - "return": "0135ddb4-a444-794c-a7a2-088f260104c0" - }, - { - "title": "Create a UUIDv7 with custom timestamp", - "source": "uuid_v7(t'2020-12-30T22:20:53.824727Z')", - "return": "0176b5bd-5d19-794c-a7a2-088f260104c0" - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/validate_json_schema.cue b/website/cue/reference/remap/functions/validate_json_schema.cue deleted file mode 100644 index f4f5d3a334e36..0000000000000 --- a/website/cue/reference/remap/functions/validate_json_schema.cue +++ /dev/null @@ -1,79 +0,0 @@ -{ - "remap": { - "functions": { - "validate_json_schema": { - "anchor": "validate_json_schema", - "name": "validate_json_schema", - "category": "Type", - "description": "Check if `value` conforms to a JSON Schema definition. This function validates a JSON payload against a JSON Schema definition. It can be used to ensure that the data structure and types in `value` match the expectations defined in `schema_definition`.", - "arguments": [ - { - "name": "value", - "description": "The value to check if it conforms to the JSON schema definition.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "schema_definition", - "description": "The location (path) of the JSON Schema definition.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "ignore_unknown_formats", - "description": "Unknown formats can be silently ignored by setting this to `true` and validation continues without failing due to those fields.", - "required": false, - "type": [ - "boolean" - ] - } - ], - "return": { - "types": [ - "boolean" - ], - "rules": [ - "Returns `true` if `value` conforms to the JSON Schema definition.", - "Returns `false` if `value` does not conform to the JSON Schema definition." - ] - }, - "internal_failure_reasons": [ - "`value` is not a valid JSON Schema payload.", - "`value` contains custom format declarations and `ignore_unknown_formats` has not been set to `true`.", - "`schema_definition` is not a valid JSON Schema definition.", - "`schema_definition` file does not exist." - ], - "examples": [ - { - "title": "Payload contains a valid email", - "source": "validate_json_schema!(s'{ \"productUser\": \"valid@email.com\" }', \"schema_with_email_format.json\", false)", - "return": true - }, - { - "title": "Payload contains an invalid email", - "source": "validate_json_schema!(s'{ \"productUser\": \"invalidEmail\" }', \"schema_with_email_format.json\", false)", - "raises": "function call error for \"validate_json_schema\" at (0:99): JSON schema validation failed: \"invalidEmail\" is not a \"email\" at /productUser" - }, - { - "title": "Payload contains a custom format declaration", - "source": "validate_json_schema!(s'{ \"productUser\": \"a-custom-formatted-string\" }', \"schema_with_custom_format.json\", false)", - "raises": "function call error for \"validate_json_schema\" at (0:113): Failed to compile schema: Unknown format: 'my-custom-format'. Adjust configuration to ignore unrecognized formats" - }, - { - "title": "Payload contains a custom format declaration, with ignore_unknown_formats set to true", - "source": "validate_json_schema!(s'{ \"productUser\": \"a-custom-formatted-string\" }', \"schema_with_custom_format.json\", true)", - "return": true - } - ], - "notices": [ - "This function uses a compiled schema cache. The first time it is called with a specific\n`schema_definition`, it will compile the schema and cache it for subsequent calls. This\nimproves performance when validating multiple values against the same schema. The cache\nimplementation is fairly naive and does not support refreshing the schema if it changes.\nIf you update the schema definition file, you must restart Vector to clear the cache." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/values.cue b/website/cue/reference/remap/functions/values.cue deleted file mode 100644 index 46a6239edc762..0000000000000 --- a/website/cue/reference/remap/functions/values.cue +++ /dev/null @@ -1,56 +0,0 @@ -{ - "remap": { - "functions": { - "values": { - "anchor": "values", - "name": "values", - "category": "Enumerate", - "description": "Returns the values from the object passed into the function.", - "arguments": [ - { - "name": "value", - "description": "The object to extract values from.", - "required": true, - "type": [ - "object" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "Returns an array of all the values." - ] - }, - "examples": [ - { - "title": "Get values from the object", - "source": "values({\"key1\": \"val1\", \"key2\": \"val2\"})", - "return": [ - "val1", - "val2" - ] - }, - { - "title": "Get values from a complex object", - "source": "values({\"key1\": \"val1\", \"key2\": [1, 2, 3], \"key3\": {\"foo\": \"bar\"}})", - "return": [ - "val1", - [ - 1, - 2, - 3 - ], - { - "foo": "bar" - } - ] - } - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/xxhash.cue b/website/cue/reference/remap/functions/xxhash.cue deleted file mode 100644 index ee46ff686fad2..0000000000000 --- a/website/cue/reference/remap/functions/xxhash.cue +++ /dev/null @@ -1,68 +0,0 @@ -{ - "remap": { - "functions": { - "xxhash": { - "anchor": "xxhash", - "name": "xxhash", - "category": "Checksum", - "description": "Calculates a [xxHash](https://github.com/DoumanAsh/xxhash-rust) hash of the `value`.", - "arguments": [ - { - "name": "value", - "description": "The string to calculate the hash for.", - "required": true, - "type": [ - "string" - ] - }, - { - "name": "variant", - "description": "The xxHash hashing algorithm to use.", - "required": false, - "type": [ - "string" - ], - "default": "XXH32" - } - ], - "return": { - "types": [ - "string", - "integer" - ] - }, - "examples": [ - { - "title": "Calculate a hash using the default (XXH32) algorithm", - "source": "xxhash(\"foo\")", - "return": 3792637401 - }, - { - "title": "Calculate a hash using the XXH32 algorithm", - "source": "xxhash(\"foo\", \"XXH32\")", - "return": 3792637401 - }, - { - "title": "Calculate a hash using the XXH64 algorithm", - "source": "xxhash(\"foo\", \"XXH64\")", - "return": 3728699739546630719 - }, - { - "title": "Calculate a hash using the XXH3-64 algorithm", - "source": "xxhash(\"foo\", \"XXH3-64\")", - "return": -6093828362558603894 - }, - { - "title": "Calculate a hash using the XXH3-128 algorithm", - "source": "xxhash(\"foo\", \"XXH3-128\")", - "return": "161745101148472925293886522910304009610" - } - ], - "notices": [ - "Due to limitations in the underlying VRL data types, this function converts the unsigned\n64-bit integer hash result to a signed 64-bit integer. Results higher than the signed\n64-bit integer maximum value wrap around to negative values. For the XXH3-128 hash\nalgorithm, values are returned as a string." - ], - "pure": true - } - } - } -} diff --git a/website/cue/reference/remap/functions/zip.cue b/website/cue/reference/remap/functions/zip.cue deleted file mode 100644 index 0bc1c1fe7496a..0000000000000 --- a/website/cue/reference/remap/functions/zip.cue +++ /dev/null @@ -1,117 +0,0 @@ -{ - "remap": { - "functions": { - "zip": { - "anchor": "zip", - "name": "zip", - "category": "Array", - "description": "Iterate over several arrays in parallel, producing a new array containing arrays of items from each source.\nThe resulting array will be as long as the shortest input array, with all the remaining elements dropped.\nThis function is modeled from the `zip` function [in Python](https://docs.python.org/3/library/functions.html#zip),\nbut similar methods can be found in [Ruby](https://docs.ruby-lang.org/en/master/Array.html#method-i-zip)\nand [Rust](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.zip).\n\nIf a single parameter is given, it must contain an array of all the input arrays.", - "arguments": [ - { - "name": "array_0", - "description": "The first array of elements, or the array of input arrays if no other parameter is present.", - "required": true, - "type": [ - "array" - ] - }, - { - "name": "array_1", - "description": "The second array of elements. If not present, the first parameter contains all the arrays.", - "required": false, - "type": [ - "array" - ] - } - ], - "return": { - "types": [ - "array" - ], - "rules": [ - "`zip` is considered fallible if any of the parameters is not an array, or if only the first parameter is present and it is not an array of arrays." - ] - }, - "internal_failure_reasons": [ - "`array_0` and `array_1` must be arrays." - ], - "examples": [ - { - "title": "Merge two arrays", - "source": "zip([1, 2, 3], [4, 5, 6, 7])", - "return": [ - [ - 1, - 4 - ], - [ - 2, - 5 - ], - [ - 3, - 6 - ] - ] - }, - { - "title": "Merge three arrays", - "source": "zip([[1, 2], [3, 4], [5, 6]])", - "return": [ - [ - 1, - 3, - 5 - ], - [ - 2, - 4, - 6 - ] - ] - }, - { - "title": "Merge an array of three arrays into an array of 3-tuples", - "source": "zip([[\"a\", \"b\", \"c\"], [1, null, true], [4, 5, 6]])", - "return": [ - [ - "a", - 1, - 4 - ], - [ - "b", - null, - 5 - ], - [ - "c", - true, - 6 - ] - ] - }, - { - "title": "Merge two array parameters", - "source": "zip([1, 2, 3, 4], [5, 6, 7])", - "return": [ - [ - 1, - 5 - ], - [ - 2, - 6 - ], - [ - 3, - 7 - ] - ] - } - ], - "pure": true - } - } - } -} From 809dff06a2154b20c01867bd06a0d63be84d8d6a Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 27 Feb 2026 10:54:35 -0500 Subject: [PATCH 41/44] Bump branch sha --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8033b7a291bcd..f54d6b6ac6867 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13093,7 +13093,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=doc-generation#21110752aba0978591f86b6333483d72e1f35d26" +source = "git+https://github.com/vectordotdev/vrl.git?branch=doc-generation#054d17e5c4731d262a4ee7540700505f4c7cf48d" dependencies = [ "aes", "aes-siv", From 6f78059102732bfacf4c0544701ab5f3825c3fdf Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 27 Feb 2026 10:57:02 -0500 Subject: [PATCH 42/44] Add generate-vrl-docs to check-docs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4efb1fa8c77e0..6027d34297827 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,7 @@ check-clippy: ## Check code with Clippy ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check rust .PHONY: check-docs -check-docs: ## Check that all /docs file are valid +check-docs: generate-vrl-docs ## Check that all /docs file are valid - vrl docs due to remap.functions.* references ${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check docs .PHONY: check-fmt From 2f50f3356c43a482e9e1d4f281ab6f4497f31046 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 27 Feb 2026 10:59:23 -0500 Subject: [PATCH 43/44] Add amplify.yml --- amplify.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 amplify.yml diff --git a/amplify.yml b/amplify.yml new file mode 100644 index 0000000000000..e63bd47520953 --- /dev/null +++ b/amplify.yml @@ -0,0 +1,55 @@ +version: 1 +applications: + - frontend: + phases: + preBuild: + commands: + - /dd_start_script.sh + - source ~/.nvm/nvm.sh + - nvm use $VERSION_NODE_20 + - echo "Installing Make..." + - apt-get update + - apt-get install -y make + - make -v + - echo "Installing Cuelang..." + - curl -LO "https://github.com/cue-lang/cue/releases/download/v0.6.0/cue_v0.6.0_linux_amd64.tar.gz" + - mkdir tmp_cue_install + - tar xzf cue_v0.6.0_linux_amd64.tar.gz -C tmp_cue_install + - mv tmp_cue_install/cue /usr/local/bin/ + - rm -rf tmp_cue_install + - cue version + - echo "Installing htmltest..." + - curl -LO "https://github.com/wjdp/htmltest/releases/download/v0.17.0/htmltest_0.17.0_linux_amd64.tar.gz" + - tar xzf htmltest_0.17.0_linux_amd64.tar.gz + - mv htmltest /usr/local/bin/ + - htmltest --version + - echo "Installing Hugo v${HUGO_VERSION}..." + - curl -LO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" + - tar xzf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz + - mv hugo /usr/local/bin/ + - hugo version + - echo "Installing Rust..." + - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + - source ~/.cargo/env + - rustup install + - echo "Compiling VDEV..." + - cargo build -p vdev + - export VDEV=target/debug/vdev + + build: + commands: + - make generate-vrl-docs + - DEPLOY_PRIME_URL=$(echo "https://$(echo "${AWS_BRANCH}" | sed 's/[./]/-/g').d1a7j77663uxsc.amplifyapp.com" ) + - if [[ "${AWS_BRANCH}" == "website" ]]; then DEPLOY_COMMAND="ci-production-build"; fi + - cd website && make $DEPLOY_COMMAND | tee -a /var/log/amplify-build.log + postBuild: + commands: + - datadog-agent stop + artifacts: + baseDirectory: website/public + files: + - '**/*' + cache: + paths: + - website/node_modules/**/* + appRoot: / From 88001556210726bb9ce3e7527b36a8feeac9b74f Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 27 Feb 2026 11:06:00 -0500 Subject: [PATCH 44/44] Use __doc_paths --- Cargo.lock | 2 +- vdev/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f54d6b6ac6867..3ba0ce2f4afd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13093,7 +13093,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "vrl" version = "0.30.0" -source = "git+https://github.com/vectordotdev/vrl.git?branch=doc-generation#054d17e5c4731d262a4ee7540700505f4c7cf48d" +source = "git+https://github.com/vectordotdev/vrl.git?branch=doc-generation#b649a29ac4c6d356c3d281c3e6973846bdf38e16" dependencies = [ "aes", "aes-siv", diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index 7d829cc9b0d4e..4c447e188cced 100644 --- a/vdev/Cargo.toml +++ b/vdev/Cargo.toml @@ -47,7 +47,7 @@ git2 = { version = "0.20.4" } cfg-if.workspace = true vector-vrl-functions = { path = "../lib/vector-vrl/functions", features = ["dnstap", "vrl-metrics"] } # Only here for docs generation. Using vrl with this feature enabled will be severely broken -vrl = { workspace = true, features = ["__mock_return_values_for_tests"] } +vrl = { workspace = true, features = ["__mock_return_values_for_tests", "__doc_paths"] } [package.metadata.binstall] pkg-url = "{ repo }/releases/download/vdev-v{ version }/{ name }-{ target }-v{ version }.tgz"