2017 © Pedro Peláez
 

library graylog-sdk

A PHP sdk to communicate with the Graylog REST API

image

nexylan/graylog-sdk

A PHP sdk to communicate with the Graylog REST API

  • Friday, July 27, 2018
  • by Soullivaneuh
  • Repository
  • 3 Watchers
  • 2 Stars
  • 5,863 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

Graylog SDK

Graylog API PHP SDK., (*1)

Latest Stable Version Latest Unstable Version License, (*2)

Total Downloads Monthly Downloads Daily Downloads, (*3)

Documentation

All the installation and usage instructions are located in this README. Check it for a specific versions:, (*4)

Prerequisites

This version of the project requires:, (*5)

  • PHP 7.0+

Installation

First of all, you need to require this library through Composer:, (*6)

``` bash composer require nexylan/graylog-sdk, (*7)


## Usage ```php $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);

Symfony integration

Activate the bundle:, (*8)

// config/bundles.php

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

Add the configuration file:, (*9)

// config/packages/nexy_graylog.yaml

nexy_graylog:
    options:
        base_uri:             ~ # Required
    auth:

        # Can be a username or a token.
        user:                 ~ # Required

        # Required only for username auth.
        password:             null

Then, inject the Graylog service thanks to autowiring:, (*10)

class MyService
{
    private $graylog;

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

The Versions

27/07 2018