mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-17 21:08:25 +08:00
support php slow log (#10596)
Refs https://github.com/1Panel-dev/1Panel/issues/9467
This commit is contained in:
parent
a5fbd01ea5
commit
02c002bda6
4 changed files with 30 additions and 0 deletions
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@
|
|||
<el-tab-pane :label="$t('runtime.loadStatus')" name="7">
|
||||
<FpmStatus :id="runtime.id" v-if="index == '7'"></FpmStatus>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('database.slowLog')" name="9">
|
||||
<SlowLog :id="runtime.id" v-if="index == '9'"></SlowLog>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('website.source')" name="4">
|
||||
<PHP :id="runtime.id" v-if="index == '4'" :type="'php'"></PHP>
|
||||
</el-tab-pane>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<template>
|
||||
<LogFile :config="logConfig"></LogFile>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import LogFile from '@/components/log/file/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
id: Number,
|
||||
});
|
||||
|
||||
const logConfig = reactive({
|
||||
id: props.id,
|
||||
type: 'php-fpm-slow-logs',
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Reference in a new issue