Hi team, trying to forward logs from a digitalocea...
# signoz-cloud
k
Hi team, trying to forward logs from a digitalocean managed postgres instance to signoz cloud. Does anyone know if/how this can done? For my containers in digitalocean app platform I setup an otel log collector/forwarder but I'm not sure how to orchestrate this since I have much less "bare-metal" access to the postgres instance they're managing. They do support log forwarding to a few different apps but hopefully there is a workaround somehow, maybe through their API to connect to signoz?
it sounds like maybe the best approach is to just poll pg_stat_statements periodically but It'd be nice to have the raw logs if possible
h
Since Digital Ocean's Log Forwarding supports rsyslog, maybe you can just add a syslog receiver on that OTel collector you already have and point the Log Forwarder to it?
k
Thanks for this, yeah I was hoping to avoid overloading my central app container with pg logs that are just being forwarded but this might be the best approach given the constraints
h
Aren't you running that otel forwarder as its own horizontally scalable container?
k
I probably should be but no it's just running in my container like so e.g.
Copy code
RUN apk add --no-cache bash curl && \
  curl -sL -o /tmp/otelcol.tar.gz <https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/otelcol-contrib_${OTEL_VERSION}_linux_amd64.tar.gz> && \
  mkdir -p /opt/otelcol-contrib && \
  tar -xzf /tmp/otelcol.tar.gz -C /opt/otelcol-contrib && \
  rm /tmp/otelcol.tar.gz

... truncated ...

CMD ["/bin/bash", "-c", "/opt/otelcol-contrib/otelcol-contrib --config /opt/otelcol-contrib/config.yaml &> /var/log/otelcol-output.log & echo \"$!\" > otel-pid &&yarn node build/server.js > /var/log/app.log 2>&1"]
kinda dirty but it gets the job done
h
That's rather odd if you have a random Node JS service and Postgres is shipping logs to it. It's probably best to centralize a collector / forwarder so it can be given its own resources / scaling rules.
k
yeah I havent done that part yet, that's what I was wary of
right now the collector in my container is just using the filelog receiver from my app logs only
h
If you're running NodeJS I'd avoid filelog and just install the autoinstrumentation, it has hooks for pino/winston/etc so your logs are structured and correlated with traces.
k
I'm using node but switching to bun, but all of my logs I care about are from pino
it sounds like if I have pino log to stdout I can setup rsyslog so it would have the followig setup pino stdout > digitalocean rsyslog > collector container > signoz ?
h
You can start here: https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node and research how the Open Telemetry Operator does it. You'd just need to update your Dockerfile to use a multi-step build and copy the packages from the autoinstrumentation image then load it in using NODE_OPTIONS.
k
I suspect that probably won't work with bun, but I don't need full tracing , just looking for logging
h
I think you risk playing lots of formatting / parsing games. This would probably be simpler: https://www.npmjs.com/package/@opentelemetry/instrumentation-pino
k
oh that's interesting
h
Hooks into Pino, send logs directly to your collector to forward to Signoz.
k
yeah I'll definitely check that out
since it sounds like you have a pretty good understanding of otel/nodejs ecosystem, any idea what kid of support bun offers for these utilities?
h
Sorry, I'm not familiar with the nuances of Bun compatibility. Most of the autoinstrumentations are either registering transports defined by the logging framework, or monkey patching in wrappers... so I'd assume monkey patching is still valid in Bun.
There's probably a demo Bun image you can load up to point at your Signoz ingest, or this simple project to test: https://medium.com/@aashari/tracing-bun-and-elysiajs-with-opentelemetry-and-datadog-e42d4657e9a8
🙌 1
just modify that project to have Pino and the OTel-Pino libs and see how it goes.