logalert icon indicating copy to clipboard operation
logalert copied to clipboard

Is it possible to format the output of the date command?

Open thezolin opened this issue 1 year ago • 1 comments

Hello,

I would like to remove the timezone information from the message's date command. I tried with the original Linux commands, but without success.

Is there any way to do this?

e.g.:

Tue Dec 10 2024 10:00:13 GMT+0000 (Coordinated Universal Time) I want to remove "GMT+0000 (Coordinated Universal Time) "

Thank you in advance.

thezolin avatar Dec 10 '24 10:12 thezolin

Hmm, well, this is how Node.js formats dates by default. The code isn't requesting the timezone, it just gets added automatically based on your locale:

https://github.com/jhuckaby/logalert/blob/master/index.js#L322

    date: (new Date()).toString()

You can change this by setting the timezone on your server, however:

ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

In a future release I can try to add macros that resolve to various date bits, so you can construct your own date/time string.

jhuckaby avatar Dec 11 '24 22:12 jhuckaby