PHP code example of syntaxphoenix / monolog-opensearch-handler
1. Go to this page and download the library: Download syntaxphoenix/monolog-opensearch-handler 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/ */
syntaxphoenix / monolog-opensearch-handler example snippets
$logger = new \Monolog\Logger('application');
$logger->pushHandler(new \SyntaxPhoenix\MonologOpenSearchHandler\OpenSearchHandler(
'http://localhost:9200',
'username',
'password',
'index_name',
Level::Debug,
\OpenSearch\ClientBuilder::create()->setHosts([
'http://localhost:9200'
])->build()
));
$logger->info('Hello World');
yaml
SyntaxPhoenix\MonologOpenSearchHandler\OpenSearchHandler:
arguments:
$endpoint: 'opensearch:9200'
$index: "index"
$username: 'username'
$password: 'password'
$bubble: true