diff --git a/agent/app/service/file.go b/agent/app/service/file.go
index a41ebc919..7bb69a8d2 100644
--- a/agent/app/service/file.go
+++ b/agent/app/service/file.go
@@ -446,10 +446,17 @@ func (f *FileService) ReadLogByLine(req request.FileReadByLineReq) (*response.Fi
logFilePath = ssl.GetLogPath()
case constant.TypeSystem:
fileName := ""
- if len(req.Name) == 0 || req.Name == time.Now().Format("2006-01-02") {
+ if len(req.Name) == 0 {
fileName = "1Panel.log"
} else {
- fileName = "1Panel-" + req.Name + ".log"
+ if strings.HasSuffix(req.Name, time.Now().Format("2006-01-02")) {
+ fileName = "1Panel.log"
+ if strings.HasPrefix(req.Name, "Core-") {
+ fileName = "1Panel-Core.log"
+ }
+ } else {
+ fileName = "1Panel-" + req.Name + ".log"
+ }
}
logFilePath = path.Join(global.Dir.DataDir, "log", fileName)
if _, err := os.Stat(logFilePath); err != nil {
diff --git a/agent/app/service/logs.go b/agent/app/service/logs.go
index 64c4d30a7..97def0acc 100644
--- a/agent/app/service/logs.go
+++ b/agent/app/service/logs.go
@@ -4,7 +4,6 @@ import (
"fmt"
"os"
"path"
- "path/filepath"
"sort"
"strings"
"time"
@@ -25,35 +24,45 @@ func NewILogService() ILogService {
}
func (u *LogService) ListSystemLogFile() ([]string, error) {
- var files []string
- if err := filepath.Walk(global.Dir.LogDir, func(pathItem string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
- if !info.IsDir() && strings.HasPrefix(info.Name(), "1Panel") {
- if info.Name() == "1Panel.log" {
- files = append(files, time.Now().Format("2006-01-02"))
- return nil
- }
- itemFileName := strings.TrimPrefix(info.Name(), "1Panel-")
- itemFileName = strings.TrimSuffix(itemFileName, ".gz")
- itemFileName = strings.TrimSuffix(itemFileName, ".log")
- files = append(files, itemFileName)
- return nil
- }
- return nil
- }); err != nil {
+ var listFile []string
+ files, err := os.ReadDir(global.Dir.LogDir)
+ if err != nil {
return nil, err
}
-
- if len(files) < 2 {
- return files, nil
+ listMap := make(map[string]struct{})
+ for _, item := range files {
+ if !item.IsDir() && strings.HasPrefix(item.Name(), "1Panel") {
+ if item.Name() == "1Panel.log" || item.Name() == "1Panel-Core.log" {
+ itemName := time.Now().Format("2006-01-02")
+ if _, ok := listMap[itemName]; ok {
+ continue
+ }
+ listMap[itemName] = struct{}{}
+ listFile = append(listFile, itemName)
+ continue
+ }
+ itemFileName := strings.TrimPrefix(item.Name(), "1Panel-Core-")
+ itemFileName = strings.TrimPrefix(itemFileName, "1Panel-")
+ itemFileName = strings.TrimSuffix(itemFileName, ".gz")
+ itemFileName = strings.TrimSuffix(itemFileName, ".log")
+ if len(itemFileName) == 0 {
+ continue
+ }
+ if _, ok := listMap[itemFileName]; ok {
+ continue
+ }
+ listMap[itemFileName] = struct{}{}
+ listFile = append(listFile, itemFileName)
+ }
}
- sort.Slice(files, func(i, j int) bool {
- return files[i] > files[j]
+ if len(listFile) < 2 {
+ return listFile, nil
+ }
+ sort.Slice(listFile, func(i, j int) bool {
+ return listFile[i] > listFile[j]
})
- return files, nil
+ return listFile, nil
}
func (u *LogService) LoadSystemLog(name string) (string, error) {
diff --git a/core/cmd/server/conf/app.yaml b/core/cmd/server/conf/app.yaml
index ec5b0d326..6c6977682 100644
--- a/core/cmd/server/conf/app.yaml
+++ b/core/cmd/server/conf/app.yaml
@@ -16,6 +16,6 @@ remote_url:
log:
level: debug
time_zone: Asia/Shanghai
- log_name: 1Panel
+ log_name: 1Panel-Core
log_suffix: .log
max_backup: 10
\ No newline at end of file
diff --git a/frontend/src/components/system-upgrade/index.vue b/frontend/src/components/system-upgrade/index.vue
index 1a13ae33e..8b9793452 100644
--- a/frontend/src/components/system-upgrade/index.vue
+++ b/frontend/src/components/system-upgrade/index.vue
@@ -108,15 +108,10 @@ const onLoadUpgradeInfo = async () => {
upgradeInfo.value = res.data;
if (upgradeInfo.value.newVersion) {
upgradeVersion.value = upgradeInfo.value.newVersion;
- return;
- }
- if (upgradeInfo.value.latestVersion) {
+ } else if (upgradeInfo.value.latestVersion) {
upgradeVersion.value = upgradeInfo.value.latestVersion;
- return;
- }
- if (upgradeInfo.value.testVersion) {
+ } else if (upgradeInfo.value.testVersion) {
upgradeVersion.value = upgradeInfo.value.testVersion;
- return;
}
upgradeRef.value.acceptParams({ upgradeInfo: upgradeInfo.value, upgradeVersion: upgradeVersion.value });
} else {
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 5b96700a4..5d37792c2 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -1253,6 +1253,8 @@ const message = {
},
},
logs: {
+ core: 'Panel Service',
+ agent: 'Node Monitoring',
panelLog: 'Panel Logs',
operation: 'Operation Logs',
login: 'Login Logs',
diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts
index 0ae095528..4fe143b80 100644
--- a/frontend/src/lang/modules/ja.ts
+++ b/frontend/src/lang/modules/ja.ts
@@ -1190,6 +1190,8 @@ const message = {
},
},
logs: {
+ core: 'パネルサービス',
+ agent: 'ノード監視',
panelLog: 'パネルログ',
operation: '操作ログ',
login: 'ログインログ',
diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts
index 29c888606..22e6875c0 100644
--- a/frontend/src/lang/modules/ko.ts
+++ b/frontend/src/lang/modules/ko.ts
@@ -1178,6 +1178,8 @@ const message = {
},
},
logs: {
+ core: '패널 서비스',
+ agent: '노드 모니터링',
panelLog: '패널 로그',
operation: '작업 로그',
login: '로그인 로그',
diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts
index 93adac56c..1968b39bf 100644
--- a/frontend/src/lang/modules/ms.ts
+++ b/frontend/src/lang/modules/ms.ts
@@ -1233,6 +1233,8 @@ const message = {
},
},
logs: {
+ core: 'Perkhidmatan Panel',
+ agent: 'Pemantauan Nod',
panelLog: 'Log Panel',
operation: 'Log Operasi',
login: 'Log Masuk',
diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts
index a59cfd3ce..56582ed4e 100644
--- a/frontend/src/lang/modules/pt-br.ts
+++ b/frontend/src/lang/modules/pt-br.ts
@@ -1216,6 +1216,8 @@ const message = {
alertTitle: 'Tarefa de scan de vírus 「{0}」 detectou alerta de arquivo infectado',
},
logs: {
+ core: 'Serviço de Painel',
+ agent: 'Monitoramento de Nós',
panelLog: 'Logs do painel',
operation: 'Logs de operação',
login: 'Logs de login',
diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts
index 5c5121c3c..a1ce45b1d 100644
--- a/frontend/src/lang/modules/ru.ts
+++ b/frontend/src/lang/modules/ru.ts
@@ -1224,6 +1224,8 @@ const message = {
},
},
logs: {
+ core: 'Сервис панели',
+ agent: 'Мониторинг узлов',
panelLog: 'Логи панели',
operation: 'Логи операций',
login: 'Логи входа',
diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts
index 3d88002d0..e7a39749d 100644
--- a/frontend/src/lang/modules/zh-Hant.ts
+++ b/frontend/src/lang/modules/zh-Hant.ts
@@ -1183,6 +1183,8 @@ const message = {
},
},
logs: {
+ core: '面板服務',
+ agent: '節點監控',
panelLog: '面板日誌',
operation: '操作日誌',
login: '訪問日誌',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index 6a9cd998e..60520fe51 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -1181,6 +1181,8 @@ const message = {
},
},
logs: {
+ core: '面板服务',
+ agent: '节点监控',
panelLog: '面板日志',
operation: '操作日志',
login: '访问日志',
diff --git a/frontend/src/views/log/system/index.vue b/frontend/src/views/log/system/index.vue
index d70a82760..0a9a648bb 100644
--- a/frontend/src/views/log/system/index.vue
+++ b/frontend/src/views/log/system/index.vue
@@ -5,7 +5,7 @@
-
+
{{ $t('commons.table.date') }}
@@ -14,6 +14,10 @@
{{ $t('commons.button.watch') }}
+
+
+
+
{
logRef.value.changeTail(true);
@@ -57,12 +63,13 @@ const loadFiles = async () => {
const res = await getSystemFiles();
fileList.value = res.data || [];
if (fileList.value) {
- logConfig.name = fileList.value[0];
+ itemName.value = fileList.value[0];
search();
}
};
const search = () => {
+ logConfig.name = itemType.value === 'Agent' ? itemName.value : 'Core-' + itemName.value;
showLog.value = false;
nextTick(() => {
showLog.value = true;