(line, status, filter string)
| 1331 | } |
| 1332 | |
| 1333 | func 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 | |
| 1351 | func containsKnownSSHLogMessage(line string) bool { |
| 1352 | return strings.Contains(line, "Accepted ") || containsFailedSSHLogMessage(line) |
no test coverage detected