feat: allow specifying a custom app label alias when shipping logs via vector
Closes #7354
This commit is contained in:
7 files changed
+146
-16
No files matched your search
+26
-6
@@ -11,12 +11,15 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
}
|
||||
|
||||
flags := map[string]common.ReportFunc{
|
||||
"--logs-computed-max-size": reportComputedMaxSize,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-max-size": reportMaxSize,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-sink": reportVectorSink,
|
||||
"--logs-computed-app-label-alias": reportComputedAppLabelAlias,
|
||||
"--logs-computed-max-size": reportComputedMaxSize,
|
||||
"--logs-global-app-label-alias": reportGlobalAppLabelAlias,
|
||||
"--logs-global-max-size": reportGlobalMaxSize,
|
||||
"--logs-global-vector-sink": reportGlobalVectorSink,
|
||||
"--logs-app-label-alias": reportAppLabelAlias,
|
||||
"--logs-max-size": reportMaxSize,
|
||||
"--logs-vector-global-image": reportVectorGlobalImage,
|
||||
"--logs-vector-sink": reportVectorSink,
|
||||
}
|
||||
|
||||
flagKeys := []string{}
|
||||
@@ -30,6 +33,23 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
return common.ReportSingleApp("logs", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
}
|
||||
|
||||
func reportComputedAppLabelAlias(appName string) string {
|
||||
value := reportAppLabelAlias(appName)
|
||||
if value == "" {
|
||||
value = reportGlobalAppLabelAlias(appName)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
func reportGlobalAppLabelAlias(appName string) string {
|
||||
return common.PropertyGetDefault("logs", "--global", "app-label-alias", AppLabelAlias)
|
||||
}
|
||||
|
||||
func reportAppLabelAlias(appName string) string {
|
||||
return common.PropertyGet("logs", appName, "app-label-alias")
|
||||
}
|
||||
|
||||
func reportComputedMaxSize(appName string) string {
|
||||
value := reportMaxSize(appName)
|
||||
if value == "" {
|
||||
|
||||
Reference in new issue
Block a user