Skip to content

Commit

Permalink
[syslog]: add year to all log files (sonic-net#18099)
Browse files Browse the repository at this point in the history
Why I did it
Currently SONiC logs do not show the year:

root@str2-7050cx3-acs-01:~# tail -f /var/log/teamd.log
Feb 14 00:07:54.856313 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel102[37]: usock: calling method "StateDump"
Feb 14 00:07:54.856795 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel101[29]: usock: calling method "StateDump"
Feb 14 00:07:55.859690 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel104[53]: usock: calling method "StateDump"
This PR fixes that issue:

2024 Feb 15 02:24:26.091224 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel102[33]: usock: calling method "StateDump"
2024 Feb 15 02:24:26.091224 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel101[25]: usock: calling method "StateDump"
2024 Feb 15 02:24:26.752655 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel103[41]: Ethernet120: Enabling port
2024 Feb 15 02:24:26.752655 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel103[41]: Enable carrier. Number of enabled ports 1 >= configured min_ports 1
2024 Feb 15 02:24:27.094931 str2-7050cx3-acs-01 DEBUG teamd#teamd_PortChannel103[41]: usock: calling method "StateDump"

Also added a sonic-mgmt PR 11806 to update the FMT time template in platform_tests/conftest.py to keep up with this image change.

Microsoft ADO (number only): 26399333
  • Loading branch information
assrinivasan authored May 15, 2024
1 parent 166a9fb commit 31f2c7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/image_config/rsyslog/rsyslog.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $UDPServerRun 514
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Define a custom template
$template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$template SONiCFileFormat,"%timegenerated:::date-year% %timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate SONiCFileFormat
$template SONiCForwardFormat,"<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
$ActionForwardDefaultTemplate SONiCForwardFormat
Expand Down

0 comments on commit 31f2c7c

Please sign in to comment.