@@ -128,6 +128,17 @@ func GetAccessLogPath() (path string) {
128128 match := r .FindStringSubmatch (out )
129129 if len (match ) > 1 {
130130 path = match [1 ]
131+ resolvedPath := resolvePath (path )
132+
133+ // Check if the matched path exists but is not a regular file
134+ if ! isValidRegularFile (resolvedPath ) {
135+ logger .Debug ("access log path from nginx -V exists but is not a regular file, try to get from nginx -T output" , "path" , resolvedPath )
136+ fallbackPath := getAccessLogPathFromNginxT ()
137+ if fallbackPath != "" {
138+ path = fallbackPath
139+ return path // Already resolved in getAccessLogPathFromNginxT
140+ }
141+ }
131142 }
132143 if path == "" {
133144 logger .Debug ("access log path not found in nginx -V output, try to get from nginx -T output" )
@@ -148,6 +159,17 @@ func GetErrorLogPath() string {
148159 match := r .FindStringSubmatch (out )
149160 if len (match ) > 1 {
150161 path = match [1 ]
162+ resolvedPath := resolvePath (path )
163+
164+ // Check if the matched path exists but is not a regular file
165+ if ! isValidRegularFile (resolvedPath ) {
166+ logger .Debug ("error log path from nginx -V exists but is not a regular file, try to get from nginx -T output" , "path" , resolvedPath )
167+ fallbackPath := getErrorLogPathFromNginxT ()
168+ if fallbackPath != "" {
169+ path = fallbackPath
170+ return path // Already resolved in getErrorLogPathFromNginxT
171+ }
172+ }
151173 }
152174 if path == "" {
153175 logger .Debug ("error log path not found in nginx -V output, try to get from nginx -T output" )
0 commit comments