Graylog2 / docker-compose

A set of Docker Compose files that allow you to quickly spin up a Graylog instance for testing or demo purposes.
Apache License 2.0
357 stars 134 forks source link

Email configuration doesn't apply #47

Closed andrepaulotek closed 5 months ago

andrepaulotek commented 7 months ago

Hello! I'm using the docker composer from open-core.

Initially I configured it without email support, but now I need to add those configurations.

When I try to send a test email I get the error: Notification has email recipients and is triggered, but email transport is not configured. Email transport is not enabled in server configuration file!

I've tried adding the following to the .env file:

GRAYLOG_TRANSPORT_EMAIL_PROTOCOL="smtp"
GRAYLOG_TRANSPORT_EMAIL_WEB_INTERFACE_URL="https://192.168.1.1/"
GRAYLOG_TRANSPORT_EMAIL_HOSTNAME="smtp.example.com"
GRAYLOG_TRANSPORT_EMAIL_ENABLED="true"
GRAYLOG_TRANSPORT_EMAIL_PORT="587"
GRAYLOG_TRANSPORT_EMAIL_USE_AUTH="true"
GRAYLOG_TRANSPORT_EMAIL_AUTH_USERNAME="notification@example.com"
GRAYLOG_TRANSPORT_EMAIL_AUTH_PASSWORD="password"
GRAYLOG_TRANSPORT_EMAIL_USE_TLS="true"
GRAYLOG_TRANSPORT_EMAIL_USE_SSL="false"
GRAYLOG_TRANSPORT_FROM_EMAIL="notification@example.com"
GRAYLOG_TRANSPORT_SUBJECT_PREFIX="[Graylog-1]"

I also tried adding these to the docker-compose.yml to the graylog service without success.

Here's my docker-compose file:

version: "3.8"

services:
  mongodb:
    image: "mongo:5.0"
    volumes:
      - "mongodb_data:/data/db"
    restart: "always"

  datanode:
    image: "${DATANODE_IMAGE:-graylog/graylog-datanode:5.2}"
    hostname: "247a89a3e074"
    environment:
      GRAYLOG_HOSTNAME: "247a89a3e074"
      GRAYLOG_DATANODE_NODE_ID_FILE: "/var/lib/graylog-datanode/node-id"
      GRAYLOG_DATANODE_PASSWORD_SECRET: "${GRAYLOG_PASSWORD_SECRET:?Please configure GRAYLOG_PASSWORD_SECRET in the .env file}"
      GRAYLOG_DATANODE_ROOT_PASSWORD_SHA2: "${GRAYLOG_ROOT_PASSWORD_SHA2:?Please configure GRAYLOG_ROOT_PASSWORD_SHA2 in the .env file}"
      GRAYLOG_DATANODE_MONGODB_URI: "mongodb://mongodb:27017/graylog"
    ulimits:
      memlock:
        hard: -1
        soft: -1
      nofile:
        soft: 65536
        hard: 65536
    ports:
      - "127.0.0.1:8999:8999/tcp"   # DataNode API
      - "127.0.0.1:9200:9200/tcp"
      - "127.0.0.1:9300:9300/tcp"
    volumes:
      - "graylog-datanode:/var/lib/graylog-datanode"
    restart: "always"

  graylog:
    hostname: "server"
    image: "${GRAYLOG_IMAGE:-graylog/graylog:5.2}"
    depends_on:
      mongodb:
        condition: "service_started"
    entrypoint: "/usr/bin/tini --  /docker-entrypoint.sh"
    environment:
      GRAYLOG_NODE_ID_FILE: "/usr/share/graylog/data/data/node-id"
      GRAYLOG_PASSWORD_SECRET: "${GRAYLOG_PASSWORD_SECRET:?Please configure GRAYLOG_PASSWORD_SECRET in the .env file}"
      GRAYLOG_ROOT_PASSWORD_SHA2: "${GRAYLOG_ROOT_PASSWORD_SHA2:?Please configure GRAYLOG_ROOT_PASSWORD_SHA2 in the .env file}"
      GRAYLOG_HTTP_BIND_ADDRESS: "0.0.0.0:9000"
      GRAYLOG_HTTP_EXTERNAL_URI: "http://localhost:9000/"
      GRAYLOG_MONGODB_URI: "mongodb://mongodb:27017/graylog"
    ports:
    - "127.0.0.1:5044:5044/tcp"   # Beats
    - "5140:5140/udp"   # Syslog
    - "5140:5140/tcp"   # Syslog
    - "127.0.0.1:5555:5555/tcp"   # RAW TCP
    - "127.0.0.1:5555:5555/udp"   # RAW TCP
    - "127.0.0.1:9000:9000/tcp"   # Server API
    - "127.0.0.1:12201:12201/tcp" # GELF TCP
    - "127.0.0.1:12201:12201/udp" # GELF UDP
    #- "127.0.0.1:10000:10000/tcp" # Custom TCP port
    #- "127.0.0.1:10000:10000/udp" # Custom UDP port
    - "127.0.0.1:13301:13301/tcp" # Forwarder data
    - "127.0.0.1:13302:13302/tcp" # Forwarder config
    - "5141-5199:5141-5199/tcp" # ports for inputs
    - "5141-5199:5141-5199/udp" # ports for inputs
    volumes:
      - "graylog_data:/usr/share/graylog/data/data"
      - "graylog_journal:/usr/share/graylog/data/journal"
    restart: "always"

volumes:
  mongodb_data:
  graylog-datanode:
  graylog_data:
  graylog_journal:
andrepaulotek commented 5 months ago

Just tested again after updating to 5.2.3 with this and it worked

graylog:
  hostname: "server"
  image: "${GRAYLOG_IMAGE:-graylog/graylog:5.2}"
  depends_on:
    mongodb:
      condition: "service_started"
  entrypoint: "/usr/bin/tini --  /docker-entrypoint.sh"
  environment:
    GRAYLOG_NODE_ID_FILE: "/usr/share/graylog/data/data/node-id"
    GRAYLOG_PASSWORD_SECRET: "${GRAYLOG_PASSWORD_SECRET:?Please configure GRAYLOG_PASSWORD_SECRET in the .env file}"
    GRAYLOG_ROOT_PASSWORD_SHA2: "${GRAYLOG_ROOT_PASSWORD_SHA2:?Please configure GRAYLOG_ROOT_PASSWORD_SHA2 in the .env file}"
    GRAYLOG_HTTP_BIND_ADDRESS: "0.0.0.0:9000"
    GRAYLOG_HTTP_EXTERNAL_URI: "http://localhost:9000/"
    GRAYLOG_MONGODB_URI: "mongodb://mongodb:27017/graylog"
    GRAYLOG_TRANSPORT_EMAIL_PROTOCOL: "smtp"
    GRAYLOG_TRANSPORT_EMAIL_WEB_INTERFACE_URL: "https://192.168.1.1/"
    GRAYLOG_TRANSPORT_EMAIL_HOSTNAME: "smtp.example.com"
    GRAYLOG_TRANSPORT_EMAIL_ENABLED: "true"
    GRAYLOG_TRANSPORT_EMAIL_PORT: "587"
    GRAYLOG_TRANSPORT_EMAIL_USE_AUTH: "true"
    GRAYLOG_TRANSPORT_EMAIL_AUTH_USERNAME: "username"
    GRAYLOG_TRANSPORT_EMAIL_AUTH_PASSWORD: "password"
    GRAYLOG_TRANSPORT_EMAIL_USE_TLS: "true"
    GRAYLOG_TRANSPORT_EMAIL_FROM_EMAIL: "email@example.com"