1

Tools & env: php 8.0, laravel 9, docker alpine 3.15, gelf logger package

I'm trying to set up graylog for my laravel project. Everything looks ok, but every time it does write logs, it actually writes 2 logs -> the log itself and this error message:

local.ERROR: Message is invalid: short-message not set {"exception":"[object] (RuntimeException(code: 0): Message is invalid: short-message not set at /var/www/vendor/graylog2/gelf-php/src/Gelf/Publisher.php:72)

Print screen from graylog

I could not find out what causes the error. I assume that my configuration could be wrong.

config/logging.php

'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['gelf'],
        'ignore_exceptions' => false,
    ],

   .....

'gelf' => [
        'driver' => 'custom',
        'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,
        'processors' => [
            \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
            \Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor::class,
        ],
        'level' => 'debug',
        'name' => 'my-custom-name',
        'system_name' => null,
        'transport' => 'tcp',
        'host' => env('GRAYLOG_HOST_TCP', '127.0.0.1'),
        'port' => env('GRAYLOG_PORT', 12201),
        'path' => null,
        'ssl' => false,
        'ssl_options' => [
            'verify_peer' => true,
            'ca_file' => null,
            'ciphers' => null,
            'allow_self_signed' => false,
        ],
        'max_length' => null,
        'context_prefix' => null,
        'extra_prefix' => null,
        'ignore_error' => true,
    ],

.env

GRAYLOG_HOST_TCP=192.168.55.20
GRAYLOG_HOST=http://127.0.0.1
GRAYLOG_PORT=5555
GRAYLOG_API_PORT=9999
GRAYLOG_VOLUME=/volume
GRAYLOG_PASSWORD_SECRET=somepasswordpepper
# The value is admin.
GRAYLOG_ROOT_PASSWORD_SHA2=5345345345dfgdfgdfgf

docker-compose.yaml

  mongo:
    image: mongo:4.2
    volumes:
      - ${GRAYLOG_VOLUME}/mongodb:/data/db
    networks:
      - proxy
  # Elasticsearch required for graylog.
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
    volumes:
      - ${GRAYLOG_VOLUME}/elasticsearch:/usr/share/elasticsearch/data
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true -Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    deploy:
      resources:
        limits:
          memory: 1g
    networks:
      - proxy

  graylog:
    image: graylog/graylog:4.2
    environment:
      # CHANGE ME (must be at least 16 characters)!
      - GRAYLOG_PASSWORD_SECRET=${GRAYLOG_PASSWORD_SECRET}
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=${GRAYLOG_ROOT_PASSWORD_SHA2}
      - GRAYLOG_HTTP_EXTERNAL_URI=${GRAYLOG_HOST}:${GRAYLOG_API_PORT}/
    entrypoint: /usr/bin/tini -- wait-for-it elasticsearch:9200 --  /docker-entrypoint.sh
    networks:
      proxy:
        ipv4_address: 192.168.55.20
    restart: always
    depends_on:
      - mongo
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - "${GRAYLOG_API_PORT}:9000"
      # Syslog TCP
      - "1514:1514"
      # Syslog UDP
      - "1514:1514/udp"
      # GELF TCP
      - "12201:12201"
      # GELF UDP
      - "12201:12201/udp"
      # Graylog
      - "${GRAYLOG_PORT}:5555"
      - "${GRAYLOG_PORT}:5555/udp"

Any help will be appreciated.

devnull Ψ
  • 3,779
  • 7
  • 26
  • 43

0 Answers0