(filePath string)
| 1363 | } |
| 1364 | |
| 1365 | func loadSSHLogLines(filePath string) ([]string, error) { |
| 1366 | file, err := os.Open(filePath) |
| 1367 | if err != nil { |
| 1368 | return nil, err |
| 1369 | } |
| 1370 | defer file.Close() |
| 1371 | |
| 1372 | var reader io.Reader = file |
| 1373 | if strings.HasSuffix(filePath, ".gz") { |
| 1374 | gzipReader, err := gzip.NewReader(file) |
| 1375 | if err != nil { |
| 1376 | return nil, err |
| 1377 | } |
| 1378 | defer gzipReader.Close() |
| 1379 | reader = gzipReader |
| 1380 | } |
| 1381 | |
| 1382 | var lines []string |
| 1383 | scanner := bufio.NewScanner(reader) |
| 1384 | buf := make([]byte, 0, 64*1024) |
| 1385 | scanner.Buffer(buf, 1024*1024) |
| 1386 | for scanner.Scan() { |
| 1387 | lines = append(lines, scanner.Text()) |
| 1388 | } |
| 1389 | return lines, scanner.Err() |
| 1390 | } |
| 1391 | |
| 1392 | func matchSSHLogStatus(requestStatus, itemStatus string) bool { |
| 1393 | switch requestStatus { |
no test coverage detected