PHP code example of deltasystems / graylog-sdk

1. Go to this page and download the library: Download deltasystems/graylog-sdk 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/ */

    

deltasystems / graylog-sdk example snippets


$graylog = new \Nexy\Graylog\Graylog([
    'base_uri' => 'https://your.graylog.instance.com/api'
]);

// You may authenticate with API token:
$graylog->auth('YourApiToken');
// Or user credentials:
$graylog->auth('YourGraylogUsername', 'YourGrayLogPassword');

// Then, start using the API:
$result = $graylog->search()->relative()->terms('file', 'source: host.com', 0);

// config/bundles.php

return [
    Nexy\Graylog\Bridge\Symfony\Bundle\NexyGraylogBundle::class => ['all' => true],
];

class MyService
{
    private $graylog;

    public function __construct(Nexy\Graylog\Graylog $graylog)
    {
        $this->graylog = $graylog;
    }
}