scanner
  • About Scanner
  • When to use it
  • Architecture
  • Getting Started
  • Playground Guide
    • Overview
    • Part 1: Search and Analysis
    • Part 2: Detection Rules
    • Wrapping Up
  • Log Data Sources
    • Overview
    • List
      • AWS
        • AWS Aurora
        • AWS CloudTrail
        • AWS CloudWatch
        • AWS ECS
        • AWS EKS
        • AWS GuardDuty
        • AWS Lambda
        • AWS Route53 Resolver
        • AWS VPC Flow
        • AWS VPC Transit Gateway Flow
        • AWS WAF
      • Cloudflare
        • Audit Logs
        • Firewall Events
        • HTTP Requests
        • Other Datasets
      • Crowdstrike
      • Custom via Fluentd
      • Fastly
      • GitHub
      • Jamf
      • Lacework
      • Osquery
      • OSSEC
      • Sophos
      • Sublime Security
      • Suricata
      • Syslog
      • Teleport
      • Windows Defender
      • Windows Sysmon
      • Zeek
  • Indexing Your Logs in S3
    • Linking AWS Accounts
      • Manual setup
        • AWS CloudShell
      • Infra-as-code
        • AWS CloudFormation
        • Terraform
        • Pulumi
    • Creating S3 Import Rules
      • Configuration - Basic
      • Configuration - Optional Transformations
      • Previewing Imports
      • Regular Expressions in Import Rules
  • Using Scanner
    • Query Syntax
    • Aggregation Functions
      • avg()
      • count()
      • countdistinct()
      • eval()
      • groupbycount()
      • max()
      • min()
      • percentile()
      • rename()
      • stats()
      • sum()
      • table()
      • var()
      • where()
    • Detection Rules
      • Event Sinks
      • Out-of-the-Box Detection Rules
      • MITRE Tags
    • API
      • Ad hoc queries
      • Detection Rules
      • Event Sinks
      • Validating YAML files
    • Built-in Indexes
      • _audit
    • Role-Based Access Control (RBAC)
    • Beta features
      • Scanner for Splunk
        • Getting Started
        • Using Scanner Search Commands
        • Dashboards
        • Creating Custom Content in Splunk Security Essentials
      • Scanner for Grafana
        • Getting Started
      • Jupyter Notebooks
        • Getting Started with Jupyter Notebooks
        • Scanner Notebooks on Github
      • Detection Rules as Code
        • Getting Started
        • Writing Detection Rules
        • CLI
        • Managing Synced Detection Rules
      • Detection Alert Formatting
        • Customizing PagerDuty Alerts
      • Scalar Functions and Operators
        • coalesce()
        • if()
        • arr.join()
        • math.abs()
        • math.round()
        • str.uriencode()
  • Single Sign On (SSO)
    • Overview
    • Okta
      • Okta Workforce
      • SAML
  • Self-Hosted Scanner
    • Overview
Powered by GitBook
On this page
  • Validate detection rule
  • Run detection rule tests

Was this helpful?

  1. Using Scanner
  2. API

Validating YAML files

PreviousEvent SinksNextBuilt-in Indexes

Last updated 8 months ago

Was this helpful?

When using the feature, you can use the API to check that your detection rules are valid and the tests pass in Scanner before checking them into Github.

We have the following APIs for validating detection rules and running detection rule tests.

Note: this API is for a beta feature, and may be subject to change.

Validate detection rule

POST /v1/detection_rule_yaml/validate

Validate a detection rule YAML.

Example

curl $API_BASE/v1/detection_rule_yaml/validate \
-H "Authorization: Bearer $SCANNER_API_KEY" \
-X POST \
--data-binary @src/some_detection.yaml

Response

Returns whether the detection rule is_valid and any error messages. error is null if the detection rule is valid.

{
  "is_valid":true,
  "error":null
}

Run detection rule tests

POST /v1/detection_rule_yaml/run_tests

Run tests specified in the given detection rule YAML.

Example

curl $API_BASE/v1/detection_rule_yaml/run_tests \
-H "Authorization: Bearer $SCANNER_API_KEY" \
-X POST \
--data-binary @src/some_detection.yaml

Response

Returns results, a map of test names to their corresponding status (passed or failed). results is empty if there are no tests found in the given file.

{
  "results": {
    "Example detection rule": "Passed"
  }
}
Detection Rules as Code