Comment on page
StackState Query Language (STQL)
Build advanced topology queries with STQL
This page describes StackState version 4.1.
The StackState 4.1 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.1 version range to upgrade to a more recent release.
Component filters are used in two ways in STQL:
- Define the set of components to be included in the query output.
- Specify the set of components to be handled by an in-built STQL function.
The filters described below can be combined using boolean operators to achieve complex selections of components. Note that boolean operators will be executed in the standard order: NOT, OR, AND. You can change the order of operations by grouping sections of a query with parentheses (...).
You can use * as a full wildcard in a component filter. It is not possible to filter for partial matches using a wildcard character.
# Select all components
name = "*"
# Select all components with name "serviceB"
name = "serviceB"
# Select all components in the "application" layer:
layer = "application"
# Select all components named either "appA" or "appB" that do not have a label "bck"
name IN ("appA","appB") NOT label = "bck"
# Select all components named "appA" that do not have a label "bck" or "test"
name = "appA" NOT label in ("bck", "test")
The function withNeighborsOf extends STQL query output, adding connected components in the specified direction(s). The number of topology levels included can be adjusted up to a maximum of 15.
withNeighborsOf(components=(), levels=, direction=)
The example below will return all components in the application layer that have a healthstate of either "CRITICAL" or "DEVIATING". Components with names "appA" or "appB" and their neighbors will also be included.
layer = "application"
AND (healthstate = "CRITICAL" OR healthstate = "DEVIATING")
OR withNeighborsOf(components = (name in ("appA","appB")))
withCauseOffunction has been deprecated. This functionality has been replaced by the Root Cause Analysis section in the visualizer. The construct will be parsed, but will not produce any additional components.