Configure your applications with robust logging using Archil disks that automatically flow to Amazon S3 storage. Simply mount an Archil disk and point your regular application loggers to it - no S3 APIs required.
Transparent S3 Integration
Write to normal filesystem paths and logs automatically sync to S3
Instance Isolation
Each instance creates its own directory for proper ownership separation
Infinite Capacity
Never run out of capacity because your logs are going to S3
Standard Logging Libraries
Use your existing logging setup - Python logging, winston, etc.
First, create an Archil disk for your logging infrastructure. Follow the Quickstart Guide to create a disk, then mount it in shared mode to allow multiple instances to write logs simultaneously.
# Create the mount directorysudo mkdir -p /mnt/logs# Mount the Archil disk in shared modesudo archil mount dsk-0123456789abcdef /mnt/logs --region aws-us-east-1 --shared
Each application instance should create its own directory within the mounted filesystem. We recommend doing this as part of a startup script or on application startup:
Copy
Ask AI
# Create instance-specific log directory using hostnameINSTANCE_DIR="/mnt/logs/$(hostname)"mkdir -p "$INSTANCE_DIR"# Or use a custom instance identifierINSTANCE_ID="${INSTANCE_ID:-$(date +%s)-$$}"INSTANCE_DIR="/mnt/logs/instance-${INSTANCE_ID}"mkdir -p "$INSTANCE_DIR"
With Archil, you don’t need traditional log rotation because logs are automatically offloaded to S3, where there’s infinite capacity. The application configuration examples above already demonstrate time-based file creation for chronological organization.
One of the key advantages of using Archil for logging is that your logs automatically flow to S3, giving you access to all of S3’s built-in cost optimization features. You can leverage S3’s intelligent tiering and lifecycle policies to automatically move your log data to cheaper storage classes over time without any application changes.Configure lifecycle policies on your S3 bucket to automatically transition logs to cheaper storage classes:
Once your logs are flowing to S3 through Archil, you can use Amazon Athena to run SQL queries directly against your log data without needing to load it into a database.
First, create a table in Athena that maps to your S3 log structure. Since logs are organized by instance ID with timestamps in filenames, we’ll use a simpler partitioning approach:
Copy
Ask AI
CREATE EXTERNAL TABLE application_logs ( timestamp string, level string, message string, module string, function string, line int)PARTITIONED BY ( instance_id string)STORED AS TEXTFILELOCATION 's3://your-bucket/logs/'TBLPROPERTIES ( 'projection.enabled' = 'true', 'projection.instance_id.type' = 'injected', 'storage.location.template' = 's3://your-bucket/logs/${instance_id}/')
Alternatively, if you want time-based partitioning for better query performance, you can reorganize your log structure or use a non-partitioned table:
Copy
Ask AI
-- Non-partitioned approach (simpler, works with current structure)CREATE EXTERNAL TABLE application_logs_simple ( timestamp string, level string, message string, instance_id string, module string, function string, line int)STORED AS TEXTFILELOCATION 's3://your-bucket/logs/'
-- Find all errors in the last 24 hoursSELECT timestamp, instance_id, messageFROM application_logsWHERE level = 'ERROR' AND timestamp >= date_format(date_add('hour', -24, now()), '%Y-%m-%d %H:%i:%s')ORDER BY timestamp DESCLIMIT 100;-- Count errors by instanceSELECT instance_id, COUNT(*) as error_countFROM application_logsWHERE level = 'ERROR' AND timestamp >= date_format(date_add('day', -1, now()), '%Y-%m-%d')GROUP BY instance_idORDER BY error_count DESC;