Audit Logs & Analytics
Monitor API access, track usage patterns, and analyze security events in FlowGenX
FlowGenX provides comprehensive audit logging and analytics capabilities to monitor API access, track usage patterns, identify security issues, and generate insights for data-driven decisions.
Overview
Complete Audit Trail
Track every API request with detailed logs, analytics dashboards, and real-time monitoring capabilities across all environments.
The audit system consists of three main components:
- Access Logs: Detailed records of API requests and responses
- Analytics Dashboard: Usage trends, performance metrics, and insights
- API Trace: Deep inspection of individual requests with Loki integration
Access Logs
Access logs provide a complete audit trail of all API requests made through the FlowGenX gateway.
Log Attributes
Each access log entry includes:
| Field | Description |
|---|---|
| Timestamp | Exact time of the request (UTC) |
| Consumer | Username or ID making the request |
| Request Path | API endpoint accessed |
| HTTP Method | GET, POST, PUT, DELETE, PATCH |
| Response Status | HTTP status code (200, 401, 403, 404, etc.) |
| Access Granted | Whether the request was allowed |
| Denial Reason | Why access was denied (if applicable) |
| IP Address | Source IP of the request |
| User Agent | Client application identifier |
| Response Time | Request processing duration (ms) |
Viewing Access Logs
Advanced Filtering
Filter logs by consumer, path, status, time range, and access result to quickly find relevant events.
To access logs:
- Navigate to ACL Management → Audit Analytics
- Select Access Logs tab
- Apply filters as needed:
| Filter | Description |
|---|---|
| Time Window | Last 24h, 7 days, 30 days, or custom range |
| Consumer ID | Filter by specific consumer username |
| Request Path | Filter by API endpoint |
| Access Granted | Show only allowed or denied requests |
| Response Status | Filter by HTTP status code |
- Review log entries in the table
- Export to CSV for offline analysis
Denied Requests Analysis
Security Monitoring
Track denied requests to identify potential security issues, misconfigured permissions, or unauthorized access attempts.
Denied Request Metrics:
- Total denied requests in time period
- Denial breakdown by reason:
- No ACL groups assigned
- Route not in allowed list
- IP restriction violation
- Time restriction violation
- Invalid credentials
- Top consumers with denials
- Most frequently denied routes
Common Denial Reasons:
| Reason | Description | Resolution |
|---|---|---|
| No ACL Groups | Consumer has no groups assigned | Assign consumer to appropriate groups |
| Route Not Allowed | Route not in consumer's group permissions | Add route to group or assign different group |
| IP Restriction | Request from unauthorized IP | Update IP allowlist or use allowed IP |
| Time Restriction | Request outside allowed time window | Wait for allowed time or update restrictions |
| Invalid Credentials | API key or OAuth token invalid/expired | Regenerate credentials |
Top Consumers
Track the most active API users:
- Consumer Username: Identity of the consumer
- Total API Calls: Request count in selected period
- Percentage of Traffic: Share of total API traffic
- Trend Indicator: Growth or decline compared to previous period
Use cases:
- Identify heavy users for capacity planning
- Detect unusual activity patterns
- Monitor quota usage
- Prioritize support for top consumers
Analytics Dashboard
The analytics dashboard provides high-level insights into API usage patterns and performance.
Summary Metrics
Real-Time Statistics
Monitor key performance indicators updated in real-time as requests flow through the gateway.
Key Metrics:
| Metric | Description |
|---|---|
| Total API Calls | Total requests in selected time window |
| Unique Consumers | Number of distinct consumers making requests |
| Average Calls/Day | Daily average request count |
| Success Rate | Percentage of successful (2xx) responses |
| Denied Requests | Total access denials |
| Peak Hour | Hour with highest request volume |
Usage by Group
Analyze API consumption by ACL groups:
- Group Name: ACL group identifier
- Total Calls: Requests from consumers in this group
- Usage Share: Percentage of total traffic
- Progress Bar: Visual representation of usage
Insights:
- Identify most active groups
- Detect unused groups
- Plan capacity by group
- Optimize permissions based on usage
Usage by Consumer
Track individual consumer activity:
- Consumer Username: Consumer identifier
- API Calls: Request count
- Usage Share: Percentage of total requests
- Trend: Growth or decline indicator
Applications:
- Monitor individual consumer behavior
- Detect anomalous activity
- Enforce rate limits
- Generate usage reports for billing
Trending Routes
Identify most accessed API endpoints:
- Route Path: API endpoint URL
- Total Calls: Request count
- Change Percentage: Growth/decline vs. previous period
- Trend Indicator: Up/down arrow with percentage
Use cases:
- Optimize frequently accessed endpoints
- Deprecate unused routes
- Plan caching strategies
- Monitor API adoption
Time-Based Analytics
Configure granularity and time range:
| Granularity | Description | Best For |
|---|---|---|
| Hourly | Hour-by-hour breakdown | Last 24-48 hours analysis |
| Daily | Day-by-day breakdown | Week or month trends |
| Weekly | Week-by-week breakdown | Monthly or quarterly trends |
| Monthly | Month-by-month breakdown | Yearly trends |
Time Ranges:
- Last 24 hours
- Last 7 days
- Last 30 days
- Last 90 days
- Custom date range
API Trace with Loki
Deep request inspection using Grafana Loki integration for detailed tracing and debugging.
Features
Container-Level Logging
Integrate with Grafana Loki for container-level log aggregation and advanced query capabilities.
Trace Capabilities:
- Request/Response Inspection: View full HTTP headers and payloads
- Latency Analysis: Breakdown of request processing time
- Error Tracking: Detailed error messages and stack traces
- Consumer Context: Full consumer and group information
- Gateway Logs: Kong gateway processing logs
- Upstream Logs: Backend service logs
Using API Trace
- Navigate to ACL Management → Monitoring & Observability
- Select API Trace tab
- Configure Loki connection (if not already set up):
- Loki URL (e.g.,
http://loki:3100) - Authentication (if required)
- Loki URL (e.g.,
- Search for traces:
- Filter by time range
- Filter by consumer
- Filter by route
- Filter by status code
- Search log content
- Click on a trace to view details:
- Request details
- Response details
- Timing information
- Related logs
Log Queries
Example Loki queries for common scenarios:
All requests from a consumer:
{job="kong"} |= "consumer_username=\"mobile-app\""Failed requests (5xx errors):
{job="kong"} | json | status >= 500Slow requests (>1000ms):
{job="kong"} | json | duration > 1000Denied requests:
{job="kong"} | json | access_granted="false"Exporting Data
CSV Export
Export access logs for offline analysis:
- Apply desired filters
- Click Export button
- Select export format (CSV)
- Download file
Exported Fields:
- Timestamp
- Consumer username
- Request path
- HTTP method
- Response status
- Access granted (true/false)
- Denial reason
- Response time
JSON Export
Export analytics reports:
- Navigate to Reports section
- Generate desired report (usage, security audit, compliance)
- Click Export button
- Download JSON file
Use cases:
- Import into BI tools
- Feed into SIEM systems
- Custom report generation
- Compliance documentation
Monitoring Best Practices
Regular Review
✓ Review access logs daily for unusual patterns ✓ Monitor denied requests for security issues ✓ Track top consumers for capacity planning ✓ Analyze trending routes for optimization opportunities ✓ Export logs weekly for long-term retention
Alert Configuration
Set up alerts for:
- Spike in denied requests (potential attack)
- Unusual consumer activity (anomaly detection)
- Error rate increase (system issues)
- Latency degradation (performance problems)
- New consumers (onboarding tracking)
Security Monitoring
✓ Watch for repeated failed authentication attempts ✓ Monitor access from unexpected IP addresses ✓ Track requests to sensitive endpoints ✓ Identify consumers with excessive denial rates ✓ Review time-based access violations
Performance Optimization
✓ Identify slow endpoints for optimization ✓ Monitor peak usage hours for capacity planning ✓ Track error rates by route ✓ Analyze consumer request patterns ✓ Optimize heavily-used routes
Integration with SIEM
FlowGenX logs can be integrated with Security Information and Event Management (SIEM) systems:
Supported Integrations
- Splunk: Forward logs via HTTP Event Collector
- Elasticsearch: Direct log shipping
- Datadog: Agent-based log collection
- Azure Sentinel: Log Analytics integration
- AWS CloudWatch: Stream to CloudWatch Logs
Log Format
Logs are available in structured JSON format:
{
"timestamp": "2024-01-15T10:30:45Z",
"consumer_id": "mobile-app",
"consumer_groups": ["api-readers", "mobile-apps"],
"request": {
"path": "/api/users",
"method": "GET",
"ip": "192.168.1.100",
"user_agent": "FlowGenX-Mobile/1.0"
},
"response": {
"status": 200,
"duration_ms": 45
},
"access": {
"granted": true,
"reason": null
}
}Troubleshooting
Missing Logs
Issue: Logs not appearing in dashboard
Resolution:
- Check time window selection (ensure it covers request time)
- Verify filters aren't too restrictive
- Confirm consumer/route is correctly spelled
- Check Loki connection status (if using API Trace)
- Verify requests are actually reaching the gateway
Delayed Metrics
Issue: Analytics not updating in real-time
Resolution:
- Allow 1-2 minutes for metrics aggregation
- Refresh the dashboard page
- Check backend service health
- Verify database connectivity
Export Failures
Issue: Cannot export logs to CSV
Resolution:
- Check browser popup blocker
- Ensure sufficient permissions
- Try smaller time range (reduce data size)
- Clear browser cache and retry
Loki Connection Issues
Issue: API Trace not showing logs
Resolution:
- Verify Loki URL is correct and accessible
- Check authentication credentials
- Confirm Loki is receiving logs from Kong
- Test Loki connectivity directly
- Review Loki configuration and retention policies