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" diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index edc77d73e5612..f9150d1f833fa 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -677,3 +677,159 @@ zork zorp zsherman zulip +AAAAA +AAAAAAAAAAAADAw +AAAAAQAAAAAAAQJo +AAAEAAQAAKQIAAACAAAAMAAo +AAIBUa +AAQ +AAluby +ABAAAp +ACGAEi +ADw +AGAAb +Agb +Agiw +Ayv +BCJNGGB +BFEKPXCj +BNABAUAAADk +BTRV +Bkbn +Bpd +Bvdm +Bym +Bzd +CBm +CBqd +CODVA +CRW +Cgdzb +Clb +EAAAAAAAAAAAAAAAAAAAAAAq +ECABBQ +EIAx +Evnmki +FABI +FAJs +FOOBARBAZ +Fpb +Fsd +Fworld +Fyd +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 +RQA +RQX +SBkb +TLp +UDY +Ugc +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 diff --git a/.github/workflows/changes.yml b/.github/workflows/changes.yml index 256b74969cab6..a057df36dc312 100644 --- a/.github/workflows/changes.yml +++ b/.github/workflows/changes.yml @@ -222,7 +222,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/Cargo.lock b/Cargo.lock index 961a82a267cba..3ba0ce2f4afd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12459,6 +12459,8 @@ dependencies = [ "tempfile", "toml 0.9.8", "toml_edit 0.23.9", + "vector-vrl-functions", + "vrl", ] [[package]] @@ -13091,7 +13093,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=doc-generation#b649a29ac4c6d356c3d281c3e6973846bdf38e16" dependencies = [ "aes", "aes-siv", diff --git a/Cargo.toml b/Cargo.toml index 56e3376b29f02..6f4fbe113d467 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/Makefile b/Makefile index f87b9b445e998..6027d34297827 100644 --- a/Makefile +++ b/Makefile @@ -472,7 +472,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 @@ -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 @@ -514,9 +514,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 @@ -694,6 +694,14 @@ generate-component-docs: ## Generate per-component Cue docs from the configurati $(if $(findstring true,$(CI)),>/dev/null,) ./scripts/cue.sh fmt +.PHONY: generate-vrl-docs +generate-vrl-docs: ## Generate VRL function documentation from Rust source. + ${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 scripts/signoff.sh 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: / 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/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() { diff --git a/vdev/Cargo.toml b/vdev/Cargo.toml index 8e540db8d0099..4c447e188cced 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 @@ -45,6 +45,9 @@ semver.workspace = true indoc.workspace = true 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", "__doc_paths"] } [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..e105ea9cda338 --- /dev/null +++ b/vdev/src/commands/build/vrl_docs.rs @@ -0,0 +1,58 @@ +use anyhow::Result; +use indexmap::IndexMap; +use serde::Serialize; +use std::{fs, path::PathBuf}; +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 VRL and +/// generates a generated.cue documentation file with all functions' documentation. +#[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: IndexMap, +} + +impl Cli { + pub fn exec(self) -> Result<()> { + let functions = vector_vrl_functions::all(); + + let docs = build_functions_doc(&functions); + let functions_map = docs + .into_iter() + .map(|doc| (doc.name.clone(), doc)) + .collect(); + + let wrapper = FunctionDocWrapper { + remap: RemapWrapper { + functions: functions_map, + }, + }; + + // Ensure output directory exists + fs::create_dir_all(&self.output_dir)?; + + 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!("\nVRL documentation generation complete."); + Ok(()) + } +} 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, diff --git a/website/cue/reference/remap.cue b/website/cue/reference/remap.cue index 93aa2e0d074af..fdbf88a259e48 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?: {...} + } + #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 } 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 f8aad893be3a9..0000000000000 --- a/website/cue/reference/remap/functions/abs.cue +++ /dev/null @@ -1,41 +0,0 @@ -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 - }, - ] -} 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 cdf2c0141dd70..0000000000000 --- a/website/cue/reference/remap/functions/aggregate_vector_metrics.cue +++ /dev/null @@ -1,82 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/append.cue b/website/cue/reference/remap/functions/append.cue deleted file mode 100644 index 289c62296cd40..0000000000000 --- a/website/cue/reference/remap/functions/append.cue +++ /dev/null @@ -1,35 +0,0 @@ -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] - }, - ] -} diff --git a/website/cue/reference/remap/functions/array.cue b/website/cue/reference/remap/functions/array.cue deleted file mode 100644 index 9a249ce918dc0..0000000000000 --- a/website/cue/reference/remap/functions/array.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/assert.cue b/website/cue/reference/remap/functions/assert.cue deleted file mode 100644 index 6e7d905ac425b..0000000000000 --- a/website/cue/reference/remap/functions/assert.cue +++ /dev/null @@ -1,58 +0,0 @@ -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"!"# - }, - ] -} 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 97f172470122f..0000000000000 --- a/website/cue/reference/remap/functions/assert_eq.cue +++ /dev/null @@ -1,69 +0,0 @@ -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"# - }, - ] -} diff --git a/website/cue/reference/remap/functions/basename.cue b/website/cue/reference/remap/functions/basename.cue deleted file mode 100644 index 1d0c4d88eb315..0000000000000 --- a/website/cue/reference/remap/functions/basename.cue +++ /dev/null @@ -1,53 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/bool.cue b/website/cue/reference/remap/functions/bool.cue deleted file mode 100644 index e7fa4398e5969..0000000000000 --- a/website/cue/reference/remap/functions/bool.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/camelcase.cue b/website/cue/reference/remap/functions/camelcase.cue deleted file mode 100644 index 9c8eb246ec617..0000000000000 --- a/website/cue/reference/remap/functions/camelcase.cue +++ /dev/null @@ -1,43 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/ceil.cue b/website/cue/reference/remap/functions/ceil.cue deleted file mode 100644 index 8b7175ed60dc7..0000000000000 --- a/website/cue/reference/remap/functions/ceil.cue +++ /dev/null @@ -1,48 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/chunks.cue b/website/cue/reference/remap/functions/chunks.cue deleted file mode 100644 index 3ad4cf375badf..0000000000000 --- a/website/cue/reference/remap/functions/chunks.cue +++ /dev/null @@ -1,50 +0,0 @@ -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�", "�好"] - }, - ] -} 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 f03541319d158..0000000000000 --- a/website/cue/reference/remap/functions/community_id.cue +++ /dev/null @@ -1,59 +0,0 @@ -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=" - }, - ] -} diff --git a/website/cue/reference/remap/functions/compact.cue b/website/cue/reference/remap/functions/compact.cue deleted file mode 100644 index d64f0104064bd..0000000000000 --- a/website/cue/reference/remap/functions/compact.cue +++ /dev/null @@ -1,83 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/contains.cue b/website/cue/reference/remap/functions/contains.cue deleted file mode 100644 index c12d36edb5df5..0000000000000 --- a/website/cue/reference/remap/functions/contains.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] -} 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 dfd7cf07eeb78..0000000000000 --- a/website/cue/reference/remap/functions/contains_all.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] - -} diff --git a/website/cue/reference/remap/functions/crc.cue b/website/cue/reference/remap/functions/crc.cue deleted file mode 100644 index d42e6faf5fd70..0000000000000 --- a/website/cue/reference/remap/functions/crc.cue +++ /dev/null @@ -1,164 +0,0 @@ -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" - }, - ] -} 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 12cb4d4959a9e..0000000000000 --- a/website/cue/reference/remap/functions/decode_base16.cue +++ /dev/null @@ -1,31 +0,0 @@ -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" - }, - ] -} 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 1ba2efbef296c..0000000000000 --- a/website/cue/reference/remap/functions/decode_base64.cue +++ /dev/null @@ -1,49 +0,0 @@ -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" - }, - ] -} 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 8d1d35fc90510..0000000000000 --- a/website/cue/reference/remap/functions/decode_charset.cue +++ /dev/null @@ -1,52 +0,0 @@ -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: "你好" - }, - ] -} 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 099a3e53a0400..0000000000000 --- a/website/cue/reference/remap/functions/decode_gzip.cue +++ /dev/null @@ -1,32 +0,0 @@ -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" - }, - ] -} 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 a77cd38f0ffb6..0000000000000 --- a/website/cue/reference/remap/functions/decode_lz4.cue +++ /dev/null @@ -1,59 +0,0 @@ -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." - }, - ] -} 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 31b725df90f1c..0000000000000 --- a/website/cue/reference/remap/functions/decode_mime_q.cue +++ /dev/null @@ -1,45 +0,0 @@ -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!" - }, - ] -} 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 9c355792e1676..0000000000000 --- a/website/cue/reference/remap/functions/decode_percent.cue +++ /dev/null @@ -1,29 +0,0 @@ -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?" - }, - ] -} 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 89491b4971877..0000000000000 --- a/website/cue/reference/remap/functions/decode_punycode.cue +++ /dev/null @@ -1,52 +0,0 @@ -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: "١٠.٦٦.٣٠.٥." - }, - ] -} 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 473613297267e..0000000000000 --- a/website/cue/reference/remap/functions/decode_snappy.cue +++ /dev/null @@ -1,32 +0,0 @@ -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." - }, - ] -} 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 2fe4f4aa5a1d7..0000000000000 --- a/website/cue/reference/remap/functions/decode_zlib.cue +++ /dev/null @@ -1,32 +0,0 @@ -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." - }, - ] -} 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 8b20e55e81337..0000000000000 --- a/website/cue/reference/remap/functions/decode_zstd.cue +++ /dev/null @@ -1,32 +0,0 @@ -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." - }, - ] -} diff --git a/website/cue/reference/remap/functions/decrypt.cue b/website/cue/reference/remap/functions/decrypt.cue deleted file mode 100644 index 2f53615d721ee..0000000000000 --- a/website/cue/reference/remap/functions/decrypt.cue +++ /dev/null @@ -1,93 +0,0 @@ -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" - }, - ] -} 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 8bc782c68c7ef..0000000000000 --- a/website/cue/reference/remap/functions/decrypt_ip.cue +++ /dev/null @@ -1,93 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/del.cue b/website/cue/reference/remap/functions/del.cue deleted file mode 100644 index 5a825aa6e40f7..0000000000000 --- a/website/cue/reference/remap/functions/del.cue +++ /dev/null @@ -1,62 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/dirname.cue b/website/cue/reference/remap/functions/dirname.cue deleted file mode 100644 index a8bac71de6c84..0000000000000 --- a/website/cue/reference/remap/functions/dirname.cue +++ /dev/null @@ -1,60 +0,0 @@ -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: "." - }, - ] -} diff --git a/website/cue/reference/remap/functions/downcase.cue b/website/cue/reference/remap/functions/downcase.cue deleted file mode 100644 index 1feb707899324..0000000000000 --- a/website/cue/reference/remap/functions/downcase.cue +++ /dev/null @@ -1,30 +0,0 @@ -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!" - }, - ] -} 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 b93cbb9843113..0000000000000 --- a/website/cue/reference/remap/functions/encode_base16.cue +++ /dev/null @@ -1,29 +0,0 @@ -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" - }, - ] -} 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 840d8cd321337..0000000000000 --- a/website/cue/reference/remap/functions/encode_base64.cue +++ /dev/null @@ -1,61 +0,0 @@ -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=" - }, - ] -} 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 9bb98b04adafa..0000000000000 --- a/website/cue/reference/remap/functions/encode_charset.cue +++ /dev/null @@ -1,52 +0,0 @@ -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==" - }, - ] -} 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 a30c545dfe8ec..0000000000000 --- a/website/cue/reference/remap/functions/encode_gzip.cue +++ /dev/null @@ -1,37 +0,0 @@ -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" - }, - ] -} 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 1757905cf7ee6..0000000000000 --- a/website/cue/reference/remap/functions/encode_json.cue +++ /dev/null @@ -1,35 +0,0 @@ -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"}"# - }, - ] -} 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 2af964dab8f6b..0000000000000 --- a/website/cue/reference/remap/functions/encode_key_value.cue +++ /dev/null @@ -1,108 +0,0 @@ -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"# - }, - ] -} 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 9fa01e746a7b4..0000000000000 --- a/website/cue/reference/remap/functions/encode_logfmt.cue +++ /dev/null @@ -1,59 +0,0 @@ -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"# - }, - ] -} 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 66ebe7e45bcd9..0000000000000 --- a/website/cue/reference/remap/functions/encode_lz4.cue +++ /dev/null @@ -1,39 +0,0 @@ -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=" - }, - ] -} 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 c6f9a3d61b0c7..0000000000000 --- a/website/cue/reference/remap/functions/encode_percent.cue +++ /dev/null @@ -1,54 +0,0 @@ -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" - }, - ] -} 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 253bcf01e9241..0000000000000 --- a/website/cue/reference/remap/functions/encode_proto.cue +++ /dev/null @@ -1,52 +0,0 @@ -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=="# - }, - ] -} 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 d5d72439f7a86..0000000000000 --- a/website/cue/reference/remap/functions/encode_punycode.cue +++ /dev/null @@ -1,59 +0,0 @@ -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." - }, - ] -} 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 f8a56c9ca653a..0000000000000 --- a/website/cue/reference/remap/functions/encode_snappy.cue +++ /dev/null @@ -1,32 +0,0 @@ -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==" - }, - ] -} 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 73921d92c3a17..0000000000000 --- a/website/cue/reference/remap/functions/encode_zlib.cue +++ /dev/null @@ -1,37 +0,0 @@ -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" - }, - ] -} 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 fb9cf17296a78..0000000000000 --- a/website/cue/reference/remap/functions/encode_zstd.cue +++ /dev/null @@ -1,37 +0,0 @@ -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==" - }, - ] -} diff --git a/website/cue/reference/remap/functions/encrypt.cue b/website/cue/reference/remap/functions/encrypt.cue deleted file mode 100644 index 0703654e9ba2e..0000000000000 --- a/website/cue/reference/remap/functions/encrypt.cue +++ /dev/null @@ -1,93 +0,0 @@ -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=" - }, - ] -} 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 5888f2c22055a..0000000000000 --- a/website/cue/reference/remap/functions/encrypt_ip.cue +++ /dev/null @@ -1,80 +0,0 @@ -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" - }, - ] -} 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 4251fe0146ea4..0000000000000 --- a/website/cue/reference/remap/functions/ends_with.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/exists.cue b/website/cue/reference/remap/functions/exists.cue deleted file mode 100644 index ec37aa5ae7558..0000000000000 --- a/website/cue/reference/remap/functions/exists.cue +++ /dev/null @@ -1,43 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/filter.cue b/website/cue/reference/remap/functions/filter.cue deleted file mode 100644 index 690d4b845234a..0000000000000 --- a/website/cue/reference/remap/functions/filter.cue +++ /dev/null @@ -1,50 +0,0 @@ -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"] - }, - ] -} diff --git a/website/cue/reference/remap/functions/find.cue b/website/cue/reference/remap/functions/find.cue deleted file mode 100644 index 5cf6bd3ab1283..0000000000000 --- a/website/cue/reference/remap/functions/find.cue +++ /dev/null @@ -1,64 +0,0 @@ -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 - }, - ] -} 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 1848f163edd4d..0000000000000 --- a/website/cue/reference/remap/functions/find_enrichment_table_records.cue +++ /dev/null @@ -1,93 +0,0 @@ -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"}, - ] - }, - ] -} 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 dbfbd230a859d..0000000000000 --- a/website/cue/reference/remap/functions/find_vector_metrics.cue +++ /dev/null @@ -1,48 +0,0 @@ -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}] - }, - ] -} diff --git a/website/cue/reference/remap/functions/flatten.cue b/website/cue/reference/remap/functions/flatten.cue deleted file mode 100644 index 13f86f79a2318..0000000000000 --- a/website/cue/reference/remap/functions/flatten.cue +++ /dev/null @@ -1,60 +0,0 @@ -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 - } - }, - ] -} diff --git a/website/cue/reference/remap/functions/float.cue b/website/cue/reference/remap/functions/float.cue deleted file mode 100644 index 122390344dcfa..0000000000000 --- a/website/cue/reference/remap/functions/float.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/floor.cue b/website/cue/reference/remap/functions/floor.cue deleted file mode 100644 index 3c9bb578297c7..0000000000000 --- a/website/cue/reference/remap/functions/floor.cue +++ /dev/null @@ -1,48 +0,0 @@ -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 - }, - ] -} 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 2d7697e1c5462..0000000000000 --- a/website/cue/reference/remap/functions/for_each.cue +++ /dev/null @@ -1,57 +0,0 @@ -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} - }, - ] -} 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 dfa689ba42d5f..0000000000000 --- a/website/cue/reference/remap/functions/format_int.cue +++ /dev/null @@ -1,45 +0,0 @@ -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" - }, - ] -} 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 c785f603790f4..0000000000000 --- a/website/cue/reference/remap/functions/format_number.cue +++ /dev/null @@ -1,49 +0,0 @@ -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" - }, - ] -} 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 21db108fd17a0..0000000000000 --- a/website/cue/reference/remap/functions/format_timestamp.cue +++ /dev/null @@ -1,48 +0,0 @@ -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" - }, - ] -} 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 a4eb4a1b08d38..0000000000000 --- a/website/cue/reference/remap/functions/from_unix_timestamp.cue +++ /dev/null @@ -1,58 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/get.cue b/website/cue/reference/remap/functions/get.cue deleted file mode 100644 index bbdb3060e57df..0000000000000 --- a/website/cue/reference/remap/functions/get.cue +++ /dev/null @@ -1,57 +0,0 @@ -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" - }, - ] -} 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 9aae8266392b0..0000000000000 --- a/website/cue/reference/remap/functions/get_enrichment_table_record.cue +++ /dev/null @@ -1,94 +0,0 @@ -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"} - }, - ] -} 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 b0cae2474dc17..0000000000000 --- a/website/cue/reference/remap/functions/get_env_var.cue +++ /dev/null @@ -1,32 +0,0 @@ -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" - }, - ] -} 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 474dc6949f113..0000000000000 --- a/website/cue/reference/remap/functions/get_hostname.cue +++ /dev/null @@ -1,25 +0,0 @@ -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" - }, - ] -} 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 8cd5e12844448..0000000000000 --- a/website/cue/reference/remap/functions/get_secret.cue +++ /dev/null @@ -1,31 +0,0 @@ -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" - }, - ] -} 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 e094b1208a5b1..0000000000000 --- a/website/cue/reference/remap/functions/get_timezone_name.cue +++ /dev/null @@ -1,31 +0,0 @@ -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" - }, - ] -} 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 2ecb5ee6948f5..0000000000000 --- a/website/cue/reference/remap/functions/get_vector_metric.cue +++ /dev/null @@ -1,48 +0,0 @@ -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} - }, - ] -} diff --git a/website/cue/reference/remap/functions/haversine.cue b/website/cue/reference/remap/functions/haversine.cue deleted file mode 100644 index ce186df426fea..0000000000000 --- a/website/cue/reference/remap/functions/haversine.cue +++ /dev/null @@ -1,72 +0,0 @@ -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 - } - }, - ] -} diff --git a/website/cue/reference/remap/functions/hmac.cue b/website/cue/reference/remap/functions/hmac.cue deleted file mode 100644 index 5d6972352f7c6..0000000000000 --- a/website/cue/reference/remap/functions/hmac.cue +++ /dev/null @@ -1,75 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/includes.cue b/website/cue/reference/remap/functions/includes.cue deleted file mode 100644 index 2719c42e1401e..0000000000000 --- a/website/cue/reference/remap/functions/includes.cue +++ /dev/null @@ -1,35 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/int.cue b/website/cue/reference/remap/functions/int.cue deleted file mode 100644 index 6d754a63ffd4a..0000000000000 --- a/website/cue/reference/remap/functions/int.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} 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 ec0e9faa32b32..0000000000000 --- a/website/cue/reference/remap/functions/ip_aton.cue +++ /dev/null @@ -1,34 +0,0 @@ -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 - }, - ] -} 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 ea435ec498c74..0000000000000 --- a/website/cue/reference/remap/functions/ip_cidr_contains.cue +++ /dev/null @@ -1,52 +0,0 @@ -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 - }, - ] -} 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 26cb3aa300835..0000000000000 --- a/website/cue/reference/remap/functions/ip_ntoa.cue +++ /dev/null @@ -1,34 +0,0 @@ -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" - }, - ] -} 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 4389b8fd386d7..0000000000000 --- a/website/cue/reference/remap/functions/ip_ntop.cue +++ /dev/null @@ -1,52 +0,0 @@ -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" - }, - ] -} 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 2ec24fe4df180..0000000000000 --- a/website/cue/reference/remap/functions/ip_pton.cue +++ /dev/null @@ -1,51 +0,0 @@ -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==" - }, - ] -} 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 42b0a45df69be..0000000000000 --- a/website/cue/reference/remap/functions/ip_subnet.cue +++ /dev/null @@ -1,54 +0,0 @@ -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::" - }, - ] -} 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 d1eb75082d8f2..0000000000000 --- a/website/cue/reference/remap/functions/ip_to_ipv6.cue +++ /dev/null @@ -1,37 +0,0 @@ -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" - }, - ] -} 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 fab14bde1117a..0000000000000 --- a/website/cue/reference/remap/functions/ipv6_to_ipv4.cue +++ /dev/null @@ -1,41 +0,0 @@ -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" - }, - ] -} 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 a72eb1589c94f..0000000000000 --- a/website/cue/reference/remap/functions/is_array.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 e4e7ce3a3b610..0000000000000 --- a/website/cue/reference/remap/functions/is_boolean.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 0aa22c1d2dd73..0000000000000 --- a/website/cue/reference/remap/functions/is_empty.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] -} 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 a50f1c964907c..0000000000000 --- a/website/cue/reference/remap/functions/is_float.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 6148399aee575..0000000000000 --- a/website/cue/reference/remap/functions/is_integer.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 fc3a20a94fcdd..0000000000000 --- a/website/cue/reference/remap/functions/is_ipv4.cue +++ /dev/null @@ -1,53 +0,0 @@ -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 - }, - ] -} 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 14761f3e3ace8..0000000000000 --- a/website/cue/reference/remap/functions/is_ipv6.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] -} 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 2a24a2e606e36..0000000000000 --- a/website/cue/reference/remap/functions/is_json.cue +++ /dev/null @@ -1,70 +0,0 @@ -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 - }, - ] -} 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 bc85c5c378480..0000000000000 --- a/website/cue/reference/remap/functions/is_null.cue +++ /dev/null @@ -1,43 +0,0 @@ -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 - }, - ] -} 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 7f3adaa0f4dcd..0000000000000 --- a/website/cue/reference/remap/functions/is_nullish.cue +++ /dev/null @@ -1,59 +0,0 @@ -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 - }, - ] -} 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 86258aa1ca2c4..0000000000000 --- a/website/cue/reference/remap/functions/is_object.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 4693aebaa0b5e..0000000000000 --- a/website/cue/reference/remap/functions/is_regex.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 fd1a3b9c7c8ba..0000000000000 --- a/website/cue/reference/remap/functions/is_string.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 54f24b4d9b474..0000000000000 --- a/website/cue/reference/remap/functions/is_timestamp.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/join.cue b/website/cue/reference/remap/functions/join.cue deleted file mode 100644 index fb699d1bcca5e..0000000000000 --- a/website/cue/reference/remap/functions/join.cue +++ /dev/null @@ -1,45 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/kebabcase.cue b/website/cue/reference/remap/functions/kebabcase.cue deleted file mode 100644 index 8e113b7d2189c..0000000000000 --- a/website/cue/reference/remap/functions/kebabcase.cue +++ /dev/null @@ -1,43 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/keys.cue b/website/cue/reference/remap/functions/keys.cue deleted file mode 100644 index be3c493fa612f..0000000000000 --- a/website/cue/reference/remap/functions/keys.cue +++ /dev/null @@ -1,37 +0,0 @@ -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"] - }, - ] -} diff --git a/website/cue/reference/remap/functions/length.cue b/website/cue/reference/remap/functions/length.cue deleted file mode 100644 index 9f685e66c5697..0000000000000 --- a/website/cue/reference/remap/functions/length.cue +++ /dev/null @@ -1,75 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/log.cue b/website/cue/reference/remap/functions/log.cue deleted file mode 100644 index 26b885198bb6b..0000000000000 --- a/website/cue/reference/remap/functions/log.cue +++ /dev/null @@ -1,66 +0,0 @@ -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 - }, - ] -} 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 b4b835f2dce18..0000000000000 --- a/website/cue/reference/remap/functions/map_keys.cue +++ /dev/null @@ -1,87 +0,0 @@ -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" - } - } - }, - ] -} 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 fdfc8548dca40..0000000000000 --- a/website/cue/reference/remap/functions/map_values.cue +++ /dev/null @@ -1,63 +0,0 @@ -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"} - }, - ] -} diff --git a/website/cue/reference/remap/functions/match.cue b/website/cue/reference/remap/functions/match.cue deleted file mode 100644 index 4ee82bdb5a574..0000000000000 --- a/website/cue/reference/remap/functions/match.cue +++ /dev/null @@ -1,42 +0,0 @@ -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 - }, - ] -} 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 1dc0767d9623b..0000000000000 --- a/website/cue/reference/remap/functions/match_any.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} 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 c45d46c2654f2..0000000000000 --- a/website/cue/reference/remap/functions/match_array.cue +++ /dev/null @@ -1,63 +0,0 @@ -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 - }, - ] -} 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 bef981f5792e6..0000000000000 --- a/website/cue/reference/remap/functions/match_datadog_query.cue +++ /dev/null @@ -1,56 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/md5.cue b/website/cue/reference/remap/functions/md5.cue deleted file mode 100644 index 623b525bc3bfe..0000000000000 --- a/website/cue/reference/remap/functions/md5.cue +++ /dev/null @@ -1,29 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/merge.cue b/website/cue/reference/remap/functions/merge.cue deleted file mode 100644 index 4aa33b6af856c..0000000000000 --- a/website/cue/reference/remap/functions/merge.cue +++ /dev/null @@ -1,104 +0,0 @@ -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 - } - }, - ] -} diff --git a/website/cue/reference/remap/functions/mod.cue b/website/cue/reference/remap/functions/mod.cue deleted file mode 100644 index 8241f50a9b52e..0000000000000 --- a/website/cue/reference/remap/functions/mod.cue +++ /dev/null @@ -1,39 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/now.cue b/website/cue/reference/remap/functions/now.cue deleted file mode 100644 index cffe9accb726f..0000000000000 --- a/website/cue/reference/remap/functions/now.cue +++ /dev/null @@ -1,22 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/object.cue b/website/cue/reference/remap/functions/object.cue deleted file mode 100644 index adfc2446538cf..0000000000000 --- a/website/cue/reference/remap/functions/object.cue +++ /dev/null @@ -1,41 +0,0 @@ -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 - }, - ] -} 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 1bb29246375ab..0000000000000 --- a/website/cue/reference/remap/functions/object_from_array.cue +++ /dev/null @@ -1,54 +0,0 @@ -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} - }, - ] -} 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 8da0fbdf0c0d5..0000000000000 --- a/website/cue/reference/remap/functions/parse_apache_log.cue +++ /dev/null @@ -1,114 +0,0 @@ -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" - } - }, - ] -} 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 21f87d19aa227..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_alb_log.cue +++ /dev/null @@ -1,116 +0,0 @@ -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 - } - }, - ] -} 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 4a24c2ec7cd23..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_cloudwatch_log_subscription_message.cue +++ /dev/null @@ -1,61 +0,0 @@ -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" - }] - } - }, - ] -} 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 d64042b9905a4..0000000000000 --- a/website/cue/reference/remap/functions/parse_aws_vpc_flow_log.cue +++ /dev/null @@ -1,107 +0,0 @@ -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" - } - }, - ] -} 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 290c8e752e756..0000000000000 --- a/website/cue/reference/remap/functions/parse_bytes.cue +++ /dev/null @@ -1,73 +0,0 @@ -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 - }, - ] -} 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 5cf99d1ae0e58..0000000000000 --- a/website/cue/reference/remap/functions/parse_cbor.cue +++ /dev/null @@ -1,36 +0,0 @@ -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" - }, - ] -} 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 5c1d7a415692e..0000000000000 --- a/website/cue/reference/remap/functions/parse_cef.cue +++ /dev/null @@ -1,107 +0,0 @@ -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" - } - }, - ] -} 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 29acc391c2a78..0000000000000 --- a/website/cue/reference/remap/functions/parse_common_log.cue +++ /dev/null @@ -1,80 +0,0 @@ -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 - } - }, - ] -} 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 fc1f01f2517c1..0000000000000 --- a/website/cue/reference/remap/functions/parse_csv.cue +++ /dev/null @@ -1,51 +0,0 @@ -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"] - }, - ] -} 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 de91822af17d7..0000000000000 --- a/website/cue/reference/remap/functions/parse_dnstap.cue +++ /dev/null @@ -1,142 +0,0 @@ -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" - } - }, - ] -} 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 9eb82dacc97ae..0000000000000 --- a/website/cue/reference/remap/functions/parse_duration.cue +++ /dev/null @@ -1,56 +0,0 @@ -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 - }, - ] -} 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 781a1e845ab67..0000000000000 --- a/website/cue/reference/remap/functions/parse_etld.cue +++ /dev/null @@ -1,90 +0,0 @@ -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 - } - }, - ] -} 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 ebf6b9394b9c1..0000000000000 --- a/website/cue/reference/remap/functions/parse_float.cue +++ /dev/null @@ -1,40 +0,0 @@ -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 - }, - ] - -} 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 3fc76b44ca2b5..0000000000000 --- a/website/cue/reference/remap/functions/parse_glog.cue +++ /dev/null @@ -1,36 +0,0 @@ -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!" - } - }, - ] -} 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 c207ae4f829b2..0000000000000 --- a/website/cue/reference/remap/functions/parse_grok.cue +++ /dev/null @@ -1,51 +0,0 @@ -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" - } - }, - ] -} 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 b3ca8625a7679..0000000000000 --- a/website/cue/reference/remap/functions/parse_groks.cue +++ /dev/null @@ -1,93 +0,0 @@ -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 - }, - ] -} 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 b220fa0180c5e..0000000000000 --- a/website/cue/reference/remap/functions/parse_influxdb.cue +++ /dev/null @@ -1,109 +0,0 @@ -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 - } - }, - ] - }, - ] -} 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 6c03784ba0117..0000000000000 --- a/website/cue/reference/remap/functions/parse_int.cue +++ /dev/null @@ -1,72 +0,0 @@ -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 - }, - ] -} 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 bc7b561b93af3..0000000000000 --- a/website/cue/reference/remap/functions/parse_json.cue +++ /dev/null @@ -1,64 +0,0 @@ -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\"}" - }, - ] -} 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 e2e28211eec3b..0000000000000 --- a/website/cue/reference/remap/functions/parse_key_value.cue +++ /dev/null @@ -1,134 +0,0 @@ -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"] - } - }, - ] -} 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 7d6cfb0464e5a..0000000000000 --- a/website/cue/reference/remap/functions/parse_klog.cue +++ /dev/null @@ -1,41 +0,0 @@ -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" - } - }, - ] -} 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 216898569da0d..0000000000000 --- a/website/cue/reference/remap/functions/parse_linux_authorization.cue +++ /dev/null @@ -1,46 +0,0 @@ -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" - } - }, - ] -} 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 74332c1cd7fc7..0000000000000 --- a/website/cue/reference/remap/functions/parse_logfmt.cue +++ /dev/null @@ -1,45 +0,0 @@ -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" - } - }, - ] -} 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 4e2ab088b7d82..0000000000000 --- a/website/cue/reference/remap/functions/parse_nginx_log.cue +++ /dev/null @@ -1,149 +0,0 @@ -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" - } - }, - ] -} 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 29557895e0df3..0000000000000 --- a/website/cue/reference/remap/functions/parse_proto.cue +++ /dev/null @@ -1,65 +0,0 @@ -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" - }, - ] - } - }, - ] -} 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 a5bc4308db839..0000000000000 --- a/website/cue/reference/remap/functions/parse_query_string.cue +++ /dev/null @@ -1,47 +0,0 @@ -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"] - } - }, - ] -} 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 fc95669169749..0000000000000 --- a/website/cue/reference/remap/functions/parse_regex.cue +++ /dev/null @@ -1,78 +0,0 @@ -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" - } - }, - ] -} 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 0607a3fec176d..0000000000000 --- a/website/cue/reference/remap/functions/parse_regex_all.cue +++ /dev/null @@ -1,68 +0,0 @@ -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" - }, - ] - }, - ] -} 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 9d733c6ea2c5c..0000000000000 --- a/website/cue/reference/remap/functions/parse_ruby_hash.cue +++ /dev/null @@ -1,45 +0,0 @@ -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 - } - } - }, - ] -} 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 cb17be2b04146..0000000000000 --- a/website/cue/reference/remap/functions/parse_syslog.cue +++ /dev/null @@ -1,58 +0,0 @@ -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 - } - }, - ] -} 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 a47aaa2aa6133..0000000000000 --- a/website/cue/reference/remap/functions/parse_timestamp.cue +++ /dev/null @@ -1,54 +0,0 @@ -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" - }, - ] -} 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 c76fb6e2f6ef2..0000000000000 --- a/website/cue/reference/remap/functions/parse_tokens.cue +++ /dev/null @@ -1,42 +0,0 @@ -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"] - }, - ] -} 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 0d69d7842dde9..0000000000000 --- a/website/cue/reference/remap/functions/parse_url.cue +++ /dev/null @@ -1,100 +0,0 @@ -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 - } - }, - ] -} 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 3f0717ff5a292..0000000000000 --- a/website/cue/reference/remap/functions/parse_user_agent.cue +++ /dev/null @@ -1,123 +0,0 @@ -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" - } - } - }, - ] -} 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 ffe2ed4348e54..0000000000000 --- a/website/cue/reference/remap/functions/parse_xml.cue +++ /dev/null @@ -1,97 +0,0 @@ -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" - } - } - }, - ] -} diff --git a/website/cue/reference/remap/functions/pascalcase.cue b/website/cue/reference/remap/functions/pascalcase.cue deleted file mode 100644 index cf0cc89dd7c4d..0000000000000 --- a/website/cue/reference/remap/functions/pascalcase.cue +++ /dev/null @@ -1,43 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/pop.cue b/website/cue/reference/remap/functions/pop.cue deleted file mode 100644 index 4f55b23b92539..0000000000000 --- a/website/cue/reference/remap/functions/pop.cue +++ /dev/null @@ -1,34 +0,0 @@ -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] - }, - ] -} diff --git a/website/cue/reference/remap/functions/push.cue b/website/cue/reference/remap/functions/push.cue deleted file mode 100644 index 3bde2dda7ddf6..0000000000000 --- a/website/cue/reference/remap/functions/push.cue +++ /dev/null @@ -1,40 +0,0 @@ -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] - }, - ] -} 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 9d1a784388eda..0000000000000 --- a/website/cue/reference/remap/functions/random_bool.cue +++ /dev/null @@ -1,22 +0,0 @@ -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 - }, - ] -} 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 d8e4c4339f6a7..0000000000000 --- a/website/cue/reference/remap/functions/random_bytes.cue +++ /dev/null @@ -1,33 +0,0 @@ -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==" - }, - ] -} 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 442d5c0809568..0000000000000 --- a/website/cue/reference/remap/functions/random_float.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} 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 42af5ba2a467f..0000000000000 --- a/website/cue/reference/remap/functions/random_int.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/redact.cue b/website/cue/reference/remap/functions/redact.cue deleted file mode 100644 index 0e278d62d1dd0..0000000000000 --- a/website/cue/reference/remap/functions/redact.cue +++ /dev/null @@ -1,143 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/remove.cue b/website/cue/reference/remap/functions/remove.cue deleted file mode 100644 index 4754035dfa5dc..0000000000000 --- a/website/cue/reference/remap/functions/remove.cue +++ /dev/null @@ -1,75 +0,0 @@ -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 - }, - ] -} 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 bb3f3a198430e..0000000000000 --- a/website/cue/reference/remap/functions/remove_secret.cue +++ /dev/null @@ -1,31 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/replace.cue b/website/cue/reference/remap/functions/replace.cue deleted file mode 100644 index d66218c6ea33e..0000000000000 --- a/website/cue/reference/remap/functions/replace.cue +++ /dev/null @@ -1,81 +0,0 @@ -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" - }, - ] -} 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 131f1e3e9d7f7..0000000000000 --- a/website/cue/reference/remap/functions/replace_with.cue +++ /dev/null @@ -1,85 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/round.cue b/website/cue/reference/remap/functions/round.cue deleted file mode 100644 index d44327a441af4..0000000000000 --- a/website/cue/reference/remap/functions/round.cue +++ /dev/null @@ -1,48 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/screamingsnakecase.cue b/website/cue/reference/remap/functions/screamingsnakecase.cue deleted file mode 100644 index 37ccf0d97a6f1..0000000000000 --- a/website/cue/reference/remap/functions/screamingsnakecase.cue +++ /dev/null @@ -1,43 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/seahash.cue b/website/cue/reference/remap/functions/seahash.cue deleted file mode 100644 index d4367c2e7a827..0000000000000 --- a/website/cue/reference/remap/functions/seahash.cue +++ /dev/null @@ -1,37 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/set.cue b/website/cue/reference/remap/functions/set.cue deleted file mode 100644 index 6524588dc6388..0000000000000 --- a/website/cue/reference/remap/functions/set.cue +++ /dev/null @@ -1,63 +0,0 @@ -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"] - }, - ] -} 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 7b54d22cb2f3a..0000000000000 --- a/website/cue/reference/remap/functions/set_secret.cue +++ /dev/null @@ -1,35 +0,0 @@ -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 - }, - ] -} 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 d2431a3c7a638..0000000000000 --- a/website/cue/reference/remap/functions/set_semantic_meaning.cue +++ /dev/null @@ -1,43 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/sha1.cue b/website/cue/reference/remap/functions/sha1.cue deleted file mode 100644 index fc63040192693..0000000000000 --- a/website/cue/reference/remap/functions/sha1.cue +++ /dev/null @@ -1,29 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/sha2.cue b/website/cue/reference/remap/functions/sha2.cue deleted file mode 100644 index 0bf171b0b6c57..0000000000000 --- a/website/cue/reference/remap/functions/sha2.cue +++ /dev/null @@ -1,44 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/sha3.cue b/website/cue/reference/remap/functions/sha3.cue deleted file mode 100644 index f43ad144e5537..0000000000000 --- a/website/cue/reference/remap/functions/sha3.cue +++ /dev/null @@ -1,42 +0,0 @@ -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" - }, - ] -} 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 9f6c904403b3b..0000000000000 --- a/website/cue/reference/remap/functions/shannon_entropy.cue +++ /dev/null @@ -1,63 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/sieve.cue b/website/cue/reference/remap/functions/sieve.cue deleted file mode 100644 index 0388bb7f72c60..0000000000000 --- a/website/cue/reference/remap/functions/sieve.cue +++ /dev/null @@ -1,65 +0,0 @@ -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." - }, - ] -} diff --git a/website/cue/reference/remap/functions/slice.cue b/website/cue/reference/remap/functions/slice.cue deleted file mode 100644 index 8e4bf4afc2196..0000000000000 --- a/website/cue/reference/remap/functions/slice.cue +++ /dev/null @@ -1,53 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/snakecase.cue b/website/cue/reference/remap/functions/snakecase.cue deleted file mode 100644 index dab198c67feef..0000000000000 --- a/website/cue/reference/remap/functions/snakecase.cue +++ /dev/null @@ -1,43 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/split.cue b/website/cue/reference/remap/functions/split.cue deleted file mode 100644 index 2775252423f1a..0000000000000 --- a/website/cue/reference/remap/functions/split.cue +++ /dev/null @@ -1,53 +0,0 @@ -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"] - }, - ] -} 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 981f64bfb6522..0000000000000 --- a/website/cue/reference/remap/functions/split_path.cue +++ /dev/null @@ -1,53 +0,0 @@ -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: [] - }, - ] -} 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 31496583701a3..0000000000000 --- a/website/cue/reference/remap/functions/starts_with.cue +++ /dev/null @@ -1,49 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/string.cue b/website/cue/reference/remap/functions/string.cue deleted file mode 100644 index 16ff4af9e39cb..0000000000000 --- a/website/cue/reference/remap/functions/string.cue +++ /dev/null @@ -1,38 +0,0 @@ -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 - }, - ] -} 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 2ec9717b1a5fe..0000000000000 --- a/website/cue/reference/remap/functions/strip_ansi_escape_codes.cue +++ /dev/null @@ -1,29 +0,0 @@ -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" - }, - ] -} 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 bef2bec05b9e9..0000000000000 --- a/website/cue/reference/remap/functions/strip_whitespace.cue +++ /dev/null @@ -1,30 +0,0 @@ -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." - }, - ] -} diff --git a/website/cue/reference/remap/functions/strlen.cue b/website/cue/reference/remap/functions/strlen.cue deleted file mode 100644 index 5aab9bb20a188..0000000000000 --- a/website/cue/reference/remap/functions/strlen.cue +++ /dev/null @@ -1,35 +0,0 @@ -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 - }, - ] -} 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 99e1e290bbb78..0000000000000 --- a/website/cue/reference/remap/functions/tag_types_externally.cue +++ /dev/null @@ -1,74 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/timestamp.cue b/website/cue/reference/remap/functions/timestamp.cue deleted file mode 100644 index 37da9bd4a2c78..0000000000000 --- a/website/cue/reference/remap/functions/timestamp.cue +++ /dev/null @@ -1,38 +0,0 @@ -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" - }, - ] -} 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 3ba6a9d45d898..0000000000000 --- a/website/cue/reference/remap/functions/to_bool.cue +++ /dev/null @@ -1,69 +0,0 @@ -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 - }, - ] -} 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 fbbd18f16e0bc..0000000000000 --- a/website/cue/reference/remap/functions/to_float.cue +++ /dev/null @@ -1,48 +0,0 @@ -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 - }, - ] -} 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 688c59704c0a2..0000000000000 --- a/website/cue/reference/remap/functions/to_int.cue +++ /dev/null @@ -1,51 +0,0 @@ -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 - }, - ] -} 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 9497da6d46508..0000000000000 --- a/website/cue/reference/remap/functions/to_regex.cue +++ /dev/null @@ -1,37 +0,0 @@ -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$" - }, - ] -} 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 4a8104d1bd32b..0000000000000 --- a/website/cue/reference/remap/functions/to_string.cue +++ /dev/null @@ -1,53 +0,0 @@ -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" - }, - ] -} 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 01cfc89ea909a..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_facility.cue +++ /dev/null @@ -1,32 +0,0 @@ -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" - }, - ] -} 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 718c82f82ea00..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_facility_code.cue +++ /dev/null @@ -1,32 +0,0 @@ -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 - }, - ] -} 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 c39f69e93d02c..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_level.cue +++ /dev/null @@ -1,32 +0,0 @@ -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" - }, - ] -} 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 a50986a9ecbc5..0000000000000 --- a/website/cue/reference/remap/functions/to_syslog_severity.cue +++ /dev/null @@ -1,37 +0,0 @@ -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 - }, - ] -} 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 2a622576f2678..0000000000000 --- a/website/cue/reference/remap/functions/to_unix_timestamp.cue +++ /dev/null @@ -1,59 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/truncate.cue b/website/cue/reference/remap/functions/truncate.cue deleted file mode 100644 index 233fb95ab4bc4..0000000000000 --- a/website/cue/reference/remap/functions/truncate.cue +++ /dev/null @@ -1,66 +0,0 @@ -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]" - }, - ] -} diff --git a/website/cue/reference/remap/functions/unflatten.cue b/website/cue/reference/remap/functions/unflatten.cue deleted file mode 100644 index 67ca69aa17010..0000000000000 --- a/website/cue/reference/remap/functions/unflatten.cue +++ /dev/null @@ -1,111 +0,0 @@ -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 - } - } - }, - ] -} diff --git a/website/cue/reference/remap/functions/unique.cue b/website/cue/reference/remap/functions/unique.cue deleted file mode 100644 index 6dcb86389ca49..0000000000000 --- a/website/cue/reference/remap/functions/unique.cue +++ /dev/null @@ -1,33 +0,0 @@ -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"] - }, - ] -} diff --git a/website/cue/reference/remap/functions/unnest.cue b/website/cue/reference/remap/functions/unnest.cue deleted file mode 100644 index 3a1592a646f26..0000000000000 --- a/website/cue/reference/remap/functions/unnest.cue +++ /dev/null @@ -1,79 +0,0 @@ -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" - }}, - ] - }, - ] -} diff --git a/website/cue/reference/remap/functions/upcase.cue b/website/cue/reference/remap/functions/upcase.cue deleted file mode 100644 index 69f2f339cfcef..0000000000000 --- a/website/cue/reference/remap/functions/upcase.cue +++ /dev/null @@ -1,30 +0,0 @@ -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!" - }, - ] -} 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 b017e918bebfd..0000000000000 --- a/website/cue/reference/remap/functions/uuid_from_friendly_id.cue +++ /dev/null @@ -1,32 +0,0 @@ -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" - }, - ] -} 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 c6c4a7738fed0..0000000000000 --- a/website/cue/reference/remap/functions/uuid_v4.cue +++ /dev/null @@ -1,22 +0,0 @@ -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" - }, - ] -} 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 8b6be2040e871..0000000000000 --- a/website/cue/reference/remap/functions/uuid_v7.cue +++ /dev/null @@ -1,44 +0,0 @@ -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" - }, - ] -} 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 314d6fdee8bca..0000000000000 --- a/website/cue/reference/remap/functions/validate_json_schema.cue +++ /dev/null @@ -1,81 +0,0 @@ -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 - }, - ] -} diff --git a/website/cue/reference/remap/functions/values.cue b/website/cue/reference/remap/functions/values.cue deleted file mode 100644 index 78586579b159d..0000000000000 --- a/website/cue/reference/remap/functions/values.cue +++ /dev/null @@ -1,37 +0,0 @@ -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"] - }, - ] -} diff --git a/website/cue/reference/remap/functions/xxhash.cue b/website/cue/reference/remap/functions/xxhash.cue deleted file mode 100644 index f420bf9f80410..0000000000000 --- a/website/cue/reference/remap/functions/xxhash.cue +++ /dev/null @@ -1,65 +0,0 @@ -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" - }, - ] -} diff --git a/website/cue/reference/remap/functions/zip.cue b/website/cue/reference/remap/functions/zip.cue deleted file mode 100644 index 90f5e7927596f..0000000000000 --- a/website/cue/reference/remap/functions/zip.cue +++ /dev/null @@ -1,55 +0,0 @@ -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]] - }, - ] -} diff --git a/website/layouts/partials/data.html b/website/layouts/partials/data.html index 1c3d1b728a4d2..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 }} @@ -1810,6 +1810,16 @@

{{ end }} + + {{ if isset .ctx "raises" }} +
+ Raises + +
+ {{ template "code" .ctx.raises }} +
+
+ {{ end }} {{ end }}