A simple package to forward Laravel application logs to a Kinesis stream

Overview

Laravel Monolog Kinesis Driver

Latest Version on Packagist GitHub Workflow Status Software License Total Downloads

A simple package to forward Laravel application logs to a Kinesis stream.

Installation

Require the package with composer:

composer require pod-point/laravel-monolog-kinesis

For Laravel < 6.0 you can use pod-point/laravel-monolog-kinesis:^2.0.

Setting up the AWS Kinesis service

Add your AWS key ID, secret and default region to your config/services.php:



return [

    // ...

    'kinesis' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],

];

Usage

Simply use the kinesis driver on any of your channels within your config/logging.php:



return [

    // ...
    
    'channels' => [
    
        'some_channel' => [
            'driver' => 'kinesis',
            'stream' => 'some_stream_name',
            'level' => 'info', // default level is debug
        ],

    ],

];

You can optionally specify a different key, secret and region at the channel level too if necessary:



return [

    // ...
    
    'channels' => [
    
        'some_channel' => [
            'driver' => 'kinesis',
            'stream' => env('LOGGING_KINESIS_STREAM'),
            'level' => env('LOG_LEVEL', 'debug'),
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
        ],

    ],

];

Permissions

If you are using an AWS Key, remember to add the kinesis:PutRecord and kinesis:PutRecords permissions to this user.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.


Travel shouldn't damage the earth 🌍

Made with ❤️   at Pod Point

You might also like...
A simple package to manage the creation of a structure composed of the service and repository layers in a Laravel application
A simple package to manage the creation of a structure composed of the service and repository layers in a Laravel application

Chapolim Este projeto tem como objetivo fornecer alguns comandos adicionais à interface de linha de comando do Laravel, o Artisan, para manipular a es

A simple package allowing for consistent API responses throughout your Laravel application
A simple package allowing for consistent API responses throughout your Laravel application

Laravel API Response Helpers A simple package allowing for consistent API responses throughout your Laravel application. Requirements PHP ^7.4 | ^8.0

Laravel package to find performance bottlenecks in your laravel application.
Laravel package to find performance bottlenecks in your laravel application.

Laravel Meter Laravel Meter monitors application performance for different things such as requests, commands, queries, events, etc and presents result

Laravel comments - This package enables to easily associate comments to any Eloquent model in your Laravel application

Laravel comments - This package enables to easily associate comments to any Eloquent model in your Laravel application

 Laravel Logable is a simple way to log http request in your Laravel application.
Laravel Logable is a simple way to log http request in your Laravel application.

Laravel Logable is a simple way to log http request in your Laravel application. Requirements php = 7.4 Laravel version = 6.0 Installation composer

A Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.
A Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

A Laravel package helps you add a complete real-time messaging system to your new / existing application with only one command.

Laravel package that converts your application into a static HTML website
Laravel package that converts your application into a static HTML website

phpReel Static Laravel Package phpReel Static is a simple Laravel Package created and used by phpReel that converts your Laravel application to a stat

This Package helps you in laravel application to log all desired activity for each request from request entry point to generate response at a single snapshot.

Laravel Scenario Logger This Package helps you in laravel application to log all desired activity for each request from request entry point to generat

Gretel is a Laravel package for adding route-based breadcrumbs to your application.
Gretel is a Laravel package for adding route-based breadcrumbs to your application.

Gretel Laravel breadcrumbs right out of a fairy tale. Gretel is a Laravel package for adding route-based breadcrumbs to your application. Defining Bre

Comments
  • [SWP-5671] Support null AWS credentials for assumed IAM roles

    [SWP-5671] Support null AWS credentials for assumed IAM roles

    When environment variables are not set for example:

    'kinesis' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    ],
    

    which gives

    'kinesis' => [
        'key' => null,
        'secret' => null,
        'region' => 'us-east-1',
    ],
    

    we should not try to pass an array of empty credentials to the AWS Client like

    'credentials' => [
        'key' => null,
        'secret' => null,
    ],
    'region' => 'eu-west-1',
    

    but instead should completely omit the credentials like so

    'region' => 'eu-west-1',
    

    This is so we can leverage EC2 Assumed IAM Roles to automatically authenticate with IAM Roles if needed.

    opened by clemblanco 0
  • [SWP-3973] Refactoring

    [SWP-3973] Refactoring

    Fix ?

    Link to ticket: Auth service logs not showing up in Kibana

    What has been done

    • Fix CI pipeline (was using outdated Ubuntu 16)
    • No need for our own config/monolog-kinesis.php file, we can piggy back on config/services.php for default AWS creds
    • Using the decorator pattern to create src/Kinesis.php in order to avoid binding the raw KinesisClient from the AWS SDK into the container. Let's say we need this Client to stream another kind of data through Kinesis but using another region or another set of credentials, we wouldn't be able to resolve a different instance, with a different config. This gives us much more control over our Client and makes it easier to test too.
    • Binding against an interface instead of a class so it's easier to test and makes it bespoke to our package as we're binding against PodPoint\MonologKinesis\Contracts\Client instead of Aws\Kinesis\KinesisClient.
    • Ability to define AWS creds both at channel level and at config/services.php level (for the defaults)
    • Add missing tests
    • Improve naming convention
    • Automatically update CHANGELOG.md upon new releases.

    This should superseed Release v3.0.0 if possible.

    opened by clemblanco 0
  • [SWP-2832] Auth Service Upgrade: 5.6+ Package

    [SWP-2832] Auth Service Upgrade: 5.6+ Package

    Fix ?

    Link to ticket: https://podpoint.atlassian.net/browse/SWP-2832

    What has been done

    • update structure so it can be added as a logging channel
    • supports Laravel 5.6+
    opened by HasnatH 0
Releases(v4.0.2)
  • v4.0.2(Oct 5, 2022)

    What's Changed

    • Allows Custom Formatter by @djonasm in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/17
    • Delete CHANGELOG.md in favour of the Release page by @clemblanco in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/16
    • Support null AWS credentials for assumed IAM roles by @clemblanco in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/18

    Full Changelog: https://github.com/Pod-Point/laravel-monolog-kinesis/compare/v4.0.1...v4.0.2

    Source code(tar.gz)
    Source code(zip)
  • v4.0.1(May 20, 2022)

    What's Changed

    • Update README.md badges by @clemblanco in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/12
    • Allow custom http client options by @djonasm in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/15
    • Document http options + fix typo in composer.json @clemblanco in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/14

    New Contributors

    • @djonasm made their first contribution in https://github.com/Pod-Point/laravel-monolog-kinesis/pull/15

    Full Changelog: https://github.com/Pod-Point/laravel-monolog-kinesis/compare/v4.0.0...v4.0.1

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Feb 22, 2022)

    Refactoring + Laravel 9 support

    • Fix CI pipeline (was using outdated Ubuntu 16)
    • No need for our own config/monolog-kinesis.php file, we can piggy back on config/services.php for default AWS creds
    • Using the decorator pattern to create src/Kinesis.php in order to avoid binding the raw KinesisClient from the AWS SDK into the container. Let's say we need this Client to stream another kind of data through Kinesis but using another region or another set of credentials, we wouldn't be able to resolve a different instance, with a different config. This gives us much more control over our Client and makes it easier to test too.
    • Binding against an interface instead of a class so it's easier to test and makes it bespoke to our package as we're binding against PodPoint\MonologKinesis\Contracts\Client instead of Aws\Kinesis\KinesisClient.
    • Ability to define AWS creds both at channel level and at config/services.php level (for the defaults)
    • Add missing tests
    • Improve naming convention
    • Update README.md
    • Automatically update CHANGELOG.md upon new releases
    • Adding Laravel 9 and PHP 8.1 support
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jun 4, 2021)

    Laravel 6+ Support

    • First release supporting PHP 7.2+ and Laravel 6+ #5
    • Drop support for Monolog 1.* and PHPUnit 7.*
    • Switch to Github Actions from Travis CI
    • Moved to Laravel custom log driver implementation

    ⚠️ Breaking Changes:

    • This version no longer supports Laravel 5.*, please use version 2.* which supports it. Please use v2.* of this package if using Laravel < 6.

    Full Changelog: https://github.com/Pod-Point/laravel-monolog-kinesis/compare/v2.0.0...v3.0.0

    Source code(tar.gz)
    Source code(zip)
  • v3.0.0-rc(Jun 3, 2021)

Owner
Pod Point
Travel shouldn't damage the earth.
Pod Point
This package provides a Logs page that allows you to view your Laravel log files in a simple UI

A simplistics log viewer for your Filament apps. This package provides a Logs page that allows you to view your Laravel log files in a simple UI. Inst

Ryan Chandler 9 Sep 17, 2022
A Laravel Nova tool for viewing your application logs

This package makes it easy to view your Laravel application logs inside of Nova. It even supports polling. Installation You can install the Nova tool

The Laravel Framework 117 Dec 11, 2022
A non-blocking stream abstraction for PHP based on Amp.

amphp/byte-stream is a stream abstraction to make working with non-blocking I/O simple. Installation This package can be installed as a Composer depen

Amp 317 Dec 22, 2022
An event stream library based on tail

TailEventStream An event stream library based on tail. Note: I don't think you should use this library in a real project, but it's great for education

Matthias Noback 4 Feb 19, 2022
Laravel telegram log is a package that can catch your logs all quite simply

Laravel Telegram log Laravel telegram log is a package that can catch your logs all quite simply. Requirments This package is tested with Laravel v8 i

Muath Alsowadi 4 Aug 3, 2022
Filament-spatie-laravel-activitylog - View your activity logs inside of Filament. ⚡️

View your activity logs inside of Filament. This package provides a Filament resource that shows you all of the activity logs created using the spatie

Ryan Chandler 45 Dec 26, 2022
Laravel Rocket chat Debugher, push all logs to rocket chat channels

Laravel Rocket chat Debugher, push all logs to rocket chat channels

Novaday 4 Jun 13, 2022
Mailing platform with templates and logs included.

MailCarrier User-friendly, API-ready mail platform with templates and logs. Design global layouts, compose your template, preview your emails and send

MailCarrier 18 Dec 14, 2022
Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

null 686 Dec 28, 2022
A Laravel chat package. You can use this package to create a chat/messaging Laravel application.

Chat Create a Chat application for your multiple Models Table of Contents Click to expand Introduction Installation Usage Adding the ability to partic

Tinashe Musonza 931 Dec 24, 2022