How do I save laravel.log to Amazon AWS S3?

Published 8 months ago by hellomars

Dear users,

I would like to save my laravel.log to S3. I have created a bucket on S3 and able to read and save a sample text file on S3 using Tinker.

I've changed the local storage line in config\filesystems.php from:

'default' => env('FILESYSTEM_DRIVER', 'local'),

to

 'default' => env('FILESYSTEM_CLOUD', 's3'),

But I still get a new log file in the local storage folder.... Who knows how to get this into S3?

Best Answer (As Selected By hellomars)
Dry7
Dry7
Dry7
8 months ago (151,680 XP)
hellomars

Hi Dry7, interesting. So instead of having it saved directly, it saves it every hour. This way, I could also modify the output name. I think this feature is worthwhile investigating. I'll wait for a couple of days and if no other (maybe better?) option is available, I'll mark your answer as the best!

martinbean

@hellomars I think you’re better off writing logs to CloudWatch, which is an AWS service intended for logging, unlike S3.

hellomars

Martinbean, that is an excellent suggestion as well, I will definitely look into that!

Please sign in or create an account to participate in this conversation.