TryGhost / Ignition

Basic configuration and tooling shared across applications
MIT License
16 stars 21 forks source link

More options for log file path & name #40

Open ErisDS opened 7 years ago

ErisDS commented 7 years ago

TLDR; ideally I want to supply my domain / app identifier for each log file via the path, and not via domain. I would like to make it possible to not output a domain so that it is possible to use the following as the log filename:

/var/log/my-app/production.log /var/log/my-app/production.error.log


Currently, if you set transports to include "file", we generate 2 log files, and they live at

Where:

When logging to /var/log/, which is, I believe, common practice, it is best to define a custom directory for each daemon.

From the perspective of running Ghost, ideally I would want to log to /var/log/ghost/.

On my own server, if I set the path to this, I now get this as the log path:

/var/log/ghost/localhost_production.log

Or I can configure the domain to something like "domain": "blog.mysite.com":

/var/log/ghost/blog_my_site_com_production.log

This makes sense if I'm running multiple blogs on one server, but if I'm not, that's a very long path. Even if I am running multiple blogs, I could configure the path to be different without needing to distinguish filenames too.

From the perspective of using Ignition in other apps - assume lots of small apps on one server, each app would likely need it's own folder (recommendation is one folder per daemon). In this case, they all have different daemon names and domain names... specifying path and no domain results in /var/log/my-app/localhost_production.log specifying both path and domain results in /var/log/my-app/my_app_domain_com_production.log.

I am finding this less than ideal, because I normally view logs from the root and would like the path to be easier to remember & consistent for multiple apps e.g. tail -100f /var/log/my-app/production_error.log, tail -100f /var/log/my-other-app/production_error.log


I'm not sure what the easiest thing to do here would be - maybe introduce a naming pattern/template string thing so that it's possible to override the pattern anyway you like?

hxuanhung commented 7 years ago

maybe introduce a naming pattern/template string thing so that it's possible to override the pattern anyway you like?

i.m.o this is a good approach