API Logs
Every Karrio Insiders project comes with comprehensive API logging and monitoring capabilities, providing detailed request/response tracking, performance analytics, error monitoring, and usage insights with advanced search and filtering capabilities.
Features
Complete Request/Response Logging
You don’t have to guess what’s happening with your API calls. Our logging system captures every API interaction with full request and response details for comprehensive debugging and monitoring.
API Logs Dashboard
Screenshot: API logs interface with request details, performance metrics, and error analysis
Performance Monitoring
Track response times, throughput, and system performance across all API endpoints with detailed metrics and alerting.
Error Analysis
Comprehensive error tracking with categorization, impact analysis, and debugging information to quickly identify and resolve issues.
Advanced Search & Filtering
Powerful search capabilities across all log data with filtering by endpoint, user, organization, time range, and custom metadata.
Compliance Auditing
Complete audit trails for regulatory compliance including data access logs, user activity, and system changes.
Additional features
- Karrio extends API logs with custom retention policies and data export capabilities.
- Every log entry includes structured metadata for advanced analytics and reporting.
- Karrio manages log aggregation and real-time streaming for immediate insights.
- Support for custom log processors and external monitoring system integration.
Data Flow
API Logging Architecture
API Reference
GraphQL API
Query API Logs
1query GetLogs($filter: LogFilter) { 2 logs(filter: $filter) { 3 page_info { 4 count 5 has_next_page 6 has_previous_page 7 start_cursor 8 end_cursor 9 } 10 edges { 11 node { 12 id 13 path 14 host 15 data 16 method 17 response_ms 18 remote_addr 19 requested_at 20 status_code 21 query_params 22 response 23 records { 24 id 25 key 26 timestamp 27 test_mode 28 created_at 29 meta 30 record 31 } 32 } 33 } 34 } 35}
Variables:
1{ 2 "filter": { 3 "method": ["POST", "GET"], 4 "status_code": [200, 201, 400, 500], 5 "path": "/v1/connections", 6 "offset": 0, 7 "first": 20 8 } 9}
Response:
1{ 2 "data": { 3 "logs": { 4 "page_info": { 5 "count": 1185, 6 "has_next_page": true, 7 "has_previous_page": false, 8 "start_cursor": "MTg2OA==", 9 "end_cursor": "MTgzOA==" 10 }, 11 "edges": [ 12 { 13 "node": { 14 "id": 1868, 15 "path": "/v1/connections", 16 "host": "localhost:5002", 17 "data": { 18 "active": true, 19 "capabilities": ["shipping", "tracking"], 20 "carrier_id": "aeroship:us:test", 21 "carrier_name": "generic", 22 "credentials": { 23 "custom_carrier_name": "aeroship", 24 "display_name": "Aeroship" 25 }, 26 "metadata": { 27 "description": "Generic test carrier for development" 28 } 29 }, 30 "method": "POST", 31 "response_ms": 32, 32 "remote_addr": "127.0.0.1", 33 "requested_at": "2025-05-31T19:07:24.551739+00:00", 34 "status_code": 201, 35 "query_params": {}, 36 "response": { 37 "id": "car_0f52413a83244fe49bd2d544d0440fb4", 38 "object_type": "carrier-connection", 39 "carrier_name": "aeroship", 40 "display_name": "Aeroship", 41 "carrier_id": "aeroship:us:test", 42 "credentials": { 43 "display_name": "Aeroship", 44 "custom_carrier_name": "aeroship" 45 }, 46 "capabilities": ["shipping"], 47 "config": {}, 48 "metadata": { 49 "description": "Generic test carrier for development" 50 }, 51 "is_system": false, 52 "active": true, 53 "test_mode": true 54 }, 55 "records": [] 56 } 57 } 58 ] 59 } 60 } 61}
Get Single Log Entry
1query GetLog($id: Int!) { 2 log(id: $id) { 3 id 4 requested_at 5 response_ms 6 path 7 remote_addr 8 host 9 method 10 query_params 11 data 12 response 13 status_code 14 records { 15 id 16 key 17 timestamp 18 test_mode 19 created_at 20 meta 21 record 22 } 23 } 24}
Variables:
1{ 2 "id": 1868 3}
Response:
1{ 2 "data": { 3 "log": { 4 "id": 1868, 5 "requested_at": "2025-05-31T19:07:24.551739+00:00", 6 "response_ms": 32, 7 "path": "/v1/connections", 8 "remote_addr": "127.0.0.1", 9 "host": "localhost:5002", 10 "method": "POST", 11 "query_params": {}, 12 "data": { 13 "active": true, 14 "capabilities": ["shipping", "tracking"], 15 "carrier_id": "aeroship:us:test", 16 "carrier_name": "generic", 17 "credentials": { 18 "custom_carrier_name": "aeroship", 19 "display_name": "Aeroship" 20 } 21 }, 22 "response": { 23 "id": "car_0f52413a83244fe49bd2d544d0440fb4", 24 "object_type": "carrier-connection", 25 "carrier_name": "aeroship", 26 "display_name": "Aeroship", 27 "active": true, 28 "test_mode": true 29 }, 30 "status_code": 201, 31 "records": [] 32 } 33 } 34}
JavaScript/TypeScript SDK
Using the Karrio SDK to access API logs:
1import { useLogs, useLog } from '@karrio/hooks'; 2 3// Query logs with filtering 4const LogsComponent = () => { 5 const { query, filter, setFilter } = useLogs({ 6 method: ['POST', 'GET'], 7 status_code: [200, 201, 400, 500], 8 offset: 0, 9 first: 20 10 }); 11 12 const handleFilterChange = (newFilter) => { 13 setFilter({ 14 ...filter, 15 ...newFilter 16 }); 17 }; 18 19 if (query.isLoading) return <div>Loading logs...</div>; 20 if (query.error) return <div>Error loading logs</div>; 21 22 return ( 23 <div> 24 <h3>API Request Logs</h3> 25 {query.data?.logs.edges.map(({ node: log }) => ( 26 <div key={log.id}> 27 <p>{log.method} {log.path} - {log.status_code}</p> 28 <p>Response time: {log.response_ms}ms</p> 29 <p>Host: {log.host}</p> 30 <p>Remote address: {log.remote_addr}</p> 31 <p>Requested at: {log.requested_at}</p> 32 </div> 33 ))} 34 </div> 35 ); 36}; 37 38// Get single log entry 39const LogDetailComponent = ({ logId }) => { 40 const { query } = useLog(logId); 41 42 if (query.isLoading) return <div>Loading log...</div>; 43 if (query.error) return <div>Error loading log</div>; 44 45 const log = query.data?.log; 46 47 return ( 48 <div> 49 <h3>Log Details</h3> 50 <p>ID: {log?.id}</p> 51 <p>Path: {log?.path}</p> 52 <p>Method: {log?.method}</p> 53 <p>Status: {log?.status_code}</p> 54 <p>Response time: {log?.response_ms}ms</p> 55 <pre>{JSON.stringify(log?.data, null, 2)}</pre> 56 <pre>{JSON.stringify(log?.response, null, 2)}</pre> 57 </div> 58 ); 59}
Log Retention & Compliance
Data Retention Policies
Configure automatic data retention based on your compliance requirements:
- Standard Retention: 90 days for request/response logs
- Extended Retention: 1 year for audit logs and compliance data
- Custom Policies: Define retention based on data sensitivity and regulations
Export Capabilities
Export log data for external analysis or archival:
Export logs to external systems1const exportLogs = async (filter, format = "json") => { 2 const { query } = useLogs(filter); 3 4 // Export to various formats 5 const exportFormats = ["json", "csv", "parquet"]; 6 7 return query.data?.logs.edges.map(({ node }) => ({ 8 id: node.id, 9 timestamp: node.requested_at, 10 method: node.method, 11 path: node.path, 12 status_code: node.status_code, 13 response_time_ms: node.response_ms, 14 remote_addr: node.remote_addr, 15 })); 16};
Use Cases
API Debugging & Troubleshooting
Perfect for development teams diagnosing integration issues:
- Request/Response Analysis: Complete request and response data for debugging
- Performance Investigation: Identify slow endpoints and bottlenecks
- Error Pattern Analysis: Track error frequencies and root causes
- User-Specific Issues: Investigate problems for specific users or organizations
Operations & Monitoring
Essential for platform monitoring and capacity planning:
- Real-Time Performance: Monitor response times and system health
- Usage Analytics: Track API adoption and growth patterns
- Capacity Planning: Analyze traffic for infrastructure scaling decisions
- Alert Generation: Automated alerts for errors and performance degradation
Compliance & Auditing
Meet regulatory requirements with comprehensive audit trails:
- Access Logging: Complete audit trail of data access and modifications
- Regulatory Compliance: GDPR, HIPAA, SOC2 compliance reporting
- Security Monitoring: Track suspicious activity and access patterns
- Data Retention: Automated retention policies and secure archival
Getting Started
Ready to implement comprehensive API logging with Karrio? Follow these steps:
- Configure log retention policies for your compliance requirements
- Set up monitoring and alerting for critical API metrics
- Implement log analysis workflows for debugging and optimization
- Create compliance reports for audit and regulatory requirements
Next Steps
- Learn about webhooks for real-time event monitoring
- Explore events to understand the full event system
- Set up admin console for centralized log management
- Configure workflows for automated log-based triggers