From 02c002bda66c9173f15157240c79c0a7d5d12a61 Mon Sep 17 00:00:00 2001
From: CityFun <31820853+zhengkunwang223@users.noreply.github.com>
Date: Fri, 10 Oct 2025 17:23:25 +0800
Subject: [PATCH] support php slow log (#10596)
Refs https://github.com/1Panel-dev/1Panel/issues/9467
---
agent/app/model/runtime.go | 4 ++++
agent/app/service/file.go | 6 ++++++
.../views/website/runtime/php/config/index.vue | 4 ++++
.../runtime/php/config/slow-log/index.vue | 16 ++++++++++++++++
4 files changed, 30 insertions(+)
create mode 100644 frontend/src/views/website/runtime/php/config/slow-log/index.vue
diff --git a/agent/app/model/runtime.go b/agent/app/model/runtime.go
index 510fe94e7..f32ce315b 100644
--- a/agent/app/model/runtime.go
+++ b/agent/app/model/runtime.go
@@ -49,3 +49,7 @@ func (r *Runtime) GetPHPPath() string {
func (r *Runtime) GetLogPath() string {
return path.Join(r.GetPath(), "build.log")
}
+
+func (r *Runtime) GetSlowLogPath() string {
+ return path.Join(r.GetPath(), "log", "fpm.slow.log")
+}
diff --git a/agent/app/service/file.go b/agent/app/service/file.go
index 251ec5b2b..06f40fd55 100644
--- a/agent/app/service/file.go
+++ b/agent/app/service/file.go
@@ -560,6 +560,12 @@ func (f *FileService) ReadLogByLine(req request.FileReadByLineReq) (*response.Fi
logFilePath = path.Join(global.Dir.DataDir, fmt.Sprintf("apps/mysql/%s/data/1Panel-slow.log", req.Name))
case "mariadb-slow-logs":
logFilePath = path.Join(global.Dir.DataDir, fmt.Sprintf("apps/mariadb/%s/db/data/1Panel-slow.log", req.Name))
+ case "php-fpm-slow-logs":
+ php, err := runtimeRepo.GetFirst(context.Background(), repo.WithByID(req.ID))
+ if err != nil {
+ return nil, err
+ }
+ logFilePath = php.GetSlowLogPath()
}
file, err := os.Open(logFilePath)
diff --git a/frontend/src/views/website/runtime/php/config/index.vue b/frontend/src/views/website/runtime/php/config/index.vue
index 64ecea5d8..4e6dbdb89 100644
--- a/frontend/src/views/website/runtime/php/config/index.vue
+++ b/frontend/src/views/website/runtime/php/config/index.vue
@@ -29,6 +29,9 @@
+
+
+
@@ -51,6 +54,7 @@ import Performance from './performance/index.vue';
import Container from './container/index.vue';
import FpmStatus from './fpm-status/index.vue';
import Timeout from './timeout/index.vue';
+import SlowLog from './slow-log/index.vue';
const index = ref('6');
const open = ref(false);
diff --git a/frontend/src/views/website/runtime/php/config/slow-log/index.vue b/frontend/src/views/website/runtime/php/config/slow-log/index.vue
new file mode 100644
index 000000000..b8aac14cf
--- /dev/null
+++ b/frontend/src/views/website/runtime/php/config/slow-log/index.vue
@@ -0,0 +1,16 @@
+
+
+
+
+