> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 在服务器日志中包含HTTP头

默认情况下，出于隐私考虑，[代理服务器](/langsmith/agent-server)会从服务器日志中省略HTTP头。但是，记录请求ID和关联ID可以帮助您调试问题并在分布式系统中跟踪请求。您可以通过修改[`langgraph.json`](/langsmith/application-structure#configuration-file)文件中的`logging_headers`部分，选择为所有API调用记录HTTP头。

```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "$schema": "https://langgra.ph/schema.json",
  "http": {
    "logging_headers": {
      "includes": ["request-id", "x-purchase-id", "*-trace-*"],
      "excludes": ["authorization", "x-api-key", "x-organization-id", "x-user-id"]
    }
  }
}
```

`includes`和`excludes`列表接受精确的头名称或使用`*`作为通配符匹配任意数量字符（不区分大小写）的通配符模式。为了您的安全，不支持其他模式类型。

请注意，排除项优先于包含项。例如，如果您包含`*-id`但排除`x-user-id`，则`x-user-id`头将不会被记录。

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档连接](/use-these-docs)到Claude、VSCode等，通过MCP获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在GitHub上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/langsmith/configurable-logs.mdx)或[提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
