PHP code example of maltertech / betterstack-telemetry
1. Go to this page and download the library: Download maltertech/betterstack-telemetry 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/ */
maltertech / betterstack-telemetry example snippets
use MalterTech\BetterStack\CloudWatchForwarder;
$logger = new CloudWatchForwarder(
sourceToken: 'BETTERSTACK_TOKEN', // Your Source Token from BetterStack
ingestionUrl: 'https://in.logs.betterstack.com', // The Ingestion URL
sourceName: 'Client-API-01' // Identifier for this logs source
);
// Inside your Lambda Handler or Controller
public function handle(array $event)
{
// ... your application logic ...
// Forward logs to BetterStack
$logger->push($event);
}