Module 11Lesson 2

Lesson 2. Logging: How to Understand What's Happening

Hands-on: n8n

Lesson 2. Logging: How to Understand What's Happening#

Goal: learn to log agent actions so you can quickly find and fix errors.

What Is Logging#

Logging is recording all important events in the agent's work:

  • who contacted the agent and when
  • what the agent did (read data, sent a message, called an API)
  • what errors occurred
  • how long each operation took

Why it matters:

  • Debugging: if the agent breaks, you can check the logs and see where the error happened
  • Monitoring: you see how many requests the agent handles, which requests are most popular
  • Security: you spot suspicious activity (e.g., too many requests from one IP)

What to Log#

Always log:

  1. Incoming requests:

    • date and time
    • user ID (or anonymous identifier)
    • request text (or its essence)
  2. Agent actions:

    • which API was called
    • what data was sent (no sensitive data!)
    • result (success / error)
  3. Errors:

    • date and time
    • error description
    • error stack (if available)
    • what the agent was doing when the error occurred
  4. Metrics:

    • request execution time
    • requests per hour / day
    • error count

Never log:

  • passwords
  • payment data (card numbers, CVV)
  • full personal data (passports, tax IDs) — only hashes or IDs

How to Log in No-Code Tools#

1. Google Sheets (simple option)

Create a "Logs" table with columns:

TimestampUserIDActionDetailsStatusErrorMessage
2026-02-03 10:15:0012345send_emailto: ivan@example.comsuccess
2026-02-03 10:16:0012346call_apiAPI: OpenAI, model: GPT-5.2failedRate limit exceeded

Each time the agent performs an action — a new row is added.

How to implement:

  • in Zapier / Make / n8n add a "Google Sheets → Add Row" step after each important action
  • pass to the table: timestamp, userID, action, details, status

2. Airtable (better for analysis)

Create a "Logs" base with fields:

  • Timestamp (date and time)
  • UserID (link to Users table)
  • Action (single select: send_email, call_api, create_record)
  • Status (single select: success, failed)
  • ErrorMessage (long text)

Benefits: you can filter, group, and build views (errors only, successes only).

3. Built-in Platform Logs

Many platforms have built-in logs:

  • n8n: Executions (workflow run history)
  • Zapier: Task History (Zap run history)
  • Make: History (scenario history)
  • Zapier Chatbots: Logs (in the chatbot dashboard)

Use built-in logs for debugging, but for long-term storage and analysis it's better to duplicate to your own table.

How to Read Logs#

Scenario 1: agent didn't send email

  1. Open the logs table
  2. Find the record with Action = send_email
  3. Check Status and ErrorMessage
  4. If Status = failed, ErrorMessage = "Invalid email address" → problem with email format
  5. Fix the data (or validation) and test again

Scenario 2: agent became slow

  1. Check the "Execution time" metric (if you log it)
  2. Find the step that takes the most time
  3. Optimize that step (caching, batch requests, switching to a faster API)

Practical Example: Support Bot Logging#

Logic:

  1. User sends a question to the bot
  2. Agent logs: Timestamp, UserID, Action: "incoming_message", Details: "How do I request a refund?", Status: "received"
  3. Agent searches for an answer in the knowledge base
  4. Agent logs: Action: "search_kb", Details: "query: refund", Status: "success"
  5. Agent sends a response to the user
  6. Agent logs: Action: "send_response", Details: "response sent", Status: "success"

If something breaks:

  • open the logs table
  • filter by Status = failed
  • see which step failed
  • fix it