3 ms·
Why is it stupid ? Is the same approach that heroku advocates. I have loads of containers logging to stdout and another container which collects all stdouts an
by aprdm 11y ago
Why is it stupid ? Is the same approach that heroku advocates.
I have loads of containers logging to stdout and another container which collects all stdouts and send to a logging-as-a-service. Why is it a bad idea ?
- stephenr 11y ago> Why is it stupid Let's compare logging via stdout, to say syslog, with a simple test. How do you identify the difference between a warning and an error or an emergency, in a string sent to stdout? What happens if the message contains a newline. How do you know if what follows is a continuation of the log entry, or is a new log entry? If your application dares to have two processes in the same container (i know, crazy concept) how do you separate them. The "literally one process per container" idea is what both causes the issue, and causes the obvious solution to the issue to be even harder to solve for the cases where software doesn't natively support the syslog protocol.
- aprdm 11y agoWere you the one who downvotted me because you disagree? o.O Anyways, this is dealt with in the logging-as-a-service (LAAS) that receives the logs... say you are using the python logger, you have different types of logging (DEBUG, INFO, WARN, ERR). If you just start the line with one of those statuses, your LAAS will know it should email you or something like that. The print, or file, or whatever, it's just how your data is getting somewhere for the proper analysis. You know if it's a new line or not because every log message starts with the same format, something like {APP, TIME, SEVERITY} and then the message...
- stephenr 11y agoSo instead of having actually structured information in defined fields, you're relying on a specific service's format. So presumably you then have to try to get all the services you use (e.g. Apache / NGinx / HAproxy / Varnish / (my|postgre)sql / redis / memcache etc) to format logs in the same way, and do it to stdout... > Were you the one who downvotted me because you disagree? o.O Down voting on HN is broken[1], so I don't use it, ever[2]. 1. In the sense of, it does the wrong thing, not in the sense of it doesn't do anything. 2. Except when i hit the wrong thing because of the complete lack of usability on a mobile device.
- aprdm 11y agoyup, I will tell you tho, it isn't really hard once you have a format... it's pretty easy to share the format between different services as it's just string formatting. I currently have logs from the django app and nginx and was pretty easy to set up. It might not be the best solution but I don't think it's stupid