Logs & Monitoring - Track Conversations
In this chapter, you'll learn how to track, analyze and use conversations with your agents for improvements.
📊 What are Logs?
Logs are detailed records of all interactions between users and your agents. They contain:
- 💬 Messages: What did the user ask? What did the agent answer?
- 🛠️ Tool Calls: Which tools were used?
- 💰 Token Usage: How many tokens were consumed? What did it cost?
- ⏱️ Timestamps: When did the conversation take place?
- 🏷️ Metadata: Sales channel, agent, thread ID, etc.
🎯 Why are Logs Important?
1. Quality Control
- Check if your agents give correct answers
- Identify errors or inappropriate responses
2. Cost Monitoring
- See exactly which conversations cost how much
- Identify expensive requests
3. Knowledge Management
- Build a FAQ database from real customer questions
- Use frequent questions for agent improvement
4. Performance Analysis
- Which tools are used most frequently?
- How long do conversations last?
5. Debugging
- When problems occur: What exactly happened?
- Which tools were called in which order?
🔍 Find Logs in Shopware Backend
Step 1: Open Logs Overview
- Log in to the Shopware backend
- Navigate to 5E OAI Agent Manager (in main menu)
- Click on the "Assistant Logs" tab
Step 2: What You See
The logs overview shows a table with the following columns:
| Column | Description |
|---|---|
| Date | Date and time of conversation |
| Agent | Which agent was used? |
| Question | The user's question/request |
| Answer | The agent's answer (abbreviated) |
| Tokens | Number of tokens consumed |
| Cost | Estimated cost in USD |
| Sales Channel | Which shop did the conversation take place in? |
| Thread ID | Unique conversation ID |
| Tags | Assigned categories/keywords |
🔎 Filter and Search Logs
Filter by Time Period
- Click on the date filter
- Select a time period:
- Today
- Last 7 days
- Last month
- Custom
Filter by Agent
- Click on the agent filter
- Select one or more agents
- Only conversations with these agents will be displayed
Filter by Tags
- Click on the tag filter
- Select tags like "shipping", "returns", "product", etc.
- Only conversations with these tags will be displayed
Full-text Search
- Use the search field in the top right
- Search for keywords in questions or answers
- Example: Search for "delivery time" shows all conversations containing this term
📖 View Individual Conversation
Open Conversation Details
- Click on a log entry in the table
- A detail dialog will open
What You See in Detail
1. Conversation Header
- Thread ID
- Agent name
- Date and time
- Sales channel
2. Message History
Each message shows:
┌─────────────────────────────────────────┐
│ 👤 User (14:32:15) │
├─────────────────────────────────────────┤
│ I'm looking for a red jacket in size M │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ 🔧 Tool Call: product_search │
├─────────────────────────────────────────┤
│ Parameters: │
│ - query: "red jacket" │
│ - filters: {size: "M"} │
│ - limit: 10 │
├─────────────────────────────────────────┤
│ Result: 5 products found │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ 🤖 Agent (14:32:18) │
├─────────────────────────────────────────┤
│ I found 5 red jackets in size M: │
│ │
│ 1. Winter Jacket Red - $89.99 │
│ 2. Rain Jacket Sport - $49.99 │
│ ... │
└─────────────────────────────────────────┘
3. Token Statistics
| Type | Count | Cost |
|---|---|---|
| Input Tokens | 1,245 | $0.0019 |
| Output Tokens | 520 | $0.0031 |
| Cached Tokens | 980 | $0.0002 |
| Total | 2,745 | $0.0052 |
4. Metadata
- Model: Which OpenAI model was used? (e.g.,
gpt-4o-mini) - Temperature: Creativity setting (e.g.,
0.7) - Reasoning Effort: Think depth (e.g.,
medium) - Tools used: List of all called tools
📊 Understanding Token Usage
What are Tokens?
A token is the smallest unit that OpenAI processes:
- 1 Token ≈ 4 characters
- 1 Token ≈ 0.75 words (in English)
Example:
"Hello, how can I help you?"
= approx. 6 tokens
Token Types
1. Input Tokens (Input)
Everything that is sent to OpenAI:
- User message
- System Instructions
- Tool descriptions
- Conversation history
Cost Example (gpt-4o-mini):
- $0.15 per 1 million tokens
- 1,000 tokens = $0.00015
2. Output Tokens (Output)
Everything that OpenAI returns:
- Agent answers
- Tool calls
Cost Example (gpt-4o-mini):
- $0.60 per 1 million tokens
- 1,000 tokens = $0.0006
3. Cached Tokens (Cache)
Reused input tokens from previous requests:
- 50-90% cheaper than normal input tokens
- Automatically cached by OpenAI
Cost Example (gpt-4o-mini):
- $0.075 per 1 million tokens (50% discount)
- 1,000 tokens = $0.000075
💰 Cost per Conversation
Cost Calculation Example
A typical product search:
Input Tokens: 1,500 tokens × $0.00000015 = $0.000225
Output Tokens: 600 tokens × $0.00000060 = $0.000360
Cached Tokens: 1,200 tokens × $0.00000008 = $0.000096
─────────────────────────────────────────────────────
Total: $0.000681
Per Day (100 conversations):
- 100 × $0.000681 = $0.068 (approx. 7 cents)
Per Month (3,000 conversations):
- 3,000 × $0.000681 = $2.04
🏷️ Using Tags
What are Tags?
Tags are keywords for categorizing conversations:
shipping- Delivery questionsreturns- Return questionsproduct- Product advicepayment- Payment questionserror- Problems/errors
Automatically Assign Tags
Tags are automatically set when the agent uses the tag_conversation tool.
Example in Instructions:
When the customer asks about shipping, use the tag_conversation tool
with the tag "shipping".
Manually Add Tags
- Open a conversation in detail view
- Click "Edit tags"
- Select existing tags or create new ones
- Save
Use Tags for Analysis
Example Scenario:
You want to know how many customers ask about shipping:
- Filter: Tag = "shipping"
- Time period: Last month
- Result: 450 conversations
Insights:
- Shipping questions are frequent (450 out of 3,000 = 15%)
- Maybe you should place shipping information more prominently
- Or: Create shipping FAQ
📈 Use Logs for Improvements
1. Identify Frequent Questions
Approach:
- Filter logs from last 30 days
- Look for frequently recurring topics
- Create a list
Example Results:
- "How long does shipping take?" → 120 times
- "Can I return?" → 95 times
- "What size fits me?" → 78 times
Action:
- Create FAQ entries with
create_log_entry - Agent can then retrieve them with
search_logs
2. Find Incorrect Answers
Signs of problems:
- Agent gives wrong product information
- Tool calls fail
- Answers are incomprehensible
Approach:
- Read problematic conversations completely
- Identify the problem (wrong tool? Unclear instructions?)
- Improve agent configuration
3. Analyze Tool Usage
Questions:
- Which tools are used most frequently?
- Are important tools not being used at all?
- Does the agent call unnecessary tools?
Example:
You see in the logs:
product_search: 1,200 callsget_order_status: 450 callsget_shipping_info: 2 calls
Insight:
get_shipping_infois hardly used- Maybe you should explicitly mention in instructions when to use this tool
4. Identify Performance Problems
Warning signals:
- Conversations last > 30 seconds
- Many tool calls in succession
- High token usage
Solutions:
- Lower Reasoning Effort (from
hightomedium) - Deactivate unneeded tools
- Shorten instructions
🗄️ Database Structure (for Advanced Users)
Logs are stored in the following tables:
fel_assistant_logs
Main table for log entries:
id- Unique IDquestion- User questionanswer- Agent answercontext- Additional contextmeta_info- Metadata (JSON)created_at- Timestampsales_channel_id- Sales channel
fel_assistant_chat_message
Detailed messages per thread:
id- Unique IDthread_id- Thread referencerole-userorassistantortoolcontent- Message contenttool_calls- Tool calls (JSON)token_usage- Token statistics (JSON)created_at- Timestamp
fel_assistant_tags
Tag definitions:
id- Unique IDname- Tag name (e.g., "shipping")description- Description
fel_assistant_tag_usage
Link between logs and tags:
log_id- Reference to log entrytag_id- Reference to tag
📤 Export Logs (Workaround)
Note: Currently there is no direct export in the UI.
Manual Export Options:
1. Via phpMyAdmin / Adminer
SELECT
created_at,
question,
answer,
JSON_EXTRACT(meta_info, '$.tokens') as tokens,
JSON_EXTRACT(meta_info, '$.cost') as cost
FROM fel_assistant_logs
WHERE created_at >= '2025-01-01'
ORDER BY created_at DESC;
Export result as CSV.
2. Via Shopware CLI (for developers)
bin/console dbal:run-sql "SELECT * FROM fel_assistant_logs" > logs.csv
🔐 Privacy & Log Cleanup
GDPR Compliance
Logs potentially contain personal data:
- Customer questions may contain names, addresses, order numbers
- IP addresses (if stored)
Recommendations:
Set Retention Period
- E.g., automatically delete logs after 90 days
- Configurable in plugin configuration
Anonymization
- Remove sensitive data from logs
- Replace order numbers, names, etc.
Information Duty
- Customers can request information about stored data
- Logs must be searchable (e.g., by email)
Manually Delete Logs
- Go to 5E OAI Agent Manager → Assistant Logs
- Select log entries (checkbox)
- Click "Delete"
- Confirm
Deleted logs cannot be recovered!
🛠️ Troubleshooting
Logs Not Displayed
Solution:
- Check if logging is enabled in plugin configuration
- Check time period filter (maybe set too narrow?)
- Clear cache:
bin/console cache:clear
Token Usage Incorrect
Note: Costs are estimates based on OpenAI prices.
For exact costs:
- Go to platform.openai.com/usage
- Check real costs in your OpenAI dashboard
Performance with Many Logs
Problem: With thousands of logs, the overview becomes slow.
Solutions:
- Use filters (time period, agent, tags)
- Delete old, no longer needed logs
- Enable database indexes (for developers)
📊 Example Analysis
Scenario: Monthly Report
You want to know how successful your agent was last month.
Approach:
Set filters:
- Time period: Last month
- Agent: Your product advisor agent
Collect numbers:
- Number of conversations: 2,847
- Average tokens per conversation: 1,250
- Total cost: approx. $2.30
Analyze tags:
product: 1,200 (42%)shipping: 650 (23%)returns: 450 (16%)payment: 320 (11%)- Other: 227 (8%)
Identify top questions:
- "What size fits me?" → 95 times
- "Do you have this in blue?" → 78 times
- "How long does shipping take?" → 67 times
Derive actions:
- ✅ Create FAQ "Size chart"
- ✅ Mention color variants in product advisor
- ✅ Include shipping information in Init Instructions
📋 Checklist: Use Logs Effectively
- Logging enabled in plugin configuration
- Regularly check logs (e.g., weekly)
- Use tags for categorization
- Save frequent questions as FAQ entries
- Monitor token usage
- Identify and fix incorrect answers
- Follow privacy policies
- Regularly clean up old logs
- Create monthly analysis
- Use insights for agent improvement
Next Steps
Now you understand how to monitor and analyze logs!
➡️ Knowledge Management - Build a FAQ database
➡️ Cost Management - Optimize costs
➡️ Back to Main Documentation