{"id":16065137,"url":"https://github.com/hedii/laravel-gelf-logger","last_synced_at":"2025-05-15T08:11:39.482Z","repository":{"id":38714674,"uuid":"67819579","full_name":"hedii/laravel-gelf-logger","owner":"hedii","description":"A package to send gelf logs to a gelf compatible backend like graylog","archived":false,"fork":false,"pushed_at":"2025-03-22T16:28:15.000Z","size":80,"stargazers_count":130,"open_issues_count":1,"forks_count":33,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T06:36:39.363Z","etag":null,"topics":["gelf","gelf-php","graylog","laravel","log","log-analysis","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hedii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-09T17:39:53.000Z","updated_at":"2025-04-05T07:23:57.000Z","dependencies_parsed_at":"2025-04-10T06:28:26.324Z","dependency_job_id":"28a1cdcd-2011-434e-8124-36da0a1e3f79","html_url":"https://github.com/hedii/laravel-gelf-logger","commit_stats":{"total_commits":95,"total_committers":14,"mean_commits":6.785714285714286,"dds":"0.42105263157894735","last_synced_commit":"47d82c3ccad52d48afa5e4aef92746b8fce4a647"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedii%2Flaravel-gelf-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedii%2Flaravel-gelf-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedii%2Flaravel-gelf-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hedii%2Flaravel-gelf-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hedii","download_url":"https://codeload.github.com/hedii/laravel-gelf-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301613,"owners_count":22047905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gelf","gelf-php","graylog","laravel","log","log-analysis","php"],"created_at":"2024-10-09T05:11:23.057Z","updated_at":"2025-05-15T08:11:39.447Z","avatar_url":"https://github.com/hedii.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Gelf Logger\n\n[![Build Status](https://github.com/hedii/laravel-gelf-logger/workflows/Tests/badge.svg)](https://github.com/hedii/laravel-gelf-logger/actions)\n[![Total Downloads](https://poser.pugx.org/hedii/laravel-gelf-logger/downloads)](//packagist.org/packages/hedii/laravel-gelf-logger)\n[![License](https://poser.pugx.org/hedii/laravel-gelf-logger/license)](//packagist.org/packages/hedii/laravel-gelf-logger)\n[![Latest Stable Version](https://poser.pugx.org/hedii/laravel-gelf-logger/v)](//packagist.org/packages/hedii/laravel-gelf-logger)\n\n| **Laravel** | **laravel-gelf-logger** |\n|-------------|-------------------------|\n| 5.6         | ^3.0                    |\n| 5.8         | ^3.1                    |\n| 6.0         | ^4.0                    |\n| 7.0         | ^5.0                    |\n| 8.0         | ^5.3                    |\n| 8.0         | ^6.0 (with php 8)       |\n| 9.0         | ^7.0                    |\n| 10.0        | ^8.0                    |\n| 11.0        | ^9.0                    |\n| 12.0        | ^10.0                   |\n\nA package to send [gelf](http://docs.graylog.org/en/2.1/pages/gelf.html) logs to a gelf compatible backend like graylog. It is a Laravel wrapper for [bzikarsky/gelf-php](https://github.com/bzikarsky/gelf-php) package.\n\nIt uses the new [Laravel custom log channel](https://laravel.com/docs/master/logging) introduced in Laravel 5.6.\n\nA gelf receiver like graylog2 must be configured to receive messages with a GELF UDP, TCP or HTTP Input.\n\n## Table of contents\n\n- [Table of contents](#table-of-contents)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Example](#example)\n- [Testing](#testing)\n- [License](#license)\n\n## Installation\n\nInstall via [composer](https://getcomposer.org/doc/00-intro.md)\n\n```sh\ncomposer require hedii/laravel-gelf-logger\n```\n\nEdit `config/logging.php` to add the new `gelf` log channel.\n\n```php\nreturn [\n    'default' =\u003e env('LOG_CHANNEL', 'stack'),\n\n    'channels' =\u003e [\n        // You can use the gelf log channel with the stack log channel\n        'stack' =\u003e [\n            'driver' =\u003e 'stack',\n            'channels' =\u003e ['daily', 'gelf'],\n        ],\n\n        // other log channels...\n\n        'gelf' =\u003e [\n            'driver' =\u003e 'custom',\n\n            'via' =\u003e \\Hedii\\LaravelGelfLogger\\GelfLoggerFactory::class,\n\n            // This optional option determines the processors that should be\n            // pushed to the handler. This option is useful to modify a field\n            // in the log context (see NullStringProcessor), or to add extra\n            // data. Each processor must be a callable or an object with an\n            // __invoke method: see monolog documentation about processors.\n            // Default is an empty array.\n            'processors' =\u003e [\n                \\Hedii\\LaravelGelfLogger\\Processors\\NullStringProcessor::class,\n                \\Hedii\\LaravelGelfLogger\\Processors\\RenameIdFieldProcessor::class,\n                // another processor...\n            ],\n\n            // This optional option determines the minimum \"level\" a message\n            // must be in order to be logged by the channel. Default is 'debug'\n            'level' =\u003e 'debug',\n\n            // This optional option determines the channel name sent with the\n            // message in the 'facility' field. Default is equal to app.env\n            // configuration value\n            'name' =\u003e 'my-custom-name',\n\n            // This optional option determines the system name sent with the\n            // message in the 'source' field. When forgotten or set to null,\n            // the current hostname is used.\n            'system_name' =\u003e null,\n\n            // This optional option determines if you want the UDP, TCP or HTTP\n            // transport for the gelf log messages. Default is UDP\n            'transport' =\u003e 'udp',\n\n            // This optional option determines the host that will receive the\n            // gelf log messages. Default is 127.0.0.1\n            'host' =\u003e '127.0.0.1',\n\n            // This optional option determines the port on which the gelf\n            // receiver host is listening. Default is 12201\n            'port' =\u003e 12201,\n            \n            // This optional option determines the chunk size used when\n            // transferring message via UDP transport. Default is 1420.\n            'chunk_size' =\u003e 1420,\n\n            // This optional option determines the path used for the HTTP\n            // transport. When forgotten or set to null, default path '/gelf'\n            // is used.\n            'path' =\u003e null,\n            \n            // This optional option enable or disable ssl on TCP or HTTP\n            // transports. Default is false.\n            'ssl' =\u003e false,\n            \n            // If ssl is enabled, the following configuration is used.\n            'ssl_options' =\u003e [\n                // Enable or disable the peer certificate check. Default is\n                // true.\n                'verify_peer' =\u003e true,\n                \n                // Path to a custom CA file (eg: \"/path/to/ca.pem\"). Default\n                // is null.\n                'ca_file' =\u003e null,\n                \n                // List of ciphers the SSL layer may use, formatted as\n                // specified in ciphers(1). Default is null.\n                'ciphers' =\u003e null,\n                \n                // Whether self-signed certificates are allowed. Default is\n                // false.\n                'allow_self_signed' =\u003e false,\n            ],\n            \n            // If you want to send messages to the gelf server using http basic\n            // authentication, the following configuration is used. Only useful\n            // if transport is set to http.\n            'http_basic_auth' =\u003e [\n                // The http basic authentication username.\n                'username' =\u003e null,\n                \n                // The http basic authentication password.\n                'password' =\u003e null,\n            ],\n\n            // This optional option determines the maximum length per message\n            // field. When forgotten or set to null, the default value of \n            // \\Monolog\\Formatter\\GelfMessageFormatter::DEFAULT_MAX_LENGTH is\n            // used (currently this value is 32766)\n            'max_length' =\u003e null,\n\n            // This optional option determines the prefix for 'context' fields\n            // from the Monolog record. Default is null (no context prefix)\n            'context_prefix' =\u003e null,\n\n            // This optional option determines the prefix for 'extra' fields\n            // from the Monolog record. Default is null (no extra prefix)\n            'extra_prefix' =\u003e null,\n            \n            // This optional option determines whether errors thrown during\n            // logging should be ignored or not. Default is true.\n            'ignore_error' =\u003e true,\n\n        ],\n    ],\n];\n```\n\n## Usage\n\nOnce you have modified the Laravel logging configuration, you can use the gelf log channel [as any Laravel log channel](https://laravel.com/docs/master/logging#writing-log-messages).\n\n### Example\n\n```php\n// Explicitly use the gelf channel\nLog::channel('gelf')-\u003edebug($message, ['foo' =\u003e 'bar']);\nLog::channel('gelf')-\u003eemergency($message, ['foo' =\u003e 'bar']);\n\n// In case of a stack log channel containing the gelf log channel and stack\n// configured as the default log channel\nLog::notice($message, ['foo' =\u003e 'bar']);\n\n// Using the logger helper\nlogger($message, $context);\n```\n\n## Testing\n\n```\ncomposer test\n```\n\n## License\n\nlaravel-gelf-logger is released under the MIT Licence. See the bundled [LICENSE](https://github.com/hedii/laravel-gelf-logger/blob/master/LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedii%2Flaravel-gelf-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhedii%2Flaravel-gelf-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhedii%2Flaravel-gelf-logger/lists"}