package v1 import "github.com/gogf/gf/v2/frame/g" // LogFile describes one server log file. type LogFile struct { Name string `json:"name"` // file name Path string `json:"path"` // path relative to the log dir Size int64 `json:"size"` // bytes ModTime string `json:"modTime"` // 2006-01-02 15:04:05 } // LogFilesReq lists the server log files. type LogFilesReq struct { g.Meta `path:"/log/files" method:"get" tags:"Admin/Log" summary:"List server log files"` } // LogFilesRes is the response of LogFilesReq. type LogFilesRes struct { Dir string `json:"dir"` Files []*LogFile `json:"files"` } // LogTailReq reads the tail of a log file with optional keyword filter. type LogTailReq struct { g.Meta `path:"/log/tail" method:"get" tags:"Admin/Log" summary:"Tail a server log file"` File string `json:"file" v:"required#file required"` // relative to the log dir; path traversal is rejected Lines int `json:"lines" d:"200" v:"min:1|max:2000"` Keyword string `json:"keyword"` // substring filter } // LogTailRes is the response of LogTailReq. type LogTailRes struct { Lines []string `json:"lines"` }