unit
unit copied to clipboard
Nginx unit daemon json logs
Hello. Is there a way to get json logs instead of these ?
Hi @devel96 - Thanks for reaching out!
Not by using Units defaults features, BUT I am currently working on an instrumentation framework guide. I am thinking about providing an exporter for fluentd
and / or Loki
? What that be an option for you?
Hi @devel96 - Thanks for reaching out! Not by using Units defaults features, BUT I am currently working on an instrumentation framework guide. I am thinking about providing an exporter for
fluentd
and / orLoki
? What that be an option for you?
Hi @tippexs , thanks for answer. I am using loki + promtail + container logs. But it's ok for me to switch off unit daemon's stdout logs and use another tool to send it to loki. So is there an option just to switch off all nginx unit daemon's logs ?
I would suggest configuring UNIT's log to point to a different location then the deault one as this will symlinked to stdout
per default. See https://github.com/nginx/unit/blob/846a7f483643a00322f81a7848ca556722e5469a/pkg/docker/template.Dockerfile#L80C1-L80C44
Instead of building everyting new I would suggest using fluentd filter. https://docs.fluentd.org/filter/parser
This will let you scrape the output log of Unit and transformes it into JSON BEFORE it sends the data to the logging backend. These use cases are the things I would like to put in our Logs reference architecture. We will add more about this in 1.33 release.