Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log enhancements #5913

Open
surapuramakhil opened this issue Jan 20, 2025 · 1 comment · May be fixed by #5920
Open

Log enhancements #5913

surapuramakhil opened this issue Jan 20, 2025 · 1 comment · May be fixed by #5920
Labels
2. developing Work in progress bug Something isn't working
Milestone

Comments

@surapuramakhil
Copy link

Is your feature request related to a problem? Please describe.

These are my extreme pain points when I am trying to debug issue, which could have saved my hours of time if this way.

when I try to debug when something is broken - I get log truncated

Message: Could not start container nextcloud-aio-apache: Server error: `POST http://127.0.0.1/v1.41/containers/nextcloud-aio-apache/start` resulted in a `500 Internal Server Error` response:
{"message":"driver failed programming external connectivity on endpoint nextcloud-aio-apache (7733db1eb7f1a2679e44dda426 (truncated...)

I am also clueless from there this log is coming from, request update format containing this information

[Mon Jan 20 01:42:28.252459 2025] [mpm_event:notice] [pid 170:tid 170] AH00489: Apache/2.4.62 (Unix) OpenSSL/3.3.2 configured -- resuming normal operations
[Mon Jan 20 01:42:28.252480 2025] [core:notice] [pid 170:tid 170] AH00094: Command line: 'httpd -D FOREGROUND'
[20-Jan-2025 01:42:28] NOTICE: fpm is running, pid 175
[20-Jan-2025 01:42:28] NOTICE: ready to handle connections
{"level":"info","ts":1737337348.2602246,"msg":"using config from file","file":"/Caddyfile"}
{"level":"info","ts":1737337348.2609,"msg":"adapted config to JSON","adapter":"caddyfile"}
Deleting duplicate sessions
NOTICE: PHP message: Slim Application Error
Type: Exception
Code: 0
Message: Could not start container nextcloud-aio-apache: Server error: `POST http://127.0.0.1/v1.41/containers/nextcloud-aio-apache/start` resulted in a `500 Internal Server Error` response:
{"message":"driver failed programming external connectivity on endpoint nextcloud-aio-apache (7733db1eb7f1a2679e44dda426 (truncated...)

for these code - adding stack trace - information

try {
$this->PerformRecursiveContainerStart($id);
} catch (\Exception $e) {
error_log('Could not start domaincheck container: ' . $e->getMessage());
}

to

        try {
            $this->PerformRecursiveContainerStart($id);
        } catch (\Exception $e) {
            error_log('Could not start domaincheck container: ' . $e->getMessage() . "\n" . $e->getTraceAsString());
        }

Describe the solution you'd like

improve log message format - including

for truncated issue - TBH I don't know fix.

for having where log in coming form

update

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
ErrorLog /proc/self/fd/2
ErrorLogFormat "[%t] [%l] [%E] [client: %{X-Forwarded-For}i] [%M] [%{User-Agent}i]"

to

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" [source: php/apache]" proxy
......
ErrorLogFormat "[%t] [%l] [%E] [client: %{X-Forwarded-For}i] [%M] [%{User-Agent}i] [source: php/apache]"

Describe alternatives you've considered

grep log message, try to find from where this log would have come from.

Additional context

@surapuramakhil surapuramakhil added the 0. Needs triage Pending approval or rejection. This issue is pending approval. label Jan 20, 2025
@szaimen szaimen linked a pull request Jan 20, 2025 that will close this issue
@szaimen
Copy link
Collaborator

szaimen commented Jan 20, 2025

Hi, thanks for the report!

I already tried to improve the logging in the past multiple times. Unfortunately afaik, the slim framework that we are using is truncating the logs without an option to overwrite this. So it will be improved with a hack: #5920

@szaimen szaimen added 2. developing Work in progress bug Something isn't working and removed 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Jan 20, 2025
@szaimen szaimen added this to the next milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants