> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> The Logs section presents a chronological list of all the requests processed through Prisma AIRS AI Gateway.

Each log entry provides useful data such as the timestamp, request type, LLM used, tokens generated, thinking tokens and cost. For [multimodal models](/docs/aigw/product/ai-gateway/multimodal-capabilities), Logs will also show the image sent with vision/image models, as well as the image generated.

By clicking on an entry, a side panel opens up, revealing the entire raw data with the request and response objects.

This detailed log can be invaluable when troubleshooting issues or understanding specific interactions. It provides full transparency into each request and response, enabling you to see exactly what data was sent and received.

## Share Logs with Teammates

Each log on the AI Gateway has a unique URL. You can copy the link from the address bar and directly share it with anyone in your org.

## Request Status Guide

The Status column on the Logs page gives you a snapshot of the gateway activity for every request.

The AI Gateway features—[Cache](/docs/aigw/product/ai-gateway/cache-simple-and-semantic), [Retries](/docs/aigw/product/ai-gateway/automatic-retries), [Fallback](/docs/aigw/product/ai-gateway/fallbacks), [Loadbalance](/docs/aigw/product/ai-gateway/load-balancing) are tracked here with their exact states (`disabled`, `triggered`, etc.), making it a breeze to monitor and optimize your usage.

**Common Queries Answered:**

* **Is the cache working?**: Enabled caching but unsure if it's active? The Status column will confirm it for you.
* **How many retries happened?**: Curious about the retry count for a successful request? See it in a glance.
* **Fallback and Loadbalance**: Want to know if load balance is active or which fallback option was triggered? See it in a glance.

| Option          | 🔴 Inactive State     | 🟢 Possible Active States                               |
| --------------- | --------------------- | ------------------------------------------------------- |
| **Cache**       | Cache Disabled        | Cache Miss,Cache Refreshed,Cache Hit,Cache Semantic Hit |
| **Retry**       | Retry Not Triggered   | Retry Success on {x} Tries,Retry Failed                 |
| **Fallback**    | Fallback Disabled     | Fallback Active                                         |
| **Loadbalance** | Loadbalancer Disabled | Loadbalancer Active                                     |

## Manual Feedback

As you're viewing logs, you can also add manual feedback on the logs to be analysed and filtered later. This data can be viewed on the [feedback analytics dashboards](/docs/aigw/product/observability/analytics#feedback).

## Configs & Prompt IDs in Logs

If your request has an attached [Config](/docs/aigw/product/ai-gateway/configs) or if it's originating from a prompt template, you can see the relevant Config or Prompt IDs separately in the log's details on the AI Gateway. And to dig deeper, you can just click on the IDs and the AI Gateway will take you to the respective Config or Prompt playground where you can view the full details.

## Debug Requests with Log Replay

You can rerun any buggy request with just one click, straight from the log details page. The `Replay` button opens your request in a fresh prompt playground where you can rerun the request and edit it right there until it works.

<Info>
  `Replay` **button will be inactive for a log in the following cases:**

  1. If the request is sent to any endpoint other than `/chat/completions,` `/completions`, `/embeddings`
  2. If the provider used in the log is archived on the AI Gateway
  3. If the request originates from a prompt template which is called from inside a Config target
</Info>

## DO NOT TRACK

The `DO NOT TRACK` option allows you to process requests without logging the request and response data. When enabled, only high-level statistics like **tokens** used, **cost**, and **latency** will be recorded, while the actual request and response content will be omitted from the logs.

This feature is particularly useful when dealing with sensitive data or complying with data privacy regulations. It ensures that you can still capture critical operational metrics without storing potentially sensitive information in your logs.

To enable `DO NOT TRACK` for a specific request, set the `debug` flag to `false` when instantiating your **the AI Gateway** or **OpenAI** client, or include the `x-portkey-debug:false` header with your request.

<Tabs>
  <Tab title="cURL">
    ```sh theme={"system"}
    curl 'https://aigw.portkey.ai/v1/chat/completions' \
        -H 'Content-Type: application/json' \
        -H 'x-portkey-provider: $OPENAI_PROVIDER' \
        -H 'Authorization: Bearer $PORTKEY_API_KEY' \
        -H 'x-portkey-debug: false' \
        -d '{
        "model": "gpt-4o",
        "messages": [
          {
            "role": "system",
            "content": "You are a helpful assistant"
          },
          {
            "role": "user",
            "content": "what is a portkey?"
          }
        ]
    }'
    ```
  </Tab>

  <Tab title="OpenAI Python ">
    ```py theme={"system"}
    from openai import OpenAI

    client = OpenAI(
        api_key="PORTKEY_API_KEY",
        base_url="https://aigw.portkey.ai/v1",
        default_headers={"x-portkey-debug": False}
    )

    chat_complete = client.chat.completions.create(
        model="@OPENAI_PROVIDER/gpt-4",
        messages=[{"role": "user", "content": "Say this is a test"}],
    )

    print(chat_complete.choices[0].message.content)
    ```
  </Tab>

  <Tab title="OpenAI Node ">
    ```js theme={"system"}
    import OpenAI from 'openai';

    const openai = new OpenAI({
      apiKey: "PORTKEY_API_KEY",
      baseURL: "https://aigw.portkey.ai/v1",
      defaultHeaders: { "x-portkey-debug": false }
    });

    async function main() {
      const chatCompletion = await openai.chat.completions.create({
        messages: [{ role: 'user', content: 'Say this is a test' }],
        model: '@OPENAI_PROVIDER/gpt-3.5-turbo',
      });
      console.log(chatCompletion.choices);
    }

    main();
    ```
  </Tab>
</Tabs>

### Side-by-side comparison on how a `debug:false` request will be logged


## Related topics

- [Get logs by log id](/docs/aigw/api-reference/logs/get-logs-by-log-id.md)
- [Logs Export](/docs/aigw/product/observability/logs-export.md)
- [Audit Logs](/docs/aigw/product/enterprise-offering/audit-logs.md)
- [Post logs](/docs/aigw/api-reference/logs/post-logs.md)
- [Complete Logs Export](/docs/aigw/product/enterprise-offering/otel/complete-logs.md)
