Skip to content

[console] Add new commands for Console Logging feature in CONSOLE_PORT - #4685

Open
nats-nokia wants to merge 3 commits into
sonic-net:masterfrom
nats-nokia:console_logging
Open

nats-nokia wants to merge 3 commits into
sonic-net:masterfrom
nats-nokia:console_logging

Conversation

@nats-nokia

@nats-nokia nats-nokia commented Jul 14, 2026

Copy link
Copy Markdown

What I did

Add new commands to enable, disable console logging. optional command to modify the filename, logrotate parameters for the filename.

Related PR from other sub modules:
sonic-net/sonic-buildimage#28411
sonic-net/sonic-host-services#409

How I did it

Add new commands: config console logging {enable/disable}.
optional command: config console logging filename [--logrotate-size SIZE] [--logrotate-count COUNT]
If filename,logrorate parameters are not configured, default values (/var/log/console-.log, 10M size, 10 count) will be used.

How to verify it

Manually tested on physical testbed.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

Comment thread config/console.py Outdated
@click.argument('logrotate_keyword', metavar='logrotate', required=False)
@click.argument('size', metavar='<size>', required=False)
@click.argument('count', metavar='<count>', required=False, type=click.IntRange(1, 100))
def set_console_logging_filename(db, filename, logrotate_keyword, size, count):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use click options for logrotate parameters instead of positional arguments?
Since logrotate has multiple optional fields, options may provide better extensibility and avoid ambiguous CLI parsing.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Comment thread config/console.py
Comment thread config/console.py Outdated
Signed-off-by: Natarajan Subbiramani <natarajan.subbiramani@nokia.com>
modified logrotate default values size as 10M, count as 10
logrotate parameters as click options

Signed-off-by: Natarajan Subbiramani <natarajan.subbiramani@nokia.com>
Signed-off-by: Natarajan Subbiramani <natarajan.subbiramani@nokia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@ediwibowo-msft ediwibowo-msft left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

7 similar comments
@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi @sonic-net/sonic-utilities-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants