Add PathTemplate to customize the directory for exporting logs #36
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.
PathTemplate
PathTemplate
based on Go templates, you can freely structure fields using the template fields described belowTemplate Fields
/{time layout(2006-01)}/{Namespace}/{LobsterSink name}/{Contents name}/{Pod}/{Container}/{Start time of log}_{End time of log}.log
{{TimeFunc "2006-01-02"}}
{{.Cluster}}
{{.Namespace}}
{{.SinkName}}
{{.RuleName}}
{{.Pod}}
{{.Container}}
__emptydir__
{{.SourceType}}
stdstream
oremptydir
{{.SourcePath}}
Example
/lobster
/{{TimeFunc "2006-01"}}
/{{.Pod}}
/{{.SourcePath}}
/lobster/{{TimeFunc "2006-01"}}/123/{{.SourcePath}}
/{{TimeFunc "2006-01"}}/{{Time "2006-01-02"}}
Cautions
/{{.Pod}}
, where delimiters are insufficient,conflicts may arise when exporting logs from multiple containers, each having the same log timestamp
2025-01-06T18:20:24%252B09:00_2025-01-06T18:21:23%252B09:00.log
2025-01-06T18:20:24%252B09:00_2025-01-06T18:21:23%252B09:00.log