Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compressLogs Functionality to Bitwarden Self-Hosted (Bash) #225

Merged
merged 4 commits into from Mar 11, 2024

Conversation

fer
Copy link
Contributor

@fer fer commented Mar 6, 2024

Description

Introduces a new feature to the Bitwarden self-hosted script bitwarden.sh – the ability to compress and archive logs within a specified date range, or all logs if no range is provided.

This enhancement simplifies log management, particularly for troubleshooting and audit purposes, by allowing administrators to easily package relevant log files.

Features

  • Compress logs between two dates (START_DATE and END_DATE) specified in YYYYMMDD format.
  • Optionally compress all logs if no date range is provided.
  • Validates date format and ensures START_DATE is not after END_DATE.
  • Creates the compressed archive in the current directory, naming it based on the date range or as "all" for complete log compression.

Usage examples

Compress logs from March 4th, 2024 to March 5th, 2024:

./bitwarden.sh compresslogs 20240304 20240305

A compressed file bitwarden-logs-20240304-to-20240305.tar.gz is produced.

Compress all logs:

./bitwarden.sh compresslogs

A compress file bitwarden-logs-all.tar.gz is produced

Testing

Please review this PR for inclusion in the next release of Bitwarden self-hosted. Your feedback and suggestions are welcome!

@bitwarden-bot
Copy link

bitwarden-bot commented Mar 6, 2024

Logo
Checkmarx One – Scan Summary & Detailsa2d46317-99cb-440f-bfcd-ab20a0b04e64

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /build-unified.yml: 194 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /build-unified.yml: 190

@djsmith85 djsmith85 requested review from a team March 6, 2024 15:25
bitwarden.sh Outdated Show resolved Hide resolved
Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
@fer fer self-assigned this Mar 6, 2024
@fer fer changed the title Add compressLogs Functionality to Bitwarden Self-Hosted Add compressLogs Functionality to Bitwarden Self-Hosted (Linux) Mar 6, 2024
@fer fer changed the title Add compressLogs Functionality to Bitwarden Self-Hosted (Linux) Add compressLogs Functionality to Bitwarden Self-Hosted (Bash) Mar 6, 2024
Copy link
Contributor

@keithhubner keithhubner left a comment

Choose a reason for hiding this comment

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

I have tested and works as expected.

@vgrassia vgrassia self-requested a review March 11, 2024 13:21
@vgrassia vgrassia merged commit b773c07 into bitwarden:main Mar 11, 2024
2 checks passed
@fer fer deleted the compresslogs branch March 11, 2024 13:40
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.

None yet

4 participants