# AxoRouter connector rules

Connectors define the methods and entry points where AxoRouter receives data from the sources. To collect data from edge hosts, see [Edge collection rules](../../docs/axoflow/data-sources/collection-rules/index.md).

In addition to providing a simple protocol specific listener, Connectors implement critical processing steps - for example classification and parsing - right at the ingestion point to enrich data before it gets processed by Flows.

On top of this, Connector rules are high-level policies that determine what kind of Connectors should be available on a set of AxoRouter instances based on dynamic host labels.

![Connector rules](/docs/axoflow/data-sources/connector-rules/figure-connector-rules.svg)

To see every connector rule configured in AxoConsole, select **Routers > Connector Rules** from the main menu.

![Connector rules list](/docs/axoflow/img/data-management/connector-rules/connector-rules-list.png)

Connector rules have the following main elements:

  * the way they accept data (for example, via syslog, using the OpenTelemetry protocol), and other protocol-specific parameters (for example, port number)

  * the router selector, which determines the list of AxoRouter instances that will create a connector based on that rule.

You can use any labels and metadata of the AxoRouter hosts in the Router selectors, for example, the hostname of the AxoRouter, or any [custom labels](../../docs/axoflow/onboard-hosts/hosts/add-host-metadata/index.md).

    * If you leave the **Router Selector** field empty, the selector will match every AxoRouter instance.
    * To select only a specific AxoRouter instance, set the `name` field to the name of the instance as selector. For example, `name = my-axorouter`.
    * If you set multiple fields in the selector, the selector will match only AxoRouter instances that match all elements of the selector. (There in an AND relationship between the fields.)
For example, using the `label.wec = enabled` selector on a [Windows Event Collector (WEC)](../../docs/axoflow/data-sources/wec/index.md) rule will create a WEC connector on AxoRouter hosts that have the `wec` label set to `enabled`.




Selecting a connector rule shows the details of the connector rule, including:

  * The list of **Matched hosts** : the AxoRouter deployments that will have a connector based on that connector rule. If you click on the name of a matched router, the **Connectors** page of the AxoRouter host opens, showing you the connectors configured for that host.

![Details of a connector rule](/docs/axoflow/data-sources/connector-rules/connector-rule-details.png)



  * The **Status** of the rule:

    * **Idle** : The rule doesn’t match any hosts currently.
    * **Provisioned** : Connectors based on this rule were successfully provisioned for every matching host.
    * **Error** : Some error(s) occurred while provisioning connectors based on this rule. See the **Status message** field for details.
    * **Unknown** : The rule is in an unknown state.
  * **Attributes** : Various significant attributes of connectors provisioned based on this rule.




## Create connector rule

To create a new connector rule, complete the following steps.

  1. Select **Routers > Connector Rules > Add Rule**. (Alternatively, you can select **Add Connector > Create a connector rule** on the **Connectors** page of an AxoRouter host.)

![Connector rules list](/docs/axoflow/img/data-management/connector-rules/connector-rules-list.png)

  2. Select the type of connector you want to create. For example, **OpenTelemetry**. The following connector types are available:

     * [OpenTelemetry](../../docs/axoflow/data-sources/opentelemetry/index.md)
     * [Syslog connectors](../../docs/axoflow/data-sources/syslog/index.md)
     * [Webhook](../../docs/axoflow/data-sources/webhook/index.md)
     * [Windows Event Collector (WEC)](../../docs/axoflow/data-sources/wec/index.md)
  3. Configure the connector rule.

     1. Enter a name for the connector rule into the **Rule Name** field.

![Generic connector rule parameters](/docs/axoflow/img/connector-rule-generic.png)

     2. (Optional) Add labels to the connector rule. You will be able to use these labels in [Flow Processing steps](../../docs/axoflow/data-management/processing/index.md), for example, in the **Query** field of **Select Messages** steps. For details about the message schema and the related connector-specific fields, see the [`meta.connector` object](../../docs/axoflow/reference/message-schema/reference/index.md#meta.connector).

     3. Set the **Router Selector** for the connector rule. The selector determines which AxoRouter instances will have a connector based on this connector rule.

![Router selectors](/docs/axoflow/img/data-management/connector-rules/connector-rules-router-selector.png)

You can use any labels and metadata of the AxoRouter hosts in the Router selectors, for example, the hostname of the AxoRouter, or any [custom labels](../../docs/axoflow/onboard-hosts/hosts/add-host-metadata/index.md).

        * If you leave the **Router Selector** field empty, the selector will match every AxoRouter instance.
        * To select only a specific AxoRouter instance, set the `name` field to the name of the instance as selector. For example, `name = my-axorouter`.
        * If you set multiple fields in the selector, the selector will match only AxoRouter instances that match all elements of the selector. (There in an AND relationship between the fields.)
     4. (Optional) Enter a **Suffix** for the connector rule. This suffix will be used in the name of the connector instances created on the AxoRouter hosts. The name of the connector instance follows the `<name-of-AxoRouter>-<name-of-connector-rule>-<suffix>` schema. For example, if the name of a matching AxoRouter instance is “my-axorouter”, the name of the connector rule is “otlp-1” and the suffix of the rule is “my-suffix”, the connector created for the AxoRouter will be named “my-axorouter-otlp-1-my-suffix”.

If the **Suffix** field is empty, the name of the connector rule is used instead.

     5. (Optional) Enter a description for the rule.

     6. If needed, enable the **Classify** and **Parse** preprocessing steps so AxoRouter automatically identifies and parses messages sent by [supported data sources](../../docs/axoflow/data-sources/appliances/index.md). If your source is not listed, [contact us](<https://axoflow.com/contact>).

Enabling these options processes all data received by the connectors created based on this connector rule. If you want to apply classification and parsing more selectively, you can use the **Classify** and **Parse** processing steps in your [**Flows**](../../docs/axoflow/data-management/processing/index.md).

Note that the **Parse** processing step requires **Classify** to be enabled. Parsing automatically parses the data from the content of the message, and replaces the message content (the `log.body` field in the internal message schema) with the structured information.

     7. (Optional) If needed, you can add other preprocessing steps to the connector rule. You can use the [same processing steps as in flows](../../docs/axoflow/data-management/processing/index.md). These can be useful if you use a dedicated connector rule to fix or annotate data coming from some specific sources.

  4. Configure the protocol-specific settings. For details, see the specific pages:

     * [OpenTelemetry](../../docs/axoflow/data-sources/opentelemetry/index.md)
     * [Syslog connectors](../../docs/axoflow/data-sources/syslog/index.md)
     * [Webhook](../../docs/axoflow/data-sources/webhook/index.md)
     * [Windows Event Collector (WEC)](../../docs/axoflow/data-sources/wec/index.md)
  5. Select **Add**.

Axoflow automatically creates connectors on the AxoRouter hosts that match the **Router Selector**.

Make sure to enable the ports you’ve configured in the connector on the firewall of the AxoRouter host, and on other firewalls between the AxoRouter host and your data sources.




## Modify connector rule

To modify an existing connector rule, complete the following steps.

Note

  * You cannot directly modify the connector of an AxoRouter host, only via modifying a connector rule.
  * Modifying a connector rule affects every AxoRouter that matches the **Router Selector** of the rule.
  * To apply an existing connector rule to a new AxoRouter instance, you can: 
    * [Add a label to the AxoRouter host](../../docs/axoflow/onboard-hosts/hosts/add-host-metadata/index.md) so the **Router Selector** of the connector rule matches the new host, and/or
    * Change the **Router Selector** of the connector rule to match the new host.



  1. Find the connector rule you want to modify:

     * Select **Routers > Connector Rules** from the main menu, then select the connector rule you want to modify.
     * Alternatively, find the AxoRouter instance whose connector you want to modify on the **Topology** page, then select **Connector Rules**. Find the connector you want to modify, then select **⋮ > Edit connector rule**.
  2. Modify the configuration of the connector rule as needed.

**CAUTION:**

The changes are applied immediately after you click **Update**. Double-check your changes to avoid losing data. 

  3. Select **Update**.




## Add AxoRouter to existing connector rule

To add an AxoRouter to an existing connector rule, you have two options, depending on the Router Selector of the connector rule:

  * [Modify the **Router Selector** field](../../docs/axoflow/data-sources/connector-rules/index.md#modify-connector-rule) of the connector rule to include the new AxoRouter host.
  * [Modify the labels](../../docs/axoflow/onboard-hosts/hosts/add-host-metadata/index.md) of the AxoRouter host so it matches the router selector of the connector rule.