PHP S3 Logs Parser

PHP S3 Logs Parser

S3 Logs Parser is a PHP package by Alex Kolev to analyze and query AWS S3 access logs quickly. The detailed usage report includes stats for downloads and the number of bytes transferred.

This package provides a convenience class for parsing these logs with minimal effort on your part. Once you enable server access logging on an S3 bucket, here’s the gist of how you would use this package to get stats for the bucket:

use S3LogsParser\S3LogsParser;

$S3LogsParser = new S3LogsParser([
    'version' => 'latest',
    'region' => $awsBucketRegion,
    'access_key' => $awsAccessKey,
    'secret_key' => $awsSecretKey,
]);

$S3LogsParser->getStats($awsBucketName, $awsBucketPrefix, $date);

The getStats method returns a JSON-formatted string of the S3 log data:

{
    "success":true,
    "statistics":{
        "bucket":"bn-test",
        "prefix":"bp-2018-10-31",
        "data":{
            "test.png":{
                "downloads":4,
                "bandwidth":4096
            },
            "test2.png":{
                "downloads":2,
                "bandwidth":2048
            }
        }
    }
}

Learn More

You can learn more about this package, get full installation instructions, and view the source code on GitHub at mtrdesign/s3-logs-parser.

Filed in: News
Laravel News Partners

Laravel Jobs

Backend Software Engineer (PHP Developer)
Austin TX, Bonita Springs FL
Certified eSupport Corp
Backend PHP Developer
Hamburg, Germany
ABOUT YOU GmbH
Full-Stack Engineer (Mid to Senior)
Remote (EST, CST)
Voxie
Senior Laravel Developer (AI Applications)
Remote from anywhere in the UK or from our London office
GreenShoot Labs
Full Stack Engineer
Remote
Shelterluv

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.