Skip to content

Add date to logs in LetsEncrypt - #4754

Open
albal wants to merge 6 commits into
home-assistant:masterfrom
albal:albal/feature/letsencrypt-date-in-logs
Open

Add date to logs in LetsEncrypt#4754
albal wants to merge 6 commits into
home-assistant:masterfrom
albal:albal/feature/letsencrypt-date-in-logs

Conversation

@albal

@albal albal commented Jul 29, 2026

Copy link
Copy Markdown

This pull request improves logging in the Let's Encrypt service by adding timestamped log lines to Certbot output. The main changes include introducing a new timestamped function to prefix command output with a date and time, updating the Dockerfile to set a log timestamp format, and wrapping the Certbot invocation to use this new logging.

Logging improvements:

  • Added a timestamped shell function in letsencrypt/rootfs/etc/services.d/lets-encrypt/run that prefixes each line of a command’s output with a timestamp, ensuring Certbot output is dated like other log messages.
  • Updated the Certbot command invocation to use the timestamped function, so all Certbot logs include timestamps.
  • Set a new LOG_TIMESTAMP environment variable in letsencrypt/Dockerfile to control the timestamp format for logs.

Summary by CodeRabbit

  • Improvements
    • Container logs now include complete date and time information for clearer event tracking.
    • Certificate management command output is timestamped on every line, making activity easier to follow and troubleshooting more efficient.
    • Command results continue to report their original success or failure status while providing improved timestamped output.

albal added 2 commits July 29, 2026 17:28
Add environment variable for logging timestamp format
Added a timestamping function to log certbot output.

@home-assistant home-assistant Bot 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.

Hi @albal

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
home-assistant Bot marked this pull request as draft July 29, 2026 16:36
@home-assistant

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@albal
albal marked this pull request as ready for review July 29, 2026 16:38
@home-assistant
home-assistant Bot dismissed their stale review July 29, 2026 16:38

Stale

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f732c1c5-a7c8-4451-8a9f-485a78c8555d

📥 Commits

Reviewing files that changed from the base of the PR and between 8a49a06 and 2935901.

📒 Files selected for processing (1)
  • letsencrypt/rootfs/etc/services.d/lets-encrypt/run
🚧 Files skipped from review as they are similar to previous changes (1)
  • letsencrypt/rootfs/etc/services.d/lets-encrypt/run

📝 Walkthrough

Walkthrough

The Let’s Encrypt container sets a full date-and-time log format. The service prefixes certbot output from stdout and stderr with timestamps while preserving the command exit status.

Changes

Let’s Encrypt logging

Layer / File(s) Summary
Timestamp certbot output
letsencrypt/Dockerfile, letsencrypt/rootfs/etc/services.d/lets-encrypt/run
Sets LOG_TIMESTAMP to include the date, adds the timestamped() helper, and applies it to the certbot certonly invocation.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding dates to Let's Encrypt logs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@letsencrypt/rootfs/etc/services.d/lets-encrypt/run`:
- Around line 31-38: Update the timestamped function to preserve the wrapped
command’s exit status: capture PIPESTATUS[0] immediately after the
output-processing pipeline completes, then explicitly return that status instead
of the while loop’s result.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f670712-6742-490b-8a92-38115416d007

📥 Commits

Reviewing files that changed from the base of the PR and between 565cbca and 8a49a06.

📒 Files selected for processing (2)
  • letsencrypt/Dockerfile
  • letsencrypt/rootfs/etc/services.d/lets-encrypt/run

Comment thread letsencrypt/rootfs/etc/services.d/lets-encrypt/run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant