Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.21 KB

File metadata and controls

65 lines (52 loc) · 2.21 KB
navigation_title Loop continue
applies_to
stack serverless
ga 9.4+
ga
description Reference for the loop.continue step, which skips to the next iteration of the innermost enclosing foreach or while loop.
products
id
kibana
id
cloud-serverless
id
cloud-hosted
id
cloud-enterprise
id
cloud-kubernetes
id
elastic-stack

Loop continue [workflows-loop-continue-step]

The loop.continue step skips the rest of the current iteration in the innermost enclosing foreach or while loop and moves on to the next iteration. Use it to skip items that don't meet a filter, without nesting the remaining logic inside an if.

:::{include} ../_snippets/schema-location-legend.md :::

Parameters

loop.continue takes no parameters.

Parameter Location Type Required Description
name top level string Yes Unique step identifier.
type top level string Yes Must be loop.continue.

Example: Skip benign alerts

- name: process_alerts
  type: foreach
  foreach: "${{ event.alerts }}"
  steps:
    - name: filter_benign
      type: if
      condition: "foreach.item.kibana.alert.severity : low"
      steps:
        - name: next
          type: loop.continue

    - name: enrich
      type: virustotal.scanFileHash
      connector-id: "my-virustotal"
      with:
        hash: "{{ foreach.item.file.hash.sha256 }}"

    - name: record
      type: cases.addComment
      with:
        case_id: "{{ consts.case_id }}"
        comment: "Enriched: {{ foreach.item._id }} — {{ steps.enrich.output.stats.malicious }} hits"

Low-severity alerts are skipped; the loop moves on to the next alert without running enrich or record.

Related