ElasticsearchLogstashHandler example



            $this->assertSame('POST', $method);
            $this->assertSame('http://es:9200/_bulk', $url);
            $this->assertSame($body$options['body']);
            $this->assertSame('Content-Type: application/json', $options['normalized_headers']['content-type'][0]);
            ++$callCount;

            return new MockResponse();
        };

        $handler = new ElasticsearchLogstashHandler('http://es:9200', 'log', new MockHttpClient($responseFactory));
        $handler->setFormatter($this->getDefaultFormatter());

        $record = RecordFactory::create(Logger::INFO, 'My info message', 'app', datetime: new \DateTimeImmutable('2020-01-01T00:00:00+01:00'));

        $handler->handle($record);

        $this->assertSame(1, $callCount);
    }

    public function testHandleWithElasticsearch8()
    {
        
Home | Imprint | This part of the site doesn't use cookies.