Score:0

nextjs/pino transport to aws linux2 syslog

cv flag

I'm building my first NextJS project, and am using the recommended Pino for logging. This has worked great in development, but now I'm trying to figure out how to deploy it to production.

I think the simplest form of my question is "how do I get pino to log to rsyslogd"?

In more detail, I'm running my Next app behind Apache on an EC2 server running Amazon Linux2. This is the first step in a long-term project to migrate all the current websites on the server from Wordpress to NextJS. Wordpress "naturally" logs through Apache, which plugs into the system syslog service. I then use AWS CloudWatch Agent to send the logs to CloudWatch.

This seems like the natural flow to me, as you then get your logs in the cloud, but you also have them stored locally, and can rely on the system services to handle things like log rotation.

The question now is, how do I get this to work with NextJS/Pino?

Pino has "legacy" transports, which includes a syslog module, which seems to be about formatting and not actually integrating with syslog. Their example of that shows pipelining first through their syslog module, then through a socket transport.

Aside from the fact that using these Unix pipes seems very wrong, and aside from the fact that this is "legacy", it doesn't actually show how to connect to the syslog service. Instead it seems to point to a remote syslog server.

Conversely, searching on how to configure rsyslogd results almost exclusively in hits on how to configure a remote syslog server.

How do I get Pino to talk to my already existing, local EC2 syslog?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.