# Access Logging

This section highlights the observability features of the Network Load Balancer (NLB) access logging. The NLB supports extensive logging, which provide visibility into the network traffic. When enabled, all logs are transmitted to our observability system, where they can be queried and analyzed for valuable insights. Central logging must be enabled for this functionality, ensuring effective monitoring and troubleshooting of network traffic. This allows for proactive identification and resolution of potential issues, enhancing overall network performance and reliability.

{% hint style="info" %}
**Note:** This feature is only available for newly created NLBs in non-US datacenters and requires central logging to be enabled as a prerequisite.
{% endhint %}

## Accessing Logs

Once central logging is enabled, logs from your NLB will be sent to the logging service. You can access and analyze these logs using a dedicated Grafana instance.

{% hint style="info" %}
**Note:** The Grafana URL where the logs will be available will follow the pattern as in this example: `https://grafana.d6b7a2374abe.dev.logging.de-txl.ionos.com/` where `d6b7a2374abe` is a hash of the contract number.
{% endhint %}

## Enable Central Logging

* **Requirement:** Enabling central logging is mandatory for the NLB to send logs.
* **Configuration:** Send a `POST` request to the NLB endpoint to enable central logging. Here's an example using curl:

{% hint style="info" %}
**Note:**

* Set **centralLogging** to **true**.
* Replace `datacenterId` and `TOKEN` with your actual data center ID and authorization token.
  {% endhint %}

```bash
curl -X "POST" "https://api.ionos.com/cloudapi/v6/datacenters/{datacenterId}/networkloadbalancers" \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer TOKEN' \
-d '{
  "type": "networkloadbalancer",
  "metadata": {},
  "properties": {
    "name": "My Network Load Balancer",
    "listenerLan": 1,
    "ips": [
      "81.173.1.2",
      "22.231.2.2",
      "22.231.2.3"
    ],
    "targetLan": 2,
    "lbPrivateIps": [
      "81.173.1.5/24",
      "22.231.2.5/24"
    ],
    "centralLogging": true,
    "loggingFormat": "%{+Q}o %{-Q}ci - - [%trg] %r %ST %B \"\" \"\" %cp %ms %ft %b %s %TR %Tw %Tc %Tr %Ta %tsc %ac %fc %bc %sc %rc %sq %bq %CC %CS %hrl %hsl"
  },
  "entities": {
    "flowlogs": {
      "type": "collection",
      "offset": 0,
      "limit": 1000,
      "_links": {}
    },
    "forwardingrules": {
      "type": "collection",
      "offset": 0,
      "limit": 1000,
      "_links": {}
    }
  }
}'
```

{% hint style="info" %}
**Note:** We can enable/disable central logging via PUT requests as well.
{% endhint %}

{% hint style="info" %}
**Note:** Enabling central logging incurs additional costs.
{% endhint %}


---

# 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.ionos.com/cloud/network-services/network-load-balancer/access-logging.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.
