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

Xrootd log levels now configurable #660

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/resources/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
Debug: false
Logging:
Level: "Error"
Cache:
Scitokens: error
Pss: error
Ofs: error
Xrd: error
Origin:
Scitokens: error
Pss: error
Cms: error
Pfc: info
Xrootd: emsg login stall redirect
Server:
WebPort: 8444
WebHost: "0.0.0.0"
Expand Down
64 changes: 64 additions & 0 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,70 @@ type: bool
default: false
components: ["Client"]
---
name: Logging.Cache.Scitokens
description: >-
Trace level of scitokens debug output within Xrootd configuration. Values include: debug, info, error (default of error/none)
type: string
default: error
components: ["cache"]
---
name: Logging.Cache.Pss
description: >-
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"]
---
name: Logging.Cache.Ofs
description: >-
Trace level of ofs debug output within Xrootd configuration. Values include: debug, info, error (default of error/-all)
type: string
default: error
components: ["cache"]
---
name: Logging.Cache.Xrd
description: >-
Trace options for Xrootd debug output (xrd) within Xrootd configuration. Values include: debug, info, error (default of error/-all)
type: string
default: error
components: ["cache"]
---
name: Logging.Origin.Scitokens
description: >-
Trace level of scitokens debug output within Xrootd configuration. Values include: debug, info, error (default of error/none)
type: string
default: error
components: ["origin"]
---
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: >-
Trace level of cms debug output within Xrootd configuration. Values include: debug, info, error (default of error/-all)
type: string
default: error
components: ["origin"]
---
name: Logging.Origin.Pfc
description: >-
Trace level of pfc debug output within Xrootd configuration. Values include: debug, info, error (default of info/info)
type: string
default: info
components: ["origin"]
---
name: Logging.Origin.Xrootd
description: >-
Trace options for Xrootd debug output within Xrootd configuration. Values include: all, auth, debug, emsg, fs, fsaio, fsio, login, mem, off,
pgcserr, redirect, request, response, stall
type: string
default: emsg login stall redirect # Not sure how to do defaults for this one since ours/osg's are so specific
components: ["origin"]
---
############################
# Federation-Level Configs #
############################
Expand Down
9 changes: 9 additions & 0 deletions param/parameters.go

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

26 changes: 26 additions & 0 deletions param/parameters_struct.go

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

11 changes: 5 additions & 6 deletions xrootd/resources/xrootd-cache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ oss.localroot {{.Cache.DataLocation}}
#oss.space meta {{.Cache.DataLocation}}/meta*
#oss.space data {{.Cache.DataLocation}}/data*
pss.debug
pss.setopt DebugLevel 3
pss.trace all
ofs.trace all
xrd.trace all -sched
cms.trace all
scitokens.trace all
pss.setopt {{.Logging.PssSetOptCache}}
pss.trace {{.Logging.CachePss}}
ofs.trace {{.Logging.CacheOfs}}
xrd.trace {{.Logging.CacheXrd}}
scitokens.trace {{.Logging.CacheScitokens}}
10 changes: 6 additions & 4 deletions xrootd/resources/xrootd-origin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ ofs.osslib libXrdMultiuser.so default
ofs.ckslib * libXrdMultiuser.so
{{end}}
xrootd.chksum max 2 md5 adler32 crc32
xrootd.trace emsg login stall redirect
pfc.trace info
pss.setopt DebugLevel 1
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 all
scitokens.trace {{.Logging.OriginScitokens}}
182 changes: 178 additions & 4 deletions xrootd/xrootd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,26 @@ type (
TLSCACertificateFile string
}

LoggingConfig struct {
CacheScitokens string
CachePss string
CacheOfs string
CacheXrd string
PssSetOptCache string
OriginScitokens string
OriginPss string
OriginPfc string
OriginCms string
OriginXrootd string
PssSetOptOrigin string
}

XrootdConfig struct {
Server ServerConfig
Origin OriginConfig
Xrootd XrootdOptions
Cache CacheConfig
Server ServerConfig
Origin OriginConfig
Xrootd XrootdOptions
Cache CacheConfig
Logging LoggingConfig
}
)

Expand Down Expand Up @@ -502,6 +517,7 @@ func LaunchXrootdMaintenance(ctx context.Context, server server_utils.XRootDServ
}

func ConfigXrootd(ctx context.Context, origin bool) (string, error) {

gid, err := config.GetDaemonGID()
if err != nil {
return "", err
Expand All @@ -513,6 +529,9 @@ func ConfigXrootd(ctx context.Context, origin bool) (string, error) {
return "", err
}

// Map out xrootd logs
mapXrootdLogLevels(&xrdConfig)

runtimeCAs := filepath.Join(param.Xrootd_RunLocation.GetString(), "ca-bundle.crt")
caCount, err := utils.LaunchPeriodicWriteCABundle(ctx, runtimeCAs, 2*time.Minute)
if err != nil {
Expand Down Expand Up @@ -606,3 +625,158 @@ func SetUpMonitoring(ctx context.Context, egrp *errgroup.Group) error {

return nil
}

// mapXrootdLogLevels is utilized to map Pelican config values to Xrootd ones
// this is used to keep our log levels for Xrootd simple, so one does not need
// to be an Xrootd expert to understand the inconsistent logs within Xrootd
func mapXrootdLogLevels(xrdConfig *XrootdConfig) {
// Origin Scitokens
originScitokensConfig := param.Logging_Origin_Scitokens.GetString()
if originScitokensConfig == "debug" {
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"
}

// pssSetOptOrigin and pssOrigin
pssSetOptOrigin := param.Logging_Origin_Pss.GetString()
if pssSetOptOrigin == "debug" {
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 3"
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
originPfcConfig := param.Logging_Origin_Pfc.GetString()
if originPfcConfig == "debug" {
xrdConfig.Logging.OriginPfc = "all"
} else if originPfcConfig == "error" {
xrdConfig.Logging.OriginPfc = "none"
} 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()

// 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 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 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 if cachePssConfig == "error" {
xrdConfig.Logging.PssSetOptCache = "DebugLevel 1"
xrdConfig.Logging.CachePss = "off"
} else {
log.Errorln("Unrecognized log-level for Cache_Pss, setting to default (error) setting.")
xrdConfig.Logging.PssSetOptOrigin = "DebugLevel 1"
xrdConfig.Logging.CachePss = "off"
}

// 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"
}

// Cache Xrd
cacheXrdConfig := param.Logging_Cache_Xrd.GetString()
if cacheXrdConfig == "debug" {
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"
}
}
Loading