hedii / laravel-gelf-logger

A package to send gelf logs to a gelf compatible backend like graylog
MIT License
125 stars 33 forks source link

Log messages over HTTP to graylog #17

Closed nessor closed 4 years ago

nessor commented 4 years ago

Hey @hedii ,

you wrote that you "only" wrote a wrapper for the package bzikarsky/gelf-php for Laravel. The readme of gelf-php says that it is also possible to send GELF over HTTP I'm trying to get this working with your package for quite some time now, but unfortunately without success so far. 'transport' => 'http' seems not to work either.

Is it possible that the wrapper does not offer this or that there is no mapping to bzikarsky/gelf-php? I haven't really looked into your code yet.

-Florian

nessor commented 4 years ago

maybe this is a simple solution?:

protected function getTransport(string $transport, string $host, int $port): AbstractTransport
{
    switch ($transport) {
        case 'tcp':
            return new TcpTransport($host, $port);
        case 'http':
            return new HttpTransport($host, $port);
        default:
            return new UdpTransport($host, $port);
    }
}
hedii commented 4 years ago

Hi,

Http transport is not supported right now.

Please fork the repo, try to implement it and write some tests to see if it works.

If everything is ok and all tests pass, open a pull request and I'll merge this into master.

maybe this is a simple solution?

A good starting point, yes. Maybe it will work as is.

HighCoData commented 4 years ago

@nessor did that work for you? because for me it didn't....

nessor commented 4 years ago

@HighCoData the simple exchange unfortunately not. I think that you have to do 1-2 small things more. But unfortunately I have so incredibly limited time at the moment (thanks Corona). Otherwise I would have already done an MR.

hedii commented 4 years ago

I don't have a graylog instance accepting http messages, so I cannot write the http implementation myself.

I would be happy to merge an http transport implementation if someone can write it and test it.

I think you have to add config values for username and password for it to work?