# Azure Log Analytics

The Azure output plugin lets you ingest your records into [Azure Log Analytics](https://azure.microsoft.com/en-us/products/monitor/) service.

For details about how to setup Azure Log Analytics, see the [Azure Log Analytics](https://learn.microsoft.com/en-us/azure/azure-monitor/fundamentals/overview) documentation.

## Configuration parameters

| Key              | Description                                                                                                                                                   | Default      |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `customer_id`    | Customer ID or WorkspaceID string.                                                                                                                            | *none*       |
| `log_type`       | The name of the event type.                                                                                                                                   | `fluentbit`  |
| `log_type_key`   | If included, the value for this key checked in the record and if present, will overwrite the `log_type`. If not found then the `log_type` value will be used. | *none*       |
| `shared_key`     | The primary or the secondary Connected Sources client authentication key.                                                                                     | *none*       |
| `time_generated` | If enabled, the HTTP request header `time-generated-field` will be included so Azure can override the timestamp with the key specified by `time_key` option.  | `false`      |
| `time_key`       | Optional. Specify the key name where the timestamp will be stored.                                                                                            | `@timestamp` |
| `workers`        | The number of [workers](/manual/administration/multithreading.md#outputs) to perform flush operations for this output.                                        | `0`          |

## Get started

To insert records into an Azure Log Analytics instance, run the plugin from the command line or through the configuration file.

### Command line

The *Azure* plugin can read the parameters from the command line in the following ways, using the `-p` argument (property):

```shell
fluent-bit -i cpu -o azure -p customer_id=abc -p shared_key=def -m '*' -f 1
```

### Configuration file

In your main configuration file append the following sections:

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
  inputs:
    - name: cpu

  outputs:
    - name: azure
      match: '*'
      customer_id: abc
      shared_key: def
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
[INPUT]
  Name  cpu

[OUTPUT]
  Name        azure
  Match       *
  Customer_ID abc
  Shared_Key  def
```

{% endtab %}
{% endtabs %}

The following example uses the `Log_Type_Key` with [record-accessor](https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/classic-mode/record-accessor), which will read the table name (or event type) dynamically from the Kubernetes label `app`, instead of `Log_Type`:

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
  inputs:
    - name: cpu

  outputs:
    - name: azure
      match: '*'
      log_type_key: $kubernetes['labels']['app']
      customer_id: abc
      shared_key: def
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
[INPUT]
  Name  cpu

[OUTPUT]
  Name        azure
  Match       *
  Log_Type_Key $kubernetes['labels']['app']
  Customer_ID abc
  Shared_Key  def
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fluentbit.io/manual/data-pipeline/outputs/azure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
