Skip to content

Commit

Permalink
Addressed comments and revised config
Browse files Browse the repository at this point in the history
Changes include:
- the user is now notified if their log level config value is invalid
  and it is set to default
- Cms was moved from caches to origins where it should be
- Pss controls now pss.trace and pss.setopt for easier usability
  • Loading branch information
joereuss12 committed Jan 25, 2024
1 parent 20dcbe5 commit 3158bbf
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 70 deletions.
5 changes: 2 additions & 3 deletions config/resources/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ Logging:
Level: "Error"
Cache:
Scitokens: error
XrootdPssSetOptCache: error
Pss: error
Cms: error
Ofs: error
Xrd: error
Origin:
Scitokens: error
PssSetOptOrigin: error
Pss: error
Cms: error
Pfc: info
Xrootd: emsg login stall redirect
Server:
Expand Down
29 changes: 10 additions & 19 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,9 @@ type: string
default: error
components: ["cache"]
---
name: Logging.Cache.PssSetOptCache
description: >-
Configures the XRootD client used by the proxy top communicate with the cache (we use to set debug level).
Values include: debug, info, error (default of error/DebugLevel 1)
type: string
default: error
components: ["cache"]
---
name: Logging.Cache.Pss
description: >-
Logging level of pss within Xrootd configuration values include: debug, info, error (default of error/off)
type: string
default: error
components: ["cache"]
---
name: Logging.Cache.Cms
description: >-
Trace level of cms debug output within Xrootd configuration. Values include: debug, info, error (default of error/-all)
Logging level of pss and pssSetOptCache within Xrootd configuration values include: debug, info, error (default of error/off/Debug Level 1)
type: string
default: error
components: ["cache"]
Expand All @@ -204,10 +189,16 @@ type: string
default: error
components: ["origin"]
---
name: Logging.Origin.PssSetOptOrigin
name: Logging.Origin.Pss
description: >-
Logging level of pss and pssSetOptOrigin within Xrootd configuration values include: debug, info, error (default of error/off/Debug Level 1)
type: string
default: error
components: ["origin"]
---
name: Logging.Origin.Cms
description: >-
Configures the XRootD client used by the proxy top communicate with the origin (we use to set debug level).
Values include: debug, info, error (default of error/DebugLevel 1)
Trace level of cms debug output within Xrootd configuration. Values include: debug, info, error (default of error/-all)
type: string
default: error
components: ["origin"]
Expand Down
5 changes: 2 additions & 3 deletions param/parameters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions param/parameters_struct.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion xrootd/resources/xrootd-cache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ pss.setopt {{.Logging.PssSetOptCache}}
pss.trace {{.Logging.CachePss}}
ofs.trace {{.Logging.CacheOfs}}
xrd.trace {{.Logging.CacheXrd}}
cms.trace {{.Logging.CacheCms}}
scitokens.trace {{.Logging.CacheScitokens}}
2 changes: 2 additions & 0 deletions xrootd/resources/xrootd-origin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ ofs.ckslib * libXrdMultiuser.so
xrootd.chksum max 2 md5 adler32 crc32
xrootd.trace {{.Logging.OriginXrootd}}
pfc.trace {{.Logging.OriginPfc}}
pss.trace {{.Logging.OriginPss}}
pss.setopt {{.Logging.PssSetOptOrigin}}
cms.trace {{.Logging.OriginCms}}
xrootd.tls all
scitokens.trace {{.Logging.OriginScitokens}}
125 changes: 87 additions & 38 deletions xrootd/xrootd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ type (
LoggingConfig struct {
CacheScitokens string
CachePss string
CacheCms string
CacheOfs string
CacheXrd string
PssSetOptCache string
OriginScitokens string
OriginPss string
OriginPfc string
OriginCms string
OriginXrootd string
PssSetOptOrigin string
}
Expand Down Expand Up @@ -635,18 +636,28 @@ func mapXrootdLogLevels(xrdConfig *XrootdConfig) {
xrdConfig.Logging.OriginScitokens = "all"
} else if originScitokensConfig == "info" {
xrdConfig.Logging.OriginScitokens = "info"
} else if originScitokensConfig == "error" {
xrdConfig.Logging.OriginScitokens = "none"
} else { // Default is error
log.Errorln("Unrecognized log-level for Origin_Scitokens, setting to default (error) setting.")
xrdConfig.Logging.OriginScitokens = "none"
}

// Cache PssSetOptOrigin
cachePssSetOptOrigin := param.Logging_Origin_PssSetOptOrigin.GetString()
if cachePssSetOptOrigin == "debug" {
// pssSetOptOrigin and pssOrigin
pssSetOptOrigin := param.Logging_Origin_Pss.GetString()
if pssSetOptOrigin == "debug" {
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 3"
} else if cachePssSetOptOrigin == "info" {
xrdConfig.Logging.OriginPss = "all"
} else if pssSetOptOrigin == "info" {
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 2"
xrdConfig.Logging.OriginPss = "on"
} else if pssSetOptOrigin == "error" {
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 1"
xrdConfig.Logging.OriginPss = "off"
} else {
log.Errorln("Unrecognized log-level for Origin_Pss, setting to default (error) setting.")
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 1"
xrdConfig.Logging.OriginPss = "off"
}

// Origin Pfc
Expand All @@ -655,69 +666,104 @@ func mapXrootdLogLevels(xrdConfig *XrootdConfig) {
xrdConfig.Logging.OriginPfc = "all"
} else if originPfcConfig == "error" {
xrdConfig.Logging.OriginPfc = "none"
} else { // Default is info
} else if originPfcConfig == "info" { // Default is info
xrdConfig.Logging.OriginPfc = "info"
} else {
log.Errorln("Unrecognized log-level for Origin_Pfc, setting to default (info) setting.")
xrdConfig.Logging.OriginPfc = "info"
}

// Origin Cms
originCmsConfig := param.Logging_Origin_Cms.GetString()
if originCmsConfig == "debug" {
xrdConfig.Logging.OriginCms = "all"
} else if originCmsConfig == "info" {
xrdConfig.Logging.OriginCms = "-all" // Not super sure what to do for info on this one
} else if originCmsConfig == "error" {
xrdConfig.Logging.OriginCms = "-all"
} else {
log.Errorln("Unrecognized log-level for Origin_Cms, setting to default (error) setting.")
xrdConfig.Logging.OriginCms = "-all"
}

// Origin Xrootd
// Have this for now with the regular config options, not sure what to do to make it more
// user-friendly since our/osg's defaults are pretty specific
originXrootdConfig := param.Logging_Origin_Xrootd.GetString()
xrdConfig.Logging.OriginXrootd = originXrootdConfig
// Keeping this commented out here if we implement debug, info, error logging on origin
// if originXrootdConfig == "debug" {
// xrdConfig.Logging.OriginXrootd = "all"
// } else if originXrootdConfig == "info" {
// xrdConfig.Logging.OriginXrootd = "info"
// } else {
// xrdConfig.Logging.OriginXrootd = "none"
// }

// Want to make sure everything specified is a valid config value:
allowedVariables := map[string]bool{
"all": true,
"auth": true,
"debug": true,
"emsg": true,
"fs": true,
"fsaio": true,
"fsio": true,
"login": true,
"mem": true,
"off": true,
"pgcserr": true,
"redirect": true,
"request": true,
"response": true,
"stall": true,
}

configValues := strings.Fields(originXrootdConfig)
validConfig := true
for _, value := range configValues {
if _, exists := allowedVariables[value]; !exists {
log.Errorln("Unrecognized log-level found for Origin_Xrootd, setting to default (emsg login stall redirect) setting.")
xrdConfig.Logging.OriginXrootd = "emsg login stall redirect"
validConfig = false
break
}
}
if validConfig {
xrdConfig.Logging.OriginXrootd = originXrootdConfig
}

// Cache Scitokens
cacheScitokensConfig := param.Logging_Cache_Scitokens.GetString()
if cacheScitokensConfig == "debug" {
xrdConfig.Logging.CacheScitokens = "all"
} else if cacheScitokensConfig == "info" {
xrdConfig.Logging.CacheScitokens = "info"
} else {
} else if cacheScitokensConfig == "error" {
xrdConfig.Logging.CacheScitokens = "none"
} else { // Default is error
log.Errorln("Unrecognized log-level for Cache_Scitokens, setting to default (error) setting.")
xrdConfig.Logging.CacheScitokens = "none"
}

// Cache PssSetOptCache
cachePssSetOptCache := param.Logging_Cache_PssSetOptCache.GetString()
if cachePssSetOptCache == "debug" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 3"
} else if cachePssSetOptCache == "info" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 2"
} else {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 1"
}

// Cache Pss
// Cache PssSetOptCache and Cache Pss
cachePssConfig := param.Logging_Cache_Pss.GetString()
if cachePssConfig == "debug" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 3"
xrdConfig.Logging.CachePss = "all"
} else if cachePssConfig == "info" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 2"
xrdConfig.Logging.CachePss = "on"
} else {
} else if cachePssConfig == "error" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 1"
xrdConfig.Logging.CachePss = "off"
}

// Cache Cms
cacheCmsConfig := param.Logging_Cache_Cms.GetString()
if cacheCmsConfig == "debug" {
xrdConfig.Logging.CacheCms = "all"
} else if cacheCmsConfig == "info" {
xrdConfig.Logging.CacheCms = "-all" // Not super sure what to do for info on this one
} else {
xrdConfig.Logging.CacheCms = "-all"
log.Errorln("Unrecognized log-level for Cache_Pss, setting to default (error) setting.")
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 1"
xrdConfig.Logging.CachePss = "off"
}

// Cache Cms
// Cache Ofs
cacheOfsConfig := param.Logging_Cache_Ofs.GetString()
if cacheOfsConfig == "debug" {
xrdConfig.Logging.CacheOfs = "all"
} else if cacheOfsConfig == "info" {
xrdConfig.Logging.CacheOfs = "-all" // Not super sure what to do for info on this one
} else if cacheOfsConfig == "error" {
xrdConfig.Logging.CacheOfs = "-all"
} else {
log.Errorln("Unrecognized log-level for Cache_Ofs, setting to default (error) setting.")
xrdConfig.Logging.CacheOfs = "-all"
}

Expand All @@ -727,7 +773,10 @@ func mapXrootdLogLevels(xrdConfig *XrootdConfig) {
xrdConfig.Logging.CacheXrd = "all -sched"
} else if cacheXrdConfig == "info" {
xrdConfig.Logging.CacheXrd = "-all" // Not super sure what to do for info on this one
} else if cacheXrdConfig == "error" {
xrdConfig.Logging.CacheXrd = "-all"
} else {
log.Errorln("Unrecognized log-level for Cache_Xrd, setting to default (error) setting.")
xrdConfig.Logging.CacheXrd = "-all"
}
}

0 comments on commit 3158bbf

Please sign in to comment.