How change date format of ulogd2 ?

SpongeB0B

New Member
Joined
Feb 11, 2022
Messages
26
Reaction score
7
Credits
240
Hi everyone,

I followed this tutorial to externalize my nftables log to another log than /var/log/messages

it work, unfortunately the date format is
log said:
Feb 26 02:06:38

I would like to change it to something close to
expected log said:
2022-02-27 17:30:30.123456

I've looked in the ulogd documentation but found nothing about it...

Any ideas ? or other way to export the log of nftables ?

Thanks.
 


anshul_m

New Member
Joined
May 25, 2022
Messages
1
Reaction score
0
Credits
8
To format the date command’s output, you can use control characters preceded by a + sign. Format controls begin with the % symbol and are substituted by their current values.

Here, the %Y character is replaced with the current year, %m with month, and %d with the day of the month

You can try these methods too :

date +"Year: %Y, Month: %m, Day: %d"

date "+DATE: %D%nTIME: %T"

date +"Week number: %V Year: %y"
 
Top