pinojs / pino-syslog

🌲 A transport for reformatting pino logs into standard syslog format
30 stars 12 forks source link

Erroneous date format in RFC3164 #6

Closed loic-b closed 5 years ago

loic-b commented 5 years ago

Hi,

In file lib/rfc3164.js", I see those lines:

const zeroReg = /0/
const tstamp = moment(data.time).tz(options.tz).format('MMM DD HH:mm:ss').replace(zeroReg, ' ')

On Wed Jan 30 13:49:34 CET 2019, the tsstamp will be equal to "Jan 3 12:43:12" instead of expected "Jan 30 12:43:12"

The problem is that it replaces any zero in the string while the expected behavior for RFC3164 is to replaced only the leading zero of the day!

So, I guess it will also fail for month equals october...

jsumners commented 5 years ago

Thank you for the report. Are you able to submit a PR to fix it?

loic-b commented 5 years ago

Hi,

It's done, but not published...

I cloned the code, create a local branch, add 2 tests that shows the bug, solve it and then commit the changes locally.

When I try to submit a pull request, GitHub Desktop warn me that the branch must be publish before. When I try to publish the branch, I receive a authentication error saying that I'm not allowed to publish a branch...

Can you help me a little bit?

jsumners commented 5 years ago

Closed in #7.

Thank you @loic-b