Git Product home page Git Product logo

gelf-server's Introduction

GELF server GitHub Actions

A php implementation of a gelf compatible backend like Graylog2. This library provides a simple server to which a GELF client can connect.

Installation

Recommended installation via composer:

Add gelf-server to composer.json either by running composer require keboola/gelf-server or by defining it manually:

"require": {
   // ...
   "keboola/gelf-server": "^1.1"
   // ...
}

Reinstall dependencies: composer install

Usage

To create a server, use the ServerFactory class:

$server = ServerFactory::createServer(ServerFactory::SERVER_TCP);

To start listening for connections, us the start method. This method has the following parameters:

  • $minPort and $maxPort - to set port on which the server listens. To listen on a single port use the same value for both $minPort and $maxPort. Otherwise the server will randomly choose a free port in the specified range (inclusive).
  • $onStart - Callback executed when the server successfully started listening, the callback signature is function ($port), which gives you the actual port the server is listening on.
  • $onProcess - Callback executed periodically when the server is running. The callback has signature function (&$terminated). The server will keep running indefinitely until you set $terminated to true in this callback.
  • $onEvent - Callback executed when a GELF event is received. The callback has signature function ($event). The $event variable contains associative array with GELF fields
  • $onTerminate - Optional callback executed when the server terminates - after it stops listening for connections. The callback signature is function ().

Examples

For usage examples, see the /examples directory.

License

MIT licensed, see LICENSE file.

gelf-server's People

Contributors

odinuv avatar pepamartinec avatar ujovlado avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.