Secara default Laravel menyimpan log error didalam file storage/logs/laravel.log, nah log ini kita bisa kirim ke Elasticsearch ataupun log agregator lainnya dengan bantuan logstash. Dengan mengirim data lewat aplikasi yang berbeda, kita mengurangi beban Laravel (PHP) untuk memproses log, sehingga kinerja aplikasi bisa lebih optimal.

Logstash adalah aplikasi yang digunakan untuk memproses, filter dan mengirim log. Dalam pengertian sederhana, kita bisa menggunakan Logstash untuk memformat log sesuai dengan kebutuhan. Ada banyak cara untuk memformat dan filter data di logstash, kali ini kita akan menggunakan grok, grok adalah plugin yang dikhususkan untuk memproses log yang tidak beraturan dengan merubahnya sesuai dengan aturan yang kita buat.

Cara ini bisa digunakan untuk aplikasi Laravel yang menggunakan banyak server, tinggal di install Logstash di masing-masing server dengan config yang sama.

Contoh log Laravel

Berikut ini adalah contoh log Laravel yang akan kita gunakan. Sebaiknya gunakan log dari server production, agar lebih memudahkan melihat hasilnya dan validasi apakah sudah sesuai dengan keinginan

[2021-09-20 15:06:32] local.ERROR: Method App\Http\Controllers\HelloData::() does not exist {"exception":"[object] (ReflectionException(code: 0): Method App\\Http\\Controllers\\BankController::() does not exist at /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php:48)
[stacktrace]
#0 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(48): ReflectionMethod->__construct()
#1 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(26): Illuminate\\Routing\\RouteSignatureParameters::fromClassMethodString()
#2 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(506): Illuminate\\Routing\\RouteSignatureParameters::fromAction()
#3 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php(25): Illuminate\\Routing\\Route->signatureParameters()
#4 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(832): Illuminate\\Routing\\ImplicitRouteBinding::resolveForRoute()
#5 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Router->substituteImplicitBindings()
#6 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#7 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#8 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#9 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#10 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#11 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#12 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#13 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Session\\Middleware\\StartSession->handle()
#14 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#16 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#17 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#18 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(697): Illuminate\\Pipeline\\Pipeline->then()
#20 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(672): Illuminate\\Routing\\Router->runRouteWithinStack()
#21 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\\Routing\\Router->runRoute()
#22 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\\Routing\\Router->dispatchToRoute()
#23 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\\Routing\\Router->dispatch()
#24 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#25 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#27 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#28 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#30 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#31 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#33 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#35 /var/www/project.jaranguda.com/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle()
#37 /var/www/project.jaranguda.com/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#38 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle()
#39 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\\Pipeline\\Pipeline->then()
#41 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#42 /var/www/project.jaranguda.com/vendor/laravel/octane/src/ApplicationGateway.php(36): Illuminate\\Foundation\\Http\\Kernel->handle()
#43 /var/www/project.jaranguda.com/vendor/laravel/octane/src/Worker.php(92): Laravel\\Octane\\ApplicationGateway->handle()
#44 /var/www/project.jaranguda.com/vendor/laravel/octane/bin/swoole-server(117): Laravel\\Octane\\Worker->handle()
#45 [internal function]: {closure}()
#46 /var/www/project.jaranguda.com/vendor/laravel/octane/bin/swoole-server(163): Swoole\\Server->start()
#47 {main}
"} 
[2021-11-23 03:05:51] production.ERROR: Class "Laravel\Octane\Octane" not found {"exception":"[object] (Error(code: 0): Class \"Laravel\\Octane\\Octane\" not found at /var/www/project.jaranguda.com/config/octane.php:71)
[stacktrace]
#0 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require()
#1 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles()
#2 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap()
#3 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith()
#4 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#5 /var/www/project.jaranguda.com/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#6 {main}
"}
[2022-02-18 04:27:08] local.ERROR: Connection refused {"exception":"[object] (RedisException(code: 0): Connection refused at /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:153)
[stacktrace]
#0 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(153): Redis->connect()
#1 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(84): Illuminate\\Redis\\Connectors\\PhpRedisConnector->establishConnection()
#2 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\\Redis\\Connectors\\PhpRedisConnector->Illuminate\\Redis\\Connectors\\{closure}()
#3 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(121): tap()
#4 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(28): Illuminate\\Redis\\Connectors\\PhpRedisConnector->createClient()
#5 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(32): Illuminate\\Redis\\Connectors\\PhpRedisConnector->Illuminate\\Redis\\Connectors\\{closure}()
#6 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(112): Illuminate\\Redis\\Connectors\\PhpRedisConnector->connect()
#7 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(91): Illuminate\\Redis\\RedisManager->resolve()
#8 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(258): Illuminate\\Redis\\RedisManager->connection()
#9 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(62): Illuminate\\Cache\\RedisStore->connection()
#10 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(97): Illuminate\\Cache\\RedisStore->get()
#11 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php(67): Illuminate\\Cache\\Repository->get()
#12 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Store.php(97): Illuminate\\Session\\CacheBasedSessionHandler->read()
#13 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Store.php(87): Illuminate\\Session\\Store->readFromHandler()
#14 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Store.php(71): Illuminate\\Session\\Store->loadSession()
#15 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(147): Illuminate\\Session\\Store->start()
#16 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\\Session\\Middleware\\StartSession->Illuminate\\Session\\Middleware\\{closure}()
#17 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(148): tap()
#18 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(116): Illuminate\\Session\\Middleware\\StartSession->startSession()
#19 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#20 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Session\\Middleware\\StartSession->handle()
#21 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#23 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#25 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): Illuminate\\Pipeline\\Pipeline->then()
#27 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\\Routing\\Router->runRouteWithinStack()
#28 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\\Routing\\Router->runRoute()
#29 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): Illuminate\\Routing\\Router->dispatchToRoute()
#30 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\\Routing\\Router->dispatch()
#31 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#32 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#34 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#35 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#37 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#38 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#40 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#41 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#42 /var/www/project.jaranguda.com/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#43 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle()
#44 /var/www/project.jaranguda.com/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#45 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle()
#46 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#47 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then()
#48 /var/www/project.jaranguda.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#49 /var/www/project.jaranguda.com/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle()
#50 /var/www/project.jaranguda.com/server.php(21): require_once('/home/tommy/git...')
#51 {main}
"}

Cara berikut ini bisa dijalankan di server Linux langsung.

1. Download Logstash

Download logstash versi terbaru

mkdir ~/src
cd ~/src
wget https://artifacts.elastic.co/downloads/logstash/logstash-8.0.0-linux-x86_64.tar.gz
tar zxvf logstash-8.0.0-linux-x86_64.tar.gz

struktur file logstash

.
├── bin
├── config
├── CONTRIBUTORS
├── data
├── Gemfile
├── Gemfile.lock
├── jdk
├── lib
├── LICENSE.txt
├── logs
├── logstash-core
├── logstash-core-plugin-api
├── modules
├── NOTICE.TXT
├── tools
├── vendor
└── x-pack
 
12 directories, 5 files

2. Config Logstash

Di dalam folder config, buat file dengan nama laravel.conf, yang berisi

input {
    file {
        path => "/var/www/project.jaranguda.com/storage/logs/laravel.log"
        start_position => "beginning"
        codec => multiline { pattern => "\[[\d]{4}" negate => "true" what => "previous" }
    }
}
 
filter {
    grok {
        match => { "message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] %{DATA:env}\.%{DATA:severity}: %{DATA:message}" }
    }
}
 
output {
    stdout { codec => rubydebug }
    elasticsearch {
        hosts => "server.elasticsarch.jaranguda.com"
        data_stream => "true"
    }
}

Keterangan :
path : lokasi log laravel
codec : untuk mendapatkan error beserta stacktrace-nya

agar logstash mengenali config laravel.conf diatas, tambahkan baris berikut di pipelines.yml

- pipeline.id: laravel
  path.config: "~/src/logstash-8.0.0/config/laravel.conf"

terakhir jalankan logstash dari terminal

~/src/logstash-8.0.0/bin/logstash

tunggu beberapa saat sampai muncul output, itu adalah format yang akan dikirim ke elasticsearch, bisa juga dicek di elasticsearch/kibana anda
logstash output parsing

Catatan

Ada cara yang lebih baik digunakan untuk memproses log dari Laravel ini, dengan catatan dari Laravel sendiri sudah menyimpan lognya dengan format json.

Leave a comment

Your email address will not be published. Required fields are marked *