PHP code example of linkprofit-cpa / kibana-formatter

1. Go to this page and download the library: Download linkprofit-cpa/kibana-formatter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

linkprofit-cpa / kibana-formatter example snippets


    $connect = new GelfHandler(
       new Publisher(
           new UdpTransport(
               getenv('KIBANA_HOST'),
               getenv('KIBANA_PORT')
           ),
           new KibanaMessageValidator
       )
    );

    $connect->pushProcessor(new PsrLogMessageProcessor);
    $connect->setFormatter(
        new KibanaMessageFormatter(
            new KibanaMessage(
                getenv('APPLICATION_CODE'),
                getenv('APPLICATION_VERSION')
            )
        )
    );

    $logger = new Logger('app', [$connect]);