YAML linter tool

The Cortex YAML linter validates your cortex.yaml files for both general YAML syntax and Cortex-specific schema requirements, helping prevent ingestion of invalid or incomplete data into the platform.

This page references the built-in tool in the Cortex UI under Tools > YAML Linter. Note that there is also a linter tool built in to the Cortex GitHub app, which runs checks on pull requests when you use GitHub in a GitOps workflow.

Using the YAML linter

Validate a YAML file in the Cortex UI

  1. In Cortex, navigate to Tools > YAML Linter.

In Cortex, go to Tools > YAML Linter.
  1. Paste your YAML into the text editor, then in the upper right, click Validate YAML.

  2. At the bottom of the screen, you will see a status banner:

    • If the format is correct: You will see a message stating that the YAML is valid: The banner says "YAML is valid."

    • If the format is not correct:

      • For issues with the format of a Cortex-specific block, you will see a warning banner:

        The linter warning banner indicates that x-cortex-apm has an empty value in the YAML file..
      • For errors that cause the YAML to fail the linter check (such as missing a title or x-cortex-tag), you will see a banner that includes the error message and which line is affected:

        The banner includes an error message.

Validation scope

The linter checks for valid YAML structure and ensures required Cortex fields (like openapi version, x-cortex-tag, etc.) are present. If a required field is not present, this results in an error and the YAML does not pass the linter check.

The linter also validates the format of Cortex-specific blocks (e.g., x-cortex-groups, x-cortex-firehydrant) but does not verify the correctness of referenced data (such as whether a group or monitor ID actually exists). If there is an issue for a Cortex block, such as a block that doesn't contain a value, you will see a warning; however, the YAML will still pass the linter check.

If you submit a file with templating syntax (e.g., Jinja or cookiecutter variables like {{ variable }}), the linter will fail because these are not valid YAML until rendered. Only fully rendered YAML files will pass validation.

If the YAML is invalid or missing required fields, the linter will return errors indicating the line and nature of the problem.

GitOps settings for the linter tool

If you are using GitHub in a GitOps workflow, you can adjust settings related to the linter. See GitOps Settings for more information.

Last updated

Was this helpful?