michal-kazmierczak / opentelemetry-rails-example

78 stars 3 forks source link

Why to push the Rails logs to the STDOUT? #2

Closed fguillen closed 5 months ago

fguillen commented 5 months ago

promtail is perfectly capable of scraping the logs from my-app/logs/ and is simpler and more intuitive:

  promtail:
    image: grafana/promtail:3.0.0
    volumes:
      - ./docker/promtail/config.yml:/etc/promtail/config.yml
      - ./log/:/var/log/rails/:ro
    command: -config.file=/etc/promtail/config.yml

I am asking because your repo inspires me, and it helped me a lot. I want to know I am not missing anything.

Thanks for your work

michal-kazmierczak commented 5 months ago

Thank you for your feedback @fguillen 🙇

I'm coming from dockerized environments where (I believe) logging to the STDOUT is the standard convention. It lets the environment (and people handling it) take care of the logs retention/rotation/storage etc.

This approach also aligns my application's logging with other services like PostgreSQL and Redis. While promtail could efficiently scrape both files and STDOUT, I find the unified approach to be more frictionless.

I'm sure there's no single optimal solution.