shizunge / endlessh-go

A golang implementation of endlessh exporting Prometheus metrics, visualized by a Grafana dashboard.
GNU General Public License v3.0
935 stars 28 forks source link

Unable to log to a file #113

Closed antsalm closed 1 week ago

antsalm commented 1 month ago

I'm unable to enable logging to a file so my Crowdsec instance could parse those logs and issue bans. Workaround is to use syslog logging driver of the Docker and make Crowdsec parse syslog, but IMO its not optimal even though it works.

This is my docker compose, basically its the maxmind example from here. I've tried multiple other variations of commands, that I could think of, but no log file appears on host system at /portainer/Files/AppData/Config/endlessh-go/logs/ -folder.

version: '3.5'
services:
  endlessh:
    container_name: endlessh
    image: shizunge/endlessh-go:latest
    restart: unless-stopped
    user: root
    command:
      - "-log_dir=/log/"
      - "-interval_ms=1000"
      - "-v=1"
      - "-enable_prometheus"
      - "-geoip_supplier=max-mind-db"
      - "-max_mind_db=/geo-data/GeoLite2-City.mmdb"
      - "-alsologtostderr"
    networks:
      - default
    hostname: endlessh
    ports:
      - 2222:2222 # SSH port
      - 2112:2112 # Prometheus metrics port
    volumes:
      - /portainer/Files/AppData/Config/endlessh-go/logs/:/log:ro # logs
      - /portainer/Files/AppData/Config/maxmind/geo-data/:/geo-data/:ro # geoip data
    logging:
      driver: "syslog"

...continues with maxmind portion
antsalm commented 1 month ago

Had the :ro flag on the volume share. (That what you get from hastly copy & pasting 🫠 )