Skip to content

[WINC-1979] Implement log rotation for windows-exporter - #4359

Draft
wgahnagl wants to merge 1 commit into
openshift:masterfrom
wgahnagl:WINC-1979-2
Draft

[WINC-1979] Implement log rotation for windows-exporter#4359
wgahnagl wants to merge 1 commit into
openshift:masterfrom
wgahnagl:WINC-1979-2

Conversation

@wgahnagl

@wgahnagl wgahnagl commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Adds log rotation for windows-exporter

This allows windows-exporter logs to be managed by kube-log-runner, and rotated automatically.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2026
@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (2)
  • do-not-merge/work-in-progress
  • do-not-merge/hold

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: be58d032-a931-47a6-bb87-931e7b7db309

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wgahnagl
Once this PR has been reviewed and has the lgtm label, please assign mansikulkarni96 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mansikulkarni96

Copy link
Copy Markdown
Member

@code-rabbit full review

Comment thread pkg/services/services.go
windowsExporterServiceCommand := logconfig.GetKubeLogRunnerCmd(windows.KubeLogRunnerPath,
windows.WindowsExporterPath, windows.WindowsExporterLogPath)
windowsExporterServiceCommand = fmt.Sprintf("%s --collectors.enabled "+
"cpu,logical_disk,net,os,service,system,container,memory,cpu_info --web.config.file %s --log.level %s --log.file stdout",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need to send the logs to stdout if they are going to a log file?
whats the benefit of doing this and whats the pattern for other services?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding this stdout flag doesn't technically do anything, it just lets you know that the loging is getting sent to stdout for kube-log-runner to capture

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If its not doing anything I would skip it and follow the pattern for rest of the services

Comment thread pkg/services/services.go
if debug {
windowsExporterLogLevel = "debug"
}
windowsExporterServiceCommand := logconfig.GetKubeLogRunnerCmd(windows.KubeLogRunnerPath,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. what is the default log max file size for kubelogrunner at which the logs will start rotating?
  2. There is a env variable added by Jose to pass user defined log file size, will that be taken into account for windows exporter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

func GetKubeLogRunnerCmd(kubeLogRunnerPath, commandPath, logfilePath string) string {

this is where that is all set
it uses the env variable added by Jose because it uses the GetKubeLogRunnerCmd function which populates all of that by default. This also implements log rotation by using that command.
The default max log file is set in that function as well

Comment thread README.md
Managed Windows services with log rotation capabilities:
- kubelet
- kube-proxy
- windows_exporter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this PR implementing log rotation as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes! KubeLogRunner handles that. It rotates when the max size is reached.

@mansikulkarni96

Copy link
Copy Markdown
Member

@code-rabbit review

@mansikulkarni96

Copy link
Copy Markdown
Member

@code-rabbit full review

@mansikulkarni96

Copy link
Copy Markdown
Member

/test aws-e2e-operator

Comment thread pkg/services/services.go
windowsExporterServiceCommand := logconfig.GetKubeLogRunnerCmd(windows.KubeLogRunnerPath,
windows.WindowsExporterPath, windows.WindowsExporterLogPath)
windowsExporterServiceCommand = fmt.Sprintf("%s --collectors.enabled "+
"cpu,logical_disk,net,os,service,system,container,memory,cpu_info --web.config.file %s --log.level %s --log.file stdout",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If its not doing anything I would skip it and follow the pattern for rest of the services

@mansikulkarni96

Copy link
Copy Markdown
Member

/test unit

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@wgahnagl: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/aws-e2e-operator 1247967 link true /test aws-e2e-operator

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants