System Log Insights Documentation¶
Menu Location: AI > System Log Insights
Access Level: Requires PERMISSION_MONEY or accounting access level
Last Updated: 2026-03-02
Overview¶
The System Log Insights page (log-insights.php) is an AI-powered system log analysis tool. Select a timeframe and the AI analyzes system logs as an experienced ecommerce operations analyst, providing concise insights on system health, customer behavior, API activity, errors, and anomalies. Real-time progress updates are shown via Pusher as the system loads, processes, and analyzes logs.
Primary Functions:
- AI-powered analysis of system logs across configurable timeframes
- Real-time progress updates during processing
- History of past AI insights for comparison
- Token-managed processing (caps at 120,000 tokens)
- Markdown-rendered analysis reports
- Persistent storage of all insights in API call history
Page Layout¶
Left Panel (col-md-7) - Analysis Area¶
Timeframe Buttons¶
| Button | Timeframe |
|---|---|
| Last 15 mins | Analyze recent 15 minutes of logs |
| Last 1 hour | Analyze the past hour |
| Last 6 hours | Analyze the past 6 hours |
| Last 24 hours | Analyze the full day |
Analysis Output¶
- Loading indicator during processing
- AI-generated analysis rendered as formatted markdown
- Covers: CRON health, errors, customer activity, API calls, anomalies
Right Panel (col-md-5) - History¶
- History: Clickable list of past insights
- Each entry shows: date/time and the timeframe analyzed
- Click any entry to reload that analysis
- Up to 100 most recent insights displayed
How the System Works¶
Analysis Pipeline¶
- Select Timeframe: Admin clicks a timeframe button
- Load Logs: System queries
syslogtable for the selected period - Enrich Data: Joins customer names and admin user info
- Token Management: Caps at 120,000 tokens to stay within AI limits
- Real-Time Updates: Pusher sends progress messages (record count, token estimate)
- AI Analysis: Sends log data to OpenAI with analyst prompt
- Render: Response is converted from markdown to HTML via Parsedown
- Store: Full API call is saved to
openaiCallsfor history
AI Analyst Prompt¶
The AI operates as:
"An experienced ecommerce operations analyst specializing in log review and anomaly detection. Concise, sharp, and insightful. Focus on system health, customer behavior, API activity, and potential issues. Reporting to the business owner."
What the AI Analyzes¶
- CRON Health: Are scheduled jobs running on time? Any failures?
- Error Detection: 404s, SQL errors, broken links, API failures
- Customer Activity: Signups, logins, browsing patterns, cancellations
- API Activity: External service calls, webhook responses
- Anomalies: Unusual traffic patterns, potential bot activity, suspicious behavior
- Email Queues: Backlog status, delivery issues
Token Limit Handling¶
If log data exceeds 120,000 tokens:
- Processing stops at the token limit
- A message shows how many records were loaded and the time range covered
- The analysis covers the loaded subset
How to Use¶
Running an Analysis¶
- Navigate to AI > System Log Insights
- Click one of the timeframe buttons (15 min, 1 hour, 6 hours, 24 hours)
- Watch the real-time progress updates:
- "Loading syslog entries..."
- "Found X records, estimated Y tokens"
- "Built AI conversation, sending to AI API..."
- "Conversation successful!"
- Read the formatted analysis when it appears
Viewing Past Insights¶
- Look at the History panel on the right side
- Click any past insight entry
- The analysis loads in the main panel
- Compare past analyses to identify emerging trends
Interpreting Results¶
The AI provides structured analysis covering:
- System Health Summary: Overall status of background processes
- Notable Errors: Specific errors worth investigating
- Customer Behavior: Activity patterns and notable actions
- Recommendations: Suggested follow-up actions
Common Use Cases¶
Morning Operations Check¶
Run a "Last 24 hours" analysis at the start of each business day to review overnight activity, catch errors, and verify CRON jobs completed successfully.
Incident Investigation¶
When something goes wrong, run a "Last 1 hour" or "Last 15 mins" analysis to quickly understand what happened without manually reading through logs.
Weekly Health Review¶
Compare insights across the week to identify recurring issues or deteriorating patterns. Use the History panel for quick access to previous analyses.
Post-Deployment Monitoring¶
After deploying code changes, run a "Last 15 mins" analysis to quickly verify no new errors were introduced.
Tips & Best Practices¶
- Start with shorter timeframes for faster results
- 24-hour analyses provide the best overview but take longer to process
- Use the History panel to compare analyses over time
- The AI filters out its own log entries to avoid self-referencing
- If the API times out, wait a minute and try again with a shorter timeframe
- Token limits mean very busy periods may only partially analyze - the AI notes this
Troubleshooting¶
"No records found" Message¶
- Verify the syslog table has data for the selected timeframe
- Check that the database connection is working
- Try a longer timeframe
API Timeout¶
- The page displays: "Oops, looks like the API timed out. Please wait a minute and try again."
- Try a shorter timeframe to reduce the data volume
- Wait a few minutes before retrying
Analysis Seems Incomplete¶
- Check if the token limit was reached (message indicates this)
- A shorter timeframe will produce more complete analysis of that period
- Very busy systems may hit the 120K token limit quickly
Database Tables¶
| Table | Purpose |
|---|---|
| syslog | System log entries with events, timestamps, user IDs |
| custy | Customer records (joined for names) |
| users | Admin user accounts (joined for usernames) |
| users_admin_info | Admin user details (joined for names) |
| openaiCalls | Stores all AI API calls including insights history |
FAQ¶
How much does each analysis cost?¶
Each analysis makes one OpenAI API call. Cost depends on token count - check the API Calls page for exact costs.
Can I analyze a custom time range?¶
Currently the page offers 4 preset timeframes. For custom ranges, the system supports start/end parameters but they aren't exposed in the UI.
Why are some analyses longer than others?¶
More log activity = more data for the AI to analyze = longer and more detailed output. Quiet periods produce shorter summaries.
Is the log data sent outside the system?¶
Yes, log data is sent to the OpenAI API for analysis. The data includes event descriptions, customer names, and admin usernames.
Related Pages¶
- System Log - Raw system log viewer
- AI Overview - Central AI dashboard
- API Calls - AI API call history and costs
- Admins Action History - Admin user activity tracking