@@ -128,6 +128,17 @@ func GetAccessLogPath() (path string) {
128
128
match := r .FindStringSubmatch (out )
129
129
if len (match ) > 1 {
130
130
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
+ }
131
142
}
132
143
if path == "" {
133
144
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 {
148
159
match := r .FindStringSubmatch (out )
149
160
if len (match ) > 1 {
150
161
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
+ }
151
173
}
152
174
if path == "" {
153
175
logger .Debug ("error log path not found in nginx -V output, try to get from nginx -T output" )
0 commit comments