Why Your Web Server Should Log to Stdout (Especially with Docker)

  Рет қаралды 5,966

Nick Janetakis

Nick Janetakis

Күн бұрын

Пікірлер: 13
@tabliqatchi6696
@tabliqatchi6696 Жыл бұрын
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
@NickJanetakis Жыл бұрын
Thanks a lot for the feedback.
@tomontheinternet
@tomontheinternet 4 жыл бұрын
Nick, your videos are awesome. Thanks for making them.
@NickJanetakis
@NickJanetakis 4 жыл бұрын
Thanks a lot for watching.
@DanielKofiKyeremateng
@DanielKofiKyeremateng 4 жыл бұрын
Great video, I already log to stdout in my Go web servers.
@NickJanetakis
@NickJanetakis 4 жыл бұрын
Thanks for watching!
@hassanfarid
@hassanfarid 4 жыл бұрын
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 .
@NickJanetakis
@NickJanetakis 4 жыл бұрын
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
@hassanfarid
@hassanfarid 4 жыл бұрын
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 .
@NickJanetakis
@NickJanetakis 4 жыл бұрын
@@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.
@hassanfarid
@hassanfarid 4 жыл бұрын
@@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!
@NickJanetakis
@NickJanetakis 4 жыл бұрын
@@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).
Best Practices Around Production Ready Web Apps with Docker Compose
33:34
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Improving Your Page Load Speeds on Any Site with Turbolinks
19:26
Nick Janetakis
Рет қаралды 8 М.
NGINX Explained - What is Nginx
14:32
TechWorld with Nana
Рет қаралды 297 М.
Configuring (and viewing!) logs in Laravel
13:17
Aaron Francis
Рет қаралды 14 М.
Simple HTTPs for Docker! // Traefik Tutorial (updated)
38:06
Christian Lempa
Рет қаралды 66 М.
Switching from NERDTree to Fern for a Vim Tree View Plugin
16:36
Nick Janetakis
Рет қаралды 11 М.
GoAccess: Open Source Real-time Web Log Analyzer and Interactive Viewer
9:04
Understanding Logging: Containers & Microservices
8:51
That DevOps Guy
Рет қаралды 38 М.
Top 8 Docker Best Practices for using Docker in Production
18:27
TechWorld with Nana
Рет қаралды 315 М.