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

Function loadSSHLogLines

agent/app/service/ssh.go:1365–1390  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

1363}
1364
1365func 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
1392func matchSSHLogStatus(requestStatus, itemStatus string) bool {
1393 switch requestStatus {

Callers 1

loadSSHDataFunction · 0.85

Calls 2

CloseMethod · 0.65
ScanMethod · 0.65

Tested by

no test coverage detected