---
title: 开启OpenClaw日志脱敏
description: "OpenClaw提供了内置的工具摘要脱敏功能，可以在日志输出到控制台之前自动屏蔽敏感信息（如API Key、Token、Bearer头等）。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengaiagent/bestpractice/aiagent-0057.html
sourcePath: /source/zh/kunpengaiagent/bestpractice/aiagent-0057.html
indexId: 4050d7c7bb165a5beace3b0e8ad27b68f08c4d8e3f89c0f1c808f21a29f89da956
---
# 开启OpenClaw日志脱敏

OpenClaw提供了内置的工具摘要脱敏功能，可以在日志输出到控制台之前自动屏蔽敏感信息（如API Key、Token、Bearer头等）。

#### 操作步骤

- 方式一：

  1. 开启脱敏（默认已开启）。

```
openclaw config set logging.redactSensitive "tools"
```


  2. 查看当前脱敏配置。

```
openclaw config get logging
```


  3. 重启OpenClaw网关。

```
openclaw gateway restart
```


- 方式二

  1. 打开配置文件。

```
vim
~
/.openclaw/openclaw.json
```


  2. 按“i”进入编辑模式，添加如下配置。

```
{
"logging": {
"redactSensitive": "tools"
}
}
```


  3. 按“Esc”键退出编辑模式，输入:wq!，按“Enter”键保存并退出文件。
  4. 重启OpenClaw网关。

```
openclaw gateway restart
```
