MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / shouldParseSSHLogLine

Function shouldParseSSHLogLine

agent/app/service/ssh.go:1333–1349  ·  view source on GitHub ↗
(line, status, filter string)

Source from the content-addressed store, hash-verified

1331}
1332
1333func shouldParseSSHLogLine(line, status, filter string) bool {
1334 if !strings.Contains(line, "sshd") {
1335 return false
1336 }
1337 if filter != "" {
1338 return containsKnownSSHLogMessage(line)
1339 }
1340 switch status {
1341 case constant.StatusSuccess:
1342 return strings.Contains(line, "Accepted ")
1343 case constant.StatusFailed:
1344 // Accepted lines are still needed here to suppress redundant session failure records from the same SSH session.
1345 return containsFailedSSHLogMessage(line) || strings.Contains(line, "Accepted ")
1346 default:
1347 return containsKnownSSHLogMessage(line)
1348 }
1349}
1350
1351func containsKnownSSHLogMessage(line string) bool {
1352 return strings.Contains(line, "Accepted ") || containsFailedSSHLogMessage(line)

Callers 1

collectSSHLogItemsFunction · 0.85

Calls 2

Tested by

no test coverage detected