This video was really helpful to me personally. Please make more of these production stage app and deployment best practice tips. I've subscribed 👍.
@NickJanetakis Жыл бұрын
Thanks a lot for the feedback.
@tomontheinternet4 жыл бұрын
Nick, your videos are awesome. Thanks for making them.
@NickJanetakis4 жыл бұрын
Thanks a lot for watching.
@DanielKofiKyeremateng4 жыл бұрын
Great video, I already log to stdout in my Go web servers.
@NickJanetakis4 жыл бұрын
Thanks for watching!
@hassanfarid4 жыл бұрын
What about streaming logs to stdio and file together? I believe both strategies can have use cases, in a sense of centralized log collecting services in any application stack .
@NickJanetakis4 жыл бұрын
You can but in practice I find that if I'm in a situation where I want to check the logs for a specific service on a specific server, I'd much rather go through journalctl instead of a file on disk. This has other benefits too of only needing to worry about log rotation at the journald level, instead of having to configure rotation for each file. You can also backup / archive your journald logs too in 1 shot. IMO it's just more maintainable in the sense that you only need to worry about configuring your logging in 1 spot (journald) instead of for every service you run. You can also export them into a standardized format if you want to (such as json). I should probably start using bullet points in some of these videos. Those are all things I should have mentioned on video. :D
@hassanfarid4 жыл бұрын
The approach, certainly make sense and has all the benefits you mention. A few questions though, - we will have to rely on journalctl on host machine, which would be available on all Linux distros? What about windows as host server? - can you think of any other scenarios where it may not be possible? - any good tutorial on journalctl? I definitely need to learn this .
@NickJanetakis4 жыл бұрын
@@hassanfarid I personally only run Debian and Ubuntu distros so I don't really deal with Windows servers. Other Linux distros use systemd tho. For Windows, I think no matter what strategy you use, you'd have to think about how to run something on Linux vs Windows, it wouldn't be just about logging. There's installation, configuration, process management and many other things too. It's 2 totally different worlds. The Arch Wiki has a quick introduction and a few examples of using journalctl at wiki.archlinux.org/index.php/Systemd/Journal. Beyond that honestly running journalctl --help is a good resource.
@hassanfarid4 жыл бұрын
@@NickJanetakis - while I was watching the video, I had this thought. In case, where some of the framework anyone is using does not support logging to stdio directly via configurations, an alternate approach could be to use Dockerfile CMD as 'run server in background && tail log file' . Interested to learn from your thoughts on this alternate!
@NickJanetakis4 жыл бұрын
@@hassanfarid If you're using Docker I would stick to what it recommends in the documentation. It says you should log to stdout and then you can configure Docker to deal with the logs however you see fit. You can still run things like docker-compose logs -f to tail logs from containers running in the background. Likewise you could do the same thing with journalctl too (with or without Docker).