cfxdm - dm:filter

Data filtering using CFX query language

dm:filter: This cfxdm tag allows the user to apply simple to complex filters on the retrieved data from a different extension / datasource using CFX query language.

This tag is useful when an extension / datasource does not support filtering the data at the source using cfx query language. So, the pre-requisite is to retrieve the data before using this (dm:filter) tag.

dm:filter syntax:

  • dm:filter <cfx-ql-query> : Use CFX query language to apply the filter. If you do not want to apply any query and to include all of the ingested data, use '*' (without any quotes).

  • dm:filter <cfx-ql-query> get COLUMN_Name_1, COLUMN_Name_2, COLUMN_Name_3 .... : Use this syntax to limit the scope to only the selected columns. It also maintains the selected column's specified order.

  • dm:filter <cfx-ql-query> get COLUMN_Name_1 as 'New_COLUMN_Name_1', COLUMN_Name_2 as 'New_COLUMN_Name_2', COLUMN_Name_3 as 'New_COLUMN_Name_3'... : Use this syntax to limit the scope to only the selected columns and rename them with new column names. It also maintains the selected column's specified order.

Please refer CFX query language section for detailed information on supported queries and their usage/syntax with examples.

In the below example, for reference, we are going to use VMware vROps as an extension to query the data and ingest it into dm:filter tag for applying the filtering capabilities using CFX query language.

Enter the below command to select VMware vROps resources tag (@vrops:resources). (In this example, vrops name is used as a label to identify VMware vROps extension and it's tags. The label is defined while adding the extension in cfxdx configuration file or through UI.)

tag @vrops:resources

Example 1:

Get the data from VMware vROps resources tag (@vrops:resources) and modify the column names. Below shown columns (highlighted) are from vROps resource tag.

  • identifier as Virtual_Resource_Identifier

  • name as Virtual_Resource_Name

  • resource_kind as Virtual_Resource_Type

  • adapter_kind as Virtual_Adapter_Type

--> symbol represents piping the data between two extension tags, the output of an extension tag becomes as an input to another extension tag. It is similar to using the pipe (I) command in Unix/Linux OS.

data --> dm:filter * get identifier as 'Virtual_Resource_Identifier', name as 'Virtual_Resource_Name', resource_kind as 'Virtual_Resource_Type', adapter_kind as 'Virtual_Adapter_Type'

Example 2:

Get the data from VMware vROps resources tag (@vrops:resources) and filter the data only to selective columns. Below shown (highlighted) are all of the columns from vROps resource tag. Out of them, limit the column selection in a specific order (ex: name, resource_kind & identifier.... skip adapter_kind)

  • identifier

  • name

  • resource_kind

  • adapter_kind (skip this column from the query)

data --> dm:filter * get name,resource_kind,identifier

Example 3:

Get the data from VMware vROps resources tag (@vrops:resources) and using CFX query language, filter the data that matches 'VirtualMachine' under column 'resource_kind' and limit the column's scope only to name, resource_kind & identifier.

data --> dm:filter resource_kind equals 'VirtualMachine' get name,resource_kind,identifier

Example 4:

Get the data from VMware vROps resources tag (@vrops:resources) and using CFX query language, filter the data that matches 'VirtualMachine' or 'DistributedVirtualPortgroup' or 'ResourcePool' and include all of the available columns.

data --> dm:filter resource_kind contains 'VirtualMachine|DistributedVirtualPortgroup|ResourcePool'

If the column name has any special character (ex: a dot or dash etc..), then it needs to be escaped with backquotes. For example, the column name is first.name, it should be specified as `first.name` (backquote escape)

Appendix:

ServiceNow Examples:

In this section, we are going to use ServiceNow as an extension to query the data and ingest it into the dm:filter tag for applying the filtering capabilities using CFX query language.

Note: In order for the following examples to work, the main pre-requisite is to add your ServiceNow account details to CFXDX using the CFXDX configuration section.

Example 1:

Checking the connectivity to the ServiceNow instance via CFXDX.

> check snow

Example 2:

Following ServiceNow tags are available via CFXDX.

> tags snow

Example 3:

Get the data from the ServiceNow tag (#snow:incidents) and modify the column names. Below shown columns (highlighted) are from the ServiceNow incidents tag.

  • number

  • short_description

  • state

  • priority

data --> dm:filter * get number as 'Ticket_Number', short_description as 'Description', state as 'State', priority as 'Priority'

Example 4:

Get the data from ServiceNow tag (#snow:incidents)) and using CFX query language, filter the data that matches 'email' under column 'short_description' and limit the column's scope only to Number, Short description. State.

data --> dm:filter short_description contains 'email' get number as 'Incident Numnber', short_description as 'Short Description', state as 'State'

Example 5:

Get the data from ServiceNow tag (#snow:incidents)) and using CFX query language, filter the data that matches 'email' or 'laptop' or 'VPN' under column 'short_description' and limit the column's scope only to Number, Short description. State.

data --> dm:filter short_description contains 'email|VPN|laptop' get number as 'Incident Numnber', short_description as 'Short Description', state as 'State'

Last updated