-
Notifications
You must be signed in to change notification settings - Fork 3
Log rotation max size #14
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
65339a4
Add log size management feature
NoOne7135 46eef3a
Update CheckBox and DropDown styles
NoOne7135 30c3dc6
Adjust log deletion target in log size management
NoOne7135 eb9a579
Update MAX_LOGS_SIZE to 10GB
NoOne7135 3fde4df
Add shorthand notations for data size units in utility function
NoOne7135 f1c7a85
Refactor error handling in PutLogMessage function
NoOne7135 4f85387
Update Docker build tags and add release script for version 1.1.4
NoOne7135 a50c740
Refactor log management and update Docker build script
NoOne7135 402231e
Remove debug print statement from findOldestCutoffKey function in con…
NoOne7135 584aaf2
Update Docker build tags in release script to version 1.1.6
NoOne7135 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import ( | |
| "net/http" | ||
| "os" | ||
| "path/filepath" | ||
| "strconv" | ||
| "strings" | ||
| "time" | ||
|
|
||
|
|
@@ -298,3 +299,33 @@ func GetStorageData() map[string]float64 { | |
| // time.Sleep(time.Second * 30) | ||
| // } | ||
| // } | ||
|
|
||
| var units = []struct { | ||
| Suffix string | ||
| Multiplier int64 | ||
| }{ | ||
| {"TB", 1024 * 1024 * 1024 * 1024}, | ||
| {"T", 1024 * 1024 * 1024 * 1024}, | ||
| {"GB", 1024 * 1024 * 1024}, | ||
| {"G", 1024 * 1024 * 1024}, | ||
| {"MB", 1024 * 1024}, | ||
| {"M", 1024 * 1024}, | ||
| {"KB", 1024}, | ||
| {"K", 1024}, | ||
| {"B", 1}, | ||
| } | ||
|
|
||
| func ParseHumanReadableSize(sizeStr string) (int64, error) { | ||
| sizeStr = strings.TrimSpace(strings.ToUpper(sizeStr)) | ||
| for _, unit := range units { | ||
| if strings.HasSuffix(sizeStr, unit.Suffix) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets support 1g 1m etc also |
||
| numStr := strings.TrimSuffix(sizeStr, unit.Suffix) | ||
| num, err := strconv.ParseFloat(numStr, 64) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("invalid number in size: %s", numStr) | ||
| } | ||
| return int64(num * float64(unit.Multiplier)), nil | ||
| } | ||
| } | ||
| return 0, fmt.Errorf("unknown size unit in: %s", sizeStr) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,2 @@ | ||
| # docker buildx create --use | ||
| docker buildx build --platform=linux/amd64,linux/arm64 --tag "devforth/onlogs:latest" --tag "devforth/onlogs:1.1.2" --push . | ||
| # docker run -v /var/run/docker.sock:/var/run/docker.sock --rm -it $(docker build -q -f Dockerfile .) | ||
| # docker build . -t devforth/onlogs && docker push devforth/onlogs | ||
| docker buildx build --load --platform=linux/amd64,linux/arm64 --tag "devforth/onlogs:latest" --tag "devforth/onlogs:1.1.4" . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # docker buildx create --use | ||
| docker buildx build --platform=linux/amd64,linux/arm64 --tag "devforth/onlogs:latest" --tag "devforth/onlogs:1.1.6" --push . | ||
| # docker run -v /var/run/docker.sock:/var/run/docker.sock --rm -it $(docker build -q -f Dockerfile .) | ||
| # docker build . -t devforth/onlogs && docker push devforth/onlogs |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't see ussage of host and container function params