Audit Log Hook for Openclaw

A robust logging mechanism that records every tool interaction for security and performance analysis.

hanxiao-bot
v1.0.0
Apr 2, 2026
0
681
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install audit-log-hook

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install audit-log-hook using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Audit Log Hook?

The Audit Log Hook is a specialized utility designed to capture granular data from tool executions within an agentic environment. By leveraging lifecycle hooks that trigger before and after tool calls, this Openclaw Skills extension provides deep visibility into agent behavior, ensuring every action is documented for security compliance and technical troubleshooting.

This skill allows developers to maintain a verifiable trail of activity, making it easier to manage complex AI workflows. It specifically focuses on capturing input parameters, session context, and execution results while maintaining a lightweight footprint on the system.

Audit Log Hook Use Cases

  • Security auditing of all automated system commands and tool executions.
  • Debugging failed tool calls by analyzing raw input parameters and error messages.
  • Generating usage statistics to identify the most frequently used tools across the platform.
  • Monitoring session activity to track user-specific interactions and potential misuse.

How Audit Log Hook Works

  1. The hook triggers a before_tool_call event to record initial parameters, timestamps, and user session context.
  2. The AI agent executes the requested tool within the designated session environment.
  3. Upon completion, the after_tool_call hook captures the output result, execution duration, and any generated error messages.
  4. Log entries are serialized into JSON and appended to a structured audit.log file for persistent storage and analysis.

Audit Log Hook Setup

To integrate this monitoring capability into your Openclaw Skills setup, ensure your state directory is configured and the hook plugin is registered.

# Create the state directory if it does not exist
mkdir -p ~/.openclaw

# The skill automatically writes logs to the audit.log file
touch ~/.openclaw/audit.log

Audit Log Hook Data Schema & Taxonomy

The Audit Log Hook generates structured JSON entries. Below is the schema for the log data:

Field Description Type
ts ISO 8601 Timestamp of the event String
event Hook type (before_tool_call or after_tool_call) String
tool Name of the tool being executed String
params JSON string of tool parameters (truncated) String
result Output or return value of the tool String
error Error message if the tool call failed String
duration Total execution time in milliseconds Number
session Unique identifier for the agent session String

Audit Log Hook Advanced Features

  • Automatic Redaction: Built-in logic to mask sensitive data such as API keys, tokens, and passwords before logging.
  • Log Analysis Toolkit: Use standard CLI utilities like jq to filter tool usage, count error rates, and track unique sessions.
  • Performance Benchmarking: Measure the durationMs of every tool call to identify bottlenecks in your Openclaw Skills workflows.
  • Multi-User Tracking: Captures senderId to attribute tool calls to specific users in a multi-tenant environment.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*