Logging Settings
Screenshot of Logging Settings tab
Overview
Logging settings control what system activities are captured, stored, and made available for audit, debugging, compliance, and security analysis. When configured correctly, comprehensive logging helps you:
- Maintain audit trails for compliance (SOC2, HIPAA, GDPR)
- Debug issues by reviewing API call patterns and failures
- Monitor security by tracking unauthorized access attempts
- Analyze usage patterns to understand customer behavior
- Investigate incidents with complete activity history
- Demonstrate compliance during audits and security reviews
These settings work together to provide complete visibility:
- Log Dashboard Activities โ Captures admin actions in the web interface
- Log API Calls โ Records all successful API requests
- Log Failed API Calls โ Tracks unsuccessful API attempts
- Log Blocklisted API Calls โ Monitors blocked or rejected requests
Each toggle can be independently enabled or disabled based on your operational, compliance, and security requirements.
๐ก Tip: Start with all logging enabled during initial deployment, then adjust based on storage costs and performance requirements.
Log Dashboard Activities
Type: Toggle (On / Off)
Default: On
Screenshot showing Dashboard Activities toggle
Description
Enables or disables logging of all administrative actions performed through the Admin Portal web interface.
- ON: Every action taken by administrators in the web UI is recorded with timestamp, user, and details
- OFF: Dashboard activities are not logged; only direct API calls (if enabled) are tracked
What Gets Logged
When enabled, dashboard activity logging captures:
- License Management: Creation, modification, suspension, deletion, activation/deactivation
- User Actions: Login attempts (success/failure), logout, password changes, profile updates
- Settings Changes: Any modification to system settings across all tabs
- Customer Management: Creating, editing, or deleting customer records
- Product Configuration: Product creation, updates, pricing changes, feature modifications
- Bulk Operations: Mass license imports, exports, batch updates
- Search and Filtering: What data admins are viewing and searching
- Report Generation: Which reports are run and by whom
- Webhook Management: Adding, modifying, or deleting webhook endpoints
- Email Template Changes: Modifications to notification templates
Log Entry Contents
Each dashboard activity log entry includes:
| Field | Description | Example |
|---|---|---|
| Timestamp | Exact date and time (UTC) | 2024-01-15 14:32:18 UTC |
| Admin User | Email or username of admin | admin@company.com |
| Action Type | Category of action | LICENSE_SUSPENDED |
| Resource | What was affected | License #12345 |
| Details | Specific changes made | Reason: Payment failure |
| IP Address | Admin’s IP address | 203.0.113.42 |
| Session ID | Unique session identifier | sess_a4f8d2c1... |
| User Agent | Browser and OS information | Mozilla/5.0 Chrome/120.0 |
When to Enable
Enable dashboard activity logging if:
โ
Compliance Requirements: You need audit trails for SOC2, ISO 27001, HIPAA, or GDPR
โ
Security Monitoring: You want to track who does what in your system
โ
Accountability: Multiple admins access the system and you need attribution
โ
Incident Investigation: You need to reconstruct what happened during incidents
โ
Change Tracking: You want to know when and why settings were modified
โ
Support Debugging: Customer support needs to review admin actions
โ
Legal Requirements: Your industry requires complete activity logs
When to Disable
You might disable dashboard logging only if:
๐ง Cost Constraints: Log storage costs are prohibitively expensive
๐ง Single Admin: You’re a solo operator who doesn’t need self-tracking
๐ง Privacy Concerns: Your jurisdiction restricts activity monitoring
๐ง Performance: Your database is under extreme load (rare scenario)
โ ๏ธ Warning: Disabling dashboard logging removes your audit trail and makes incident investigation nearly impossible. This is strongly discouraged for production environments.
How It Works
- Admin performs action in dashboard (e.g., suspends a license)
- System intercepts the action before executing it
- Log entry is created with full context
- Action is executed
- Log entry is finalized with result (success/failure)
- Entry is stored in database with indexed timestamp
- Admin can review logs in Dashboard โ Activity Logs section
Real-World Example
Scenario: Security incident investigation
Timeline of Events:
------------------
14:23:45 - admin@company.com logged in from 198.51.100.10
14:24:12 - admin@company.com viewed License #48291 details
14:24:33 - admin@company.com suspended License #48291
Reason: "Suspicious activation pattern"
14:25:01 - admin@company.com added note to Customer #1893
Note: "Customer contacted support regarding suspension"
14:27:18 - admin@company.com unsuspended License #48291
Reason: "False positive - verified legitimate user"
14:28:02 - admin@company.com logged outThis complete trail allows you to:
- Understand the sequence of events
- Know who made decisions and why
- Reconstruct the incident for review
- Demonstrate due diligence in audits
Best Practices
For Security:
- โ Keep enabled at all times in production
- โ Review logs weekly for suspicious patterns
- โ Set up alerts for sensitive actions (bulk deletes, setting changes)
- โ Restrict access to logs to senior administrators only
- โ Export and archive logs monthly for long-term retention
For Compliance:
- ๐ Document your log retention policy (typically 1-7 years)
- ๐ Ensure logs include all required audit fields
- ๐ Implement tamper-proof log storage
- ๐ Regularly review logs as part of compliance checks
- ๐ Train admins that their actions are logged
For Operations:
- ๐ Use logs to identify repetitive manual tasks that could be automated
- ๐ Monitor for admin errors or misconfigurations
- ๐ Track which features admins use most frequently
- ๐ Identify training needs based on error patterns
Privacy Considerations
Dashboard activity logging involves collecting admin user data:
- Data Minimization: Logs capture necessary actions, not sensitive content
- Access Control: Only authorized admins should access activity logs
- Retention Limits: Implement automatic log deletion per retention policy
- Anonymization: Consider anonymizing logs after a certain period
- GDPR Rights: Admins may have right to access or delete their activity data
๐ก Tip: Clearly disclose to admin users that their actions are logged for security and compliance purposes.
Log API Calls
Type: Toggle (On / Off)
Default: On
Screenshot showing Log API Calls toggle
Description
Enables or disables logging of all successful API requests made to your KeyManager instance.
- ON: Every successful API call is recorded with full request and response metadata
- OFF: Only failed API calls (if enabled separately) are logged; successful calls are not tracked
What Gets Logged
When enabled, API call logging captures:
- License Operations: Activate, validate, deactivate, check status
- Product Queries: Retrieve product information, pricing, features
- Customer Operations: Create, update, retrieve customer data
- Webhook Deliveries: Outgoing webhook calls and responses
- Bulk Operations: Batch activations, imports, exports via API
- Analytics Queries: Usage statistics, reports, dashboard data
- Configuration Reads: Retrieving settings, policies, limits
Log Entry Contents
Each API call log entry includes:
| Field | Description | Example |
|---|---|---|
| Timestamp | Exact request time (UTC + milliseconds) | 2024-01-15 14:32:18.426 UTC |
| Endpoint | API path called | /api/v1/licenses/activate |
| Method | HTTP method | POST |
| Status Code | HTTP response code | 200 |
| Response Time | Duration in milliseconds | 142ms |
| Request IP | Client IP address | 198.51.100.33 |
| API Key | Identifier of key used (partial) | km_live_abc...xyz |
| Request Size | Bytes sent | 256 bytes |
| Response Size | Bytes received | 1,024 bytes |
| User Agent | Client application | KeyManager-SDK/2.1.0 Python/3.11 |
| License Key | Key involved (if applicable) | XXXX-XXXX-XXXX-#### (partially masked) |
๐ก Note: Sensitive data like complete license keys, API keys, and passwords are automatically masked or hashed in logs.
When to Enable
Enable API call logging if:
โ
Usage Analytics: You want to understand how customers use your product
โ
Performance Monitoring: You need to track API response times and identify slowdowns
โ
Debugging: You troubleshoot integration issues with customers
โ
Billing: You charge based on API usage and need accurate counts
โ
Capacity Planning: You analyze traffic patterns to plan infrastructure
โ
Compliance: Regulations require API access logs (e.g., PCI DSS)
โ
Rate Limiting: You need historical data to set appropriate rate limits
When to Disable
Consider disabling API call logging if:
โ ๏ธ High Volume: You process millions of API calls and storage costs are critical
โ ๏ธ Performance: Database write load from logging impacts API latency (rare)
โ ๏ธ Privacy: Your product requires minimal data collection
โ ๏ธ Redundancy: You have external API gateway logging (AWS API Gateway, Cloudflare, etc.)
๐ก Tip: Instead of fully disabling, consider sampling (log 1 in 100 requests) or logging only specific endpoints.
How It Works
- Client makes API request (e.g., license activation)
- Request passes through authentication layer
- Request handler begins processing
- If logging enabled, system captures request metadata
- Business logic executes (activation performed)
- Response is generated
- Response metadata and timing are captured
- Complete log entry is written to database asynchronously
- API response returns to client (logging doesn’t block response)
Performance Impact
API call logging is designed to have minimal performance impact:
- Asynchronous Writing: Logs are written after response is sent
- Batch Inserts: Multiple logs are batched for efficiency
- Indexed Storage: Logs use time-series optimized indexes
- Typical Overhead: < 5ms per request (not added to API latency)
- Storage Growth: ~500 bytes per log entry
Example Volume Calculations:
| API Calls/Day | Logs/Month | Storage/Month | Annual Storage |
|---|---|---|---|
| 10,000 | 300,000 | ~150 MB | ~1.8 GB |
| 100,000 | 3,000,000 | ~1.5 GB | ~18 GB |
| 1,000,000 | 30,000,000 | ~15 GB | ~180 GB |
| 10,000,000 | 300,000,000 | ~150 GB | ~1.8 TB |
Real-World Example
Scenario: Customer reports “intermittent activation failures”
With API call logging enabled, you can:
Query: Show all API calls for license key DEMO-2024-PROD-1234 in last 7 days
Results:
--------
โ
Jan 8, 09:15:23 - Activation success - 145ms - IP: 203.0.113.5
โ
Jan 9, 14:22:11 - Activation success - 132ms - IP: 203.0.113.5
โ Jan 10, 10:45:02 - Activation failed - 201ms - IP: 203.0.113.5
Error: Activation limit reached
โ
Jan 11, 08:30:19 - Validation success - 89ms - IP: 203.0.113.5
โ
Jan 12, 13:15:44 - Deactivation success - 112ms - IP: 203.0.113.5
โ
Jan 13, 09:05:33 - Activation success - 138ms - IP: 203.0.113.5
Diagnosis:
----------
Not intermittent - customer hit activation limit on Jan 10.
After deactivation on Jan 12, new activation succeeded.
Customer needs training on activation/deactivation workflow.Without logging, you’d have no visibility into the actual behavior.
Best Practices
For Analytics:
- ๐ Generate weekly reports on most-used endpoints
- ๐ Track API adoption rates among customers
- ๐ Identify which SDK versions are in use
- ๐ Monitor geographic distribution of API calls
- ๐ Measure success rates by endpoint
For Debugging:
- ๐ Create dashboard showing recent calls for each customer
- ๐ Set up alerts for unusual patterns (sudden traffic spikes)
- ๐ Enable detailed logging temporarily for problem customers
- ๐ Export logs to external tools (Elasticsearch, Splunk) for deep analysis
For Optimization:
- โก Identify slow endpoints needing performance tuning
- โก Find endpoints with high error rates
- โก Discover opportunities to add caching
- โก Optimize most frequently called endpoints first
Storage and Retention
Recommended Retention Periods:
| Purpose | Retention | Reasoning |
|---|---|---|
| Recent Debugging | 7-30 days | Hot storage, fast queries |
| Monthly Reports | 90 days | Trend analysis, billing verification |
| Compliance Audit | 1-7 years | Legal requirements (archive to cold storage) |
| Permanent Historical | Aggregated only | Store summaries, not individual logs |
Archival Strategy:
- Keep last 30 days in primary database (fast access)
- Move 30-90 day logs to compressed storage
- Archive older logs to cold storage (S3, Glacier)
- Aggregate and delete logs older than retention policy
- Ensure archived logs are tamper-proof for compliance
Log Failed API Calls
Type: Toggle (On / Off)
Default: On
Screenshot showing Log Failed API Calls toggle
Description
Enables or disables logging of unsuccessful API requests - calls that return error status codes (4xx, 5xx) or encounter exceptions.
- ON: Every failed API call is recorded with error details and context for debugging
- OFF: Failed calls are not logged separately (may still appear in general API logs if enabled)
What Gets Logged
When enabled, failed API call logging captures:
- Authentication Failures: Invalid API keys, expired tokens, missing credentials
- Authorization Errors: Insufficient permissions, access denied
- Validation Errors: Malformed requests, missing required fields, invalid data
- Business Logic Failures: Activation limits reached, license suspended, product not found
- Rate Limit Violations: Too many requests from a client
- Server Errors: Internal errors, database timeouts, external service failures
- Network Issues: Request timeouts, connection failures
Log Entry Contents
Each failed API call log includes everything from successful API logs, plus:
| Additional Field | Description | Example |
|---|---|---|
| Error Code | Application error code | ERR_LICENSE_SUSPENDED |
| Error Message | Human-readable error | License suspended due to payment failure |
| Stack Trace | Internal error trace (if server error) | at LicenseController.activate:142 |
| Validation Errors | Specific field errors | license_key: Required field missing |
| Retry Count | If request was retried | 3 attempts |
| Original Request Body | Complete request (sanitized) | {"license_key":"DEMO-..."} |
When to Enable
Enable failed API call logging if:
โ
Critical for Debugging: Failed calls are the most important to troubleshoot
โ
Security Monitoring: Detect brute force attacks, credential stuffing
โ
Integration Issues: Help customers fix API integration problems
โ
Error Rate Tracking: Monitor system health and reliability
โ
SLA Compliance: Track error rates against service level agreements
โ
Support Efficiency: Give support team visibility into customer issues
When to Disable
You might disable (rarely recommended) if:
โ ๏ธ Already Logged: General API logging is enabled and includes failures
โ ๏ธ Privacy Concerns: Error messages might contain sensitive data
โ ๏ธ Low Value: You have nearly zero API failures (unlikely)
โ ๏ธ Warning: Disabling this setting makes it extremely difficult to diagnose customer integration issues and security incidents. Keep this enabled unless you have compelling reasons.
How It Works
- Client makes API request
- Request processing encounters an error:
- Authentication fails
- Validation fails
- Business rule violation
- System exception
- Error handler is triggered
- If failed API logging enabled, detailed log entry created
- Error response is formatted
- Client receives error response
- Log entry is written asynchronously
Error Categories
| Category | HTTP Status | Examples | Priority |
|---|---|---|---|
| Client Errors | 400-499 | Bad request, unauthorized, not found | Medium |
| Authentication | 401, 403 | Invalid API key, expired token | High |
| Rate Limiting | 429 | Too many requests | Medium |
| Server Errors | 500-599 | Internal error, database timeout | Critical |
| Validation | 400, 422 | Missing fields, invalid format | Low |
Real-World Example
Scenario: Sudden spike in authentication failures
Alert: Authentication failure rate exceeded 10% threshold
Investigation:
--------------
Time: Jan 15, 2024 14:00-15:00
Total Requests: 15,432
Failed Auth: 2,108 (13.7%)
Top Errors:
-----------
1. "API key not found" - 1,845 failures (87.5%)
- All from customer_id: 4892
- IP: 198.51.100.15
- User Agent: Python-urllib/3.8
2. "API key expired" - 263 failures (12.5%)
- Multiple customers affected
- All API keys expired on Jan 15, 00:00
Root Cause:
-----------
Customer #4892 deployed code with incorrect API key (test key in production).
Multiple customers have keys expiring today (scheduled rotation).
Actions:
--------
1. Contact customer #4892 about API key error
2. Email customers with expiring keys
3. Extend grace period for expired keys
4. Add monitoring for API key expiration datesWithout failed API logging, this incident would be invisible or require manual customer reports.
Security Use Cases
Failed API call logs are essential for detecting:
Brute Force Attacks:
Pattern: 1,000+ authentication failures from single IP in 10 minutes
Action: Block IP, require API key rotationCredential Stuffing:
Pattern: Multiple API keys tried from same IP with sequential guessing
Action: Implement rate limiting, alert security teamEnumeration Attacks:
Pattern: Sequential license key validation attempts with incrementing IDs
Action: Add CAPTCHA to public endpoints, block suspicious IPsAccount Takeover Attempts:
Pattern: Valid API key with many "unauthorized" errors (permission changes)
Action: Investigate if customer account compromisedBest Practices
For Security:
- ๐ Review authentication failures daily
- ๐ Set up alerts for unusual failure patterns
- ๐ Automatically block IPs with excessive failures
- ๐ Correlate failures with abuse detection system
- ๐ Share failure patterns with security team
For Support:
- ๐ฏ Create customer-facing dashboard showing their API errors
- ๐ฏ Include common errors in API documentation
- ๐ฏ Build automated responses to common errors
- ๐ฏ Proactively notify customers of persistent failures
- ๐ฏ Analyze error messages to improve API usability
For Development:
- ๐ป Track error rates by API version (find regression)
- ๐ป Identify confusing error messages needing improvement
- ๐ป Discover edge cases not covered by tests
- ๐ป Prioritize fixes based on failure frequency
- ๐ป Monitor error rates after deployments
Log Blocklisted API Calls
Type: Toggle (On / Off)
Default: On
Screenshot showing Log Blocklisted API Calls toggle
Description
Enables or disables logging of API requests that are blocked or rejected by security policies before processing.
- ON: All blocked requests are logged with reasons and context
- OFF: Blocklisted calls are silently rejected without logging (not recommended)
A blocklisted API call is one that is rejected by:
- IP blocklists (banned addresses)
- API key blocklists (revoked or abusive keys)
- Country/region restrictions
- Known malicious user agents
- Requests matching abuse patterns
- Security rules (SQL injection attempts, etc.)
What Gets Logged
When enabled, blocklisted API call logging captures:
- IP-Based Blocks: Requests from banned IP addresses
- API Key Blocks: Calls using revoked or blocklisted keys
- Geographic Blocks: Requests from restricted countries
- Pattern-Based Blocks: Malicious request signatures
- Rate Limit Blocks: Excessive requests beyond limits
- Security Rule Triggers: WAF-style rule violations
- Abuse Detection Blocks: Automatically blocked suspicious behavior
Log Entry Contents
Each blocklisted API call log includes:
| Field | Description | Example |
|---|---|---|
| Timestamp | When request was blocked | 2024-01-15 14:32:18.123 UTC |
| Block Reason | Why it was blocked | IP_BLOCKLISTED |
| Rule ID | Specific rule triggered | RULE_GEO_BLOCK_CN |
| Request IP | Source IP address | 192.0.2.99 |
| Request Path | Attempted endpoint | /api/v1/licenses/activate |
| API Key | Key used (if present) | km_live_abc... (partial) |
| User Agent | Client identifier | curl/7.68.0 |
| Country Code | Geographic origin | CN |
| Request Fingerprint | Unique request signature | hash_a4f8d2c1... |
| Threat Score | Calculated risk level (0-100) | 85 (High Risk) |
When to Enable
Enable blocklisted API call logging if:
โ
Essential for Security: Monitor and investigate blocked threats
โ
Threat Intelligence: Build understanding of attack patterns
โ
False Positive Detection: Identify legitimate users incorrectly blocked
โ
Compliance Reporting: Document security measures for audits
โ
Attack Attribution: Track sources and patterns of malicious activity
โ
Policy Refinement: Improve blocklist rules based on data
โ
Incident Response: Investigate security incidents thoroughly
When to Disable
You might disable only if:
โ ๏ธ Privacy Regulations: Laws prohibit logging rejected requests
โ ๏ธ Extreme Volume: Under DDoS with millions of blocked requests
โ ๏ธ Storage Limits: Database completely full (temporary emergency measure)
โ ๏ธ Critical Warning: Disabling blocklist logging creates a security blind spot. You won’t know who’s trying to attack your system or if blocks are working correctly. This should remain enabled in nearly all cases.
How It Works
- API request arrives at gateway/firewall
- Security checks run before authentication:
- IP against blocklist
- Country against restrictions
- Request signature against attack patterns
- Rate limits checked
- If any check fails:
- Request is immediately rejected (not processed)
- If logging enabled, detailed block entry created
- Client receives generic error (no details about block reason)
- Log entry written asynchronously
- Security team can review blocked attempts
Block Reasons Explained
| Reason Code | Description | Typical Response |
|---|---|---|
IP_BLOCKLISTED | IP manually added to blocklist | Investigate for false positive |
GEO_BLOCKED | Request from restricted country | Verify geo-restriction policy |
API_KEY_REVOKED | Key explicitly revoked | User needs to contact support |
RATE_LIMIT_EXCEEDED | Too many requests too fast | Wait and retry (legitimate) |
ABUSE_PATTERN_DETECTED | Matches known attack signature | Likely malicious |
MALFORMED_REQUEST | Invalid syntax or protocol violation | Possibly attack attempt |
USER_AGENT_BLOCKED | Known malicious bot or scanner | Definitely malicious |
SQL_INJECTION_ATTEMPT | Contains SQL injection patterns | Critical security threat |
Real-World Example
Scenario: Detecting and responding to credential stuffing attack
Alert: Unusual blocklist activity detected
Timeline:
---------
14:00:00 - Normal traffic: ~50 API calls/minute
14:15:30 - Spike begins: 2,000+ calls/minute
14:16:00 - Rate limits triggered, requests start being blocked
Blocklist Log Analysis:
-----------------------
Time Range: 14:15:30 - 14:45:00
Blocked Requests: 45,892
Unique IPs: 342 (distributed attack)
Top Block Reason: RATE_LIMIT_EXCEEDED (89%)
Secondary: INVALID_API_KEY (11%)
Attack Pattern:
---------------
- Sequential API key guessing: km_live_aaa, km_live_aab, km_live_aac...
- Distributed across multiple IPs (botnet)
- User agents rotating (evasion attempt)
- Geographic origin: Mixed (VPN/proxy usage)
Response Actions:
-----------------
1. Implement CAPTCHA for authentication endpoints
2. Add pattern-based blocking for sequential key guessing
3. Require MFA for admin API operations
4. Contact hosting provider to block identified botnet IPs
5. Force API key rotation for all customers (precautionary)
6. Publish security advisory to customers
Outcome:
--------
Attack blocked with zero successful compromises.
45,892 malicious requests prevented from reaching application layer.
No legitimate customers affected.This level of visibility and response is only possible with blocklist logging enabled.
Security Monitoring
Daily Review Checklist:
- โ Check total blocked requests (establish baseline)
- โ Review top block reasons (identify trends)
- โ Investigate high threat score requests
- โ Look for false positives (legitimate users blocked)
- โ Analyze geographic distribution of blocks
- โ Check if any IPs should be permanently banned
Red Flags to Watch For:
- ๐จ Sudden spike in blocked requests (active attack)
- ๐จ Many blocks from same IP (persistent attacker)
- ๐จ SQL injection or XSS attempt patterns (critical threat)
- ๐จ Blocks from legitimate customer IPs (false positive)
- ๐จ Sequential key guessing patterns (credential stuffing)
Best Practices
For Security Teams:
- ๐ก๏ธ Export blocklist logs to SIEM system (Splunk, QRadar)
- ๐ก๏ธ Set up real-time alerts for critical block reasons
- ๐ก๏ธ Maintain threat intelligence feed of known bad IPs
- ๐ก๏ธ Quarterly review of all blocklist rules for effectiveness
- ๐ก๏ธ Coordinate with application security team on patterns
For Operations:
- โ๏ธ Monitor false positive rate (should be < 0.1%)
- โ๏ธ Document process for customers to appeal blocks
- โ๏ธ Implement automatic IP blocklist expiration (e.g., 30 days)
- โ๏ธ Create runbooks for common attack scenarios
- โ๏ธ Test blocklist rules regularly with safe simulations
For Compliance:
- ๐ Include blocklist metrics in security reports
- ๐ Demonstrate proactive threat prevention in audits
- ๐ Retain blocklist logs per compliance requirements
- ๐ Document incidents prevented by blocking
- ๐ Show continuous improvement of security posture
Privacy and Ethical Considerations
Logging blocked requests raises privacy questions:
Balancing Security and Privacy:
- Collect: IP, timestamp, request type (security essential)
- Avoid: Full request bodies, user credentials, personal data
- Mask: API keys, license keys, identifiable information
- Limit: Retention to compliance minimum (e.g., 90 days)
- Control: Access restricted to security team only
Regional Considerations:
- GDPR (EU): Logging for security is legitimate interest; must be proportionate
- CCPA (California): Security logs generally exempt from access requests
- Chinese Cybersecurity Law: May require different data handling
- Consult: Legal counsel for jurisdiction-specific requirements
Recommended Configurations
Production Environment (Standard)
Balanced approach for most deployments
- Log Dashboard Activities: ON
- Log API Calls: ON
- Log Failed API Calls: ON
- Log Blocklisted API Calls: ON
Reasoning: Complete visibility with manageable storage costs. Suitable for companies with moderate traffic (< 10M API calls/day).
Retention: 90 days hot, 1 year archive
High-Security Environment
Maximum audit trail for regulated industries
- Log Dashboard Activities: ON
- Log API Calls: ON (consider sampling at scale)
- Log Failed API Calls: ON
- Log Blocklisted API Calls: ON
Additional Measures:
- Export all logs to immutable storage (WORM)
- Enable log integrity checking (checksums)
- Implement real-time SIEM integration
- Require MFA for log access
- Quarterly third-party log audits
Retention: 7 years archive (compliance requirement)
Use Cases: Healthcare (HIPAA), Finance (SOX), Government (FedRAMP)
High-Volume Environment
Optimized for scale (> 100M API calls/day)
- Log Dashboard Activities: ON (low volume, always log)
- Log API Calls: ON with 1% sampling OR OFF (use external gateway)
- Log Failed API Calls: ON (failures are critical)
- Log Blocklisted API Calls: ON (security essential)
Optimization Strategy:
- Sample successful API calls (log 1 in 100)
- Use time-series database for logs (InfluxDB, TimescaleDB)
- Implement hot/warm/cold storage tiers
- Aggregate old logs into summaries
- Consider external API gateway logging (AWS API Gateway, Kong)
Reasoning: Failed and blocked calls are most important. Sampling successful calls provides usage insights without full storage burden.
Development/Staging Environment
Detailed logging for debugging
- Log Dashboard Activities: ON
- Log API Calls: ON
- Log Failed API Calls: ON
- Log Blocklisted API Calls: ON
Additional Settings:
- Lower retention (7-30 days)
- Include verbose error details
- Log request/response bodies (sanitized)
- Enable debug-level application logging
Reasoning: Development environments benefit from maximum detail for troubleshooting. Storage costs are minimal with low traffic.
Minimal Configuration (Not Recommended)
Only for extremely resource-constrained environments
- Log Dashboard Activities: ON (critical for security)
- Log API Calls: OFF
- Log Failed API Calls: ON (critical for debugging)
- Log Blocklisted API Calls: ON (critical for security)
โ ๏ธ Warning: This configuration significantly limits visibility and troubleshooting capabilities. Only use if absolutely necessary.
Important Notes
๐ Logs are stored in your database โ monitor database size and implement archival
๐ Access to logs should be restricted โ they contain sensitive operational data
โฐ All timestamps are UTC โ convert to local time zone when reviewing
๐ Logs are searchable โ use filters effectively to find relevant entries
๐ Log volume impacts performance slightly โ usually negligible (< 5% overhead)
๐พ Implement log rotation โ prevent database bloat with retention policies
๐จ Set up alerts โ don’t just log; actively monitor for anomalies
๐ Logs may contain PII โ follow data protection regulations
๐ค Export capabilities โ integrate with external log management systems
๐งน Regular cleanup โ delete or archive old logs per retention policy
Summary Table
| Setting | Purpose | Typical State | Storage Impact |
|---|---|---|---|
| Log Dashboard Activities | Track admin actions for audit | ON | Low (< 1GB/year) |
| Log API Calls | Monitor API usage and performance | ON | High (varies by volume) |
| Log Failed API Calls | Debug integration and security issues | ON | Low (< 5% of total) |
| Log Blocklisted API Calls | Track blocked threats and attacks | ON | Low (depends on attacks) |
Testing Your Configuration
Step 1: Enable All Logging
Start with all four settings enabled to establish baseline behavior.
Step 2: Generate Test Activities
Dashboard Actions:
- Create a test license
- Modify a setting
- Generate a report
- Review activity logs
API Calls:
- Make successful API call (e.g., license validation)
- Check API logs for entry
- Note response time and log details
Failed API Calls:
- Make request with invalid API key
- Attempt activation with invalid license key
- Verify failures appear in logs with error details
Blocklisted Calls:
- Add your test IP to blocklist temporarily
- Attempt API call
- Verify block is logged
- Remove IP from blocklist
Step 3: Review Log Entries
Navigate to Dashboard โ Logs and verify:
- โ All actions appear in appropriate log sections
- โ Timestamps are accurate
- โ Details include sufficient context for debugging
- โ Sensitive data is properly masked
- โ Logs are searchable and filterable
Step 4: Test Log Retention
- Configure retention policy (e.g., 30 days)
- Verify automated cleanup runs
- Confirm old logs are archived or deleted
- Test archive access and restore if implemented
Step 5: Measure Performance Impact
Baseline Test:
- Disable all logging temporarily
- Run performance test (100 API calls)
- Record average response time
Logging Enabled Test:
- Enable all logging
- Run same performance test
- Compare response times
Expected Result: < 10% increase in response time
Step 6: Validate Integrations
If using external log management:
- Verify logs export to SIEM/log aggregator
- Test alert rules trigger correctly
- Confirm log format is parseable
- Check for any gaps or delays in export
Step 7: Security Testing
- Simulate attack (from safe test environment)
- Verify blocklist logging captures attempts
- Test that alerts fire appropriately
- Confirm incident response runbook works
Frequently Asked Questions
Q: How long should I retain logs?
A: Minimum 90 days for operational debugging. For compliance: 1-7 years depending on regulations (SOC2: 1 year, HIPAA: 6 years, SOX: 7 years). Implement archival to cold storage for cost efficiency.
Q: Do logs contain sensitive customer data?
A: Logs contain metadata (what happened, when, who) but sensitive values are masked. Complete license keys, API keys, and passwords are never stored in plaintext. Some PII (IP addresses, user IDs) may be present for security purposes.
Q: Can I export logs to external systems?
A: Yes, KeyManager supports log export to SIEM systems, log aggregators (Splunk, Elasticsearch), and object storage (S3). Configure webhooks or use the API to pull logs programmatically.
Q: What’s the performance impact of logging?
A: Minimal. Logs are written asynchronously and batched. Typical overhead is < 5ms per request and doesn’t affect API response times. At extreme scale (> 100M calls/day), consider sampling.
Q: How do I troubleshoot missing log entries?
A: Check: (1) Setting is enabled, (2) Database has free space, (3) No errors in system logs, (4) Log retention policy hasn’t deleted them, (5) Filters/search aren’t hiding them.
Q: Are logs tamper-proof?
A: Standard logs are stored in database and can be modified by database admins. For compliance requiring immutable logs, enable log export to WORM (write-once-read-many) storage or blockchain-based audit systems.
Q: Can customers access their own logs?
A: By default, no. Logs are admin-only. You can build customer-facing analytics showing their API usage without exposing full logs. Some jurisdictions (GDPR) may give customers right to access their activity data.
Q: What happens if database fills up during high traffic?
A: New logs may be dropped or queued temporarily. Set up monitoring alerts for database disk space. Implement log rotation and archival to prevent this scenario.
Q: How do I investigate a specific incident?
A: Use log search with filters: (1) Time range, (2) Customer ID or license key, (3) Error type or block reason, (4) IP address. Export matching logs for detailed analysis.
Q: Should I log request/response bodies?
A: Generally NO for privacy and storage reasons. Log only metadata (endpoint, status, timing). Enable body logging temporarily for specific debugging with customer consent.
Q: How do I comply with GDPR “right to erasure”?
A: Document that logs are kept for security/fraud prevention (legitimate interest). You may need to anonymize or delete user-specific logs upon request, while retaining aggregated security data.
Q: Can I customize what gets logged?
A: Standard settings control major categories. For custom logging, use webhooks to receive events and log to your own systems with your specific requirements.
How to Access
Via Admin Portal
- Log in to the Admin Portal at
https://yourdomain.com/admin - Navigate to Settings in the main navigation menu
- Click the Logging tab
- Review current settings (each shows ON/OFF status)
- Toggle any setting to change configuration
- Click Save Settings at the bottom of the page
- Confirm success message appears
Via API
Update logging settings programmatically:
curl -X PUT https://yourdomain.com/api/v1/settings/logging \
-H "Authorization: Bearer YOUR_ADMIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"log_dashboard_activities": true,
"log_api_calls": true,
"log_failed_api_calls": true,
"log_blocklisted_api_calls": true
}'Viewing Logs
Dashboard Activities:
- Navigate to Dashboard โ Activity Logs
- Filter by date, admin user, action type
- Export to CSV for analysis
API Call Logs:
- Navigate to Analytics โ API Logs
- Filter by endpoint, status, customer, time range
- View detailed request/response metadata
Failed API Logs:
- Navigate to Analytics โ API Logs โ Failures
- See error messages and stack traces
- Group by error type for pattern analysis
Blocklist Logs:
- Navigate to Security โ Blocked Requests
- Review threat scores and block reasons
- Whitelist IPs if false positives detected
Related Settings
- Settings Overview - All settings categories
- Abuse Detection - Automatic abuse monitoring
- Security Settings - Additional security controls
- Webhooks - Real-time event notifications
- Email Settings - Notification configuration
- Storage Settings - Log retention and archival
Log Management Best Practices Summary
โ Do This
- โ Enable all logging in production for complete visibility
- โ Implement log retention policy based on compliance requirements
- โ Set up automated archival to cold storage after 90 days
- โ Monitor log storage usage and set up alerts
- โ Review security logs weekly for anomalies
- โ Export critical logs to external SIEM for redundancy
- โ Document incident response procedures using logs
- โ Train admin team on log access and interpretation
- โ Mask sensitive data in logs automatically
- โ Test log retrieval regularly to ensure accessibility
โ Avoid This
- โ Don’t disable logging to save costs (penny-wise, pound-foolish)
- โ Don’t ignore failed API logs (they indicate real problems)
- โ Don’t leave logs unmonitored (logging without reviewing is useless)
- โ Don’t store logs indefinitely (privacy risk and cost)
- โ Don’t grant log access to all admins (limit to security team)
- โ Don’t log sensitive data in plaintext (passwords, credit cards)
- โ Don’t rely only on internal logs (have external backup)
- โ Don’t skip testing log archival and restore procedures
- โ Don’t forget compliance requirements for your industry
- โ Don’t wait for incidents to implement proper logging
Comprehensive logging is the foundation of security, compliance, and operational excellence. Invest in proper log management from day one.