2017 © Pedro Peláez
 

library laravel-sls

Aliyun SLS Log For Laravel

image

lokielse/laravel-sls

Aliyun SLS Log For Laravel

  • Friday, July 22, 2016
  • by waisir
  • Repository
  • 2 Watchers
  • 6 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 75 % Grown

The README.md

Aliyun SLS Log For Laravel

Latest Version on Packagist ![Software License][ico-license] ![Total Downloads][ico-downloads], (*1)

Install

Via Composer, (*2)

``` bash $ composer require lokielse/laravel-sls, (*3)


## Config Add following service providers into your providers array in `config/app.php` ```php Lokielse\LaravelSLS\LaravelSLSServiceProvider::class

Publish sls.php to config folder, (*4)

php artisan vendor:publish --provider="Lokielse\LaravelSLS\LaravelSLSServiceProvider" 

Replace Log alias in your config/app.php (Optional), (*5)

//'Log'               => Illuminate\Support\Facades\Log::class,
'Log'                 => Lokielse\LaravelSLS\Facades\WriterFacade::class,
'SLSLog'              => Lokielse\LaravelSLS\Facades\LogFacade::class,

Edit your .env file, (*6)

ALIYUN_ACCESS_KEY_ID=...
ALIYUN_ACCESS_KEY_SECRET=...
# https://help.aliyun.com/document_detail/29008.html
# 如杭州公网 cn-hangzhou.log.aliyuncs.com
# 如杭州内网 cn-hangzhou-intranet.log.aliyuncs.com
SLS_ENDPOINT=cn-hangzhou.log.aliyuncs.com
SLS_PROJECT=test-project
SLS_STORE=test-store

You should update SLS_ENDPOINT to internal endpoint in production mode, (*7)

Usage

First create a project and store at Aliyun SLS Console, (*8)

Then update SLS_ENDPOINT, SLS_PROJECT, SLS_STORE in .env, (*9)

Push a test message to queue, (*10)

Log::info('Test Message', ['foobar'=>'2003']);

//or you can use `app('sls')` 

app('sls')->putLogs([
    'type' => 'test',
    'message' => json_encode(['This should use json_encode'])
]);

//or you can use `SLSLog` directly 

SLSLog::putLogs([
    'type' => 'test',
    'message' => json_encode(['This should use json_encode'])
]);

Security

Create RAM access control at Aliyun RAM Console, (*11)

  1. Create a custom policy such as AliyunSLSFullAccessFoobar, (*12)

    {
      "Version": "1",
      "Statement": [
        {
          "Action": "log:*",
          "Resource": [
            "acs:log:*:*:project/test-project/logstore/test-store",
          ],
          "Effect": "Allow"
        }
      ]
    }
    
  2. Create a user for you app such as foobar, (*13)

  3. Assign the policy AliyunSLSFullAccessFoobar to the user foobar, (*14)

  4. Create and get the AccessKeyId and AccessKeySecret for user foorbar, (*15)

  5. update QUEUE_SLS_ACCESS_KEY and QUEUE_SLS_ACCESS_SECRET in .env, (*16)

Change log

Please see CHANGELOG for more information what has changed recently., (*17)

Testing

bash $ composer test, (*18)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*19)

Credits

License

The MIT License (MIT). Please see License File for more information., (*20)

The Versions

22/07 2016

dev-master

9999999-dev https://github.com/lokielse/laravel-sls

Aliyun SLS Log For Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel log cloud driver aliyun 阿里云 sls lokielse 日志 laravel-sls

22/07 2016

v1.0.0

1.0.0.0 https://github.com/lokielse/laravel-sls

Aliyun SLS Log For Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel log cloud driver aliyun 阿里云 sls lokielse 日志 laravel-sls