nextcloud/logreader

Error while opening /dev/stdout

myxor opened this issue · 1 comments

Steps to reproduce

  1. Use Nextcloud FPM docker container image
  2. Configure 'logfile' => '/dev/stdout',
  3. Open Log in administrator settings, see empty log and HTTP Status 500 for apps/logreader/api/poll?lastReqId= request in browser console

Expected behaviour

Log should be filled with log entries

Actual behaviour

Log stays empty and i see this in docker logs:

NOTICE: PHP message: {"reqId":"hjr6qSydnYtY9pfRvwuj","level":3,"time":"2024-04-16T12:08:16+00:00","remoteAddr":"62.214.75.82","user":"marco","app":"index","method":"GET","url":"/apps/logreader/api/poll?lastReqId=","message":"Error while opening /dev/stdout","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Error while opening /dev/stdout","Code":0,"Trace":[{"file":"/var/www/html/apps/logreader/lib/Controller/LogController.php","line":83,"function":"getLogIterator","class":"OCA\\LogReader\\Log\\LogIteratorFactory","type":"->","args":[[0,1,2,3,4]]},{"file":"/var/www/html/apps/logreader/lib/Controller/LogController.php","line":110,"function":"getLastItem","class":"OCA\\LogReader\\Controller\\LogController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"poll","class":"OCA\\LogReader\\Controller\\LogController","type":"->","args":[""]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\LogReader\\Controller\\LogController"],"poll"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\LogReader\\Controller\\LogController"],"poll"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\LogReader\\Controller\\LogController","poll",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["logreader.log.poll"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/logreader/api/poll"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/apps/logreader/lib/Log/LogIteratorFactory.php","Line":58,"message":"Error while opening /dev/stdout","exception":{},"CustomMessage":"Error while opening /dev/stdout"}}

Server configuration

Official Nextcloud FPM docker image

Database:
Postgresql

PHP version:
8.2.18

Nextcloud version: (see Nextcloud admin page)

Where did you install Nextcloud from:
Official Nextcloud FPM docker image

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder
  • activity: 2.20.0
  • apporder: 0.15.0
  • bookmarks: 13.1.3
  • bruteforcesettings: 2.8.0
  • calendar: 4.6.7
  • cloud_federation_api: 1.11.0
  • contacts: 5.5.3
  • contactsinteraction: 1.9.0
  • cookbook: 0.11.0
  • cospend: 1.6.1
  • dashboard: 7.8.0
  • dav: 1.29.1
  • federatedfilesharing: 1.18.0
  • federation: 1.18.0
  • files: 2.0.0
  • files_external: 1.20.0
  • files_markdown: 2.4.1
  • files_pdfviewer: 2.9.0
  • files_reminders: 1.1.0
  • files_sharing: 1.20.0
  • files_trashbin: 1.18.0
  • files_versions: 1.21.0
  • gpoddersync: 3.8.3
  • health: 2.2.2
  • logreader: 2.13.0
  • lookup_server_connector: 1.16.0
  • music: 1.10.0
  • news: 25.0.0-alpha4
  • notes: 4.9.4
  • notifications: 2.16.0
  • oauth2: 1.16.3
  • password_policy: 1.18.0
  • phonetrack: 0.7.7
  • photos: 2.4.0
  • previewgenerator: 5.5.0
  • provisioning_api: 1.18.0
  • related_resources: 1.3.0
  • serverinfo: 1.18.0
  • settings: 1.10.1
  • survey_client: 1.16.0
  • tasks: 0.15.0
  • text: 3.9.1
  • theming: 2.3.0
  • twofactor_backupcodes: 1.17.0
  • viewer: 2.2.0
  • weather_status: 1.8.0
  • workflowengine: 2.10.0

Nextcloud configuration:

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.1.11",
            "cloud.marcoheiming.de",
            "192.168.1.2"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "28.0.4.1",
        "overwrite.cli.url": "https:\/\/cloud.marcoheiming.de",
        "overwritehost": "cloud.marcoheiming.de",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 1,
        "logfile": "\/dev\/stdout",
        "maintenance": false,
        "overwriteprotocol": "https",
        "mail_smtpauth": 1,
        "check_data_directory_permissions": false,
        "app_install_overwrite": [
            "keeporsweep",
            "apporder",
            "news",
            "files_markdown"
        ],
        "theme": "",
        "default_phone_region": "DE",
        "preview_max_x": "512",
        "preview_max_y": "512",
        "jpeg_quality": {
            "occ": {
                "config:app:set": {
                    "preview": {
                        "jpeg_quality": "60"
                    }
                }
            }
        }
    }
}

Client configuration

Browser:

Operating system:

Logs

Nextcloud log (data/owncloud.log)

NOTICE: PHP message: {"reqId":"tynzh2mm5bakBwyJHpYe","level":3,"time":"2024-04-16T12:15:57+00:00","remoteAddr":"XXX","user":"marco","app":"PHP","method":"GET","url":"/apps/logreader/api/poll?lastReqId=","message":"fopen(/dev/stdout): Failed to open stream: No such file or directory at /var/www/html/apps/logreader/lib/Log/LogIteratorFactory.php#51","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0","version":"28.0.4.1","data":{"app":"PHP"}}


NOTICE: PHP message: {"reqId":"tynzh2mm5bakBwyJHpYe","level":3,"time":"2024-04-16T12:15:57+00:00","remoteAddr":"XXX","user":"marco","app":"index","method":"GET","url":"/apps/logreader/api/poll?lastReqId=","message":"Error while opening /dev/stdout","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0","version":"28.0.4.1","exception":{"Exception":"Exception","Message":"Error while opening /dev/stdout","Code":0,"Trace":[{"file":"/var/www/html/apps/logreader/lib/Controller/LogController.php","line":83,"function":"getLogIterator","class":"OCA\\LogReader\\Log\\LogIteratorFactory","type":"->","args":[[0,1,2,3,4]]},{"file":"/var/www/html/apps/logreader/lib/Controller/LogController.php","line":110,"function":"getLastItem","class":"OCA\\LogReader\\Controller\\LogController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"poll","class":"OCA\\LogReader\\Controller\\LogController","type":"->","args":[""]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\LogReader\\Controller\\LogController"],"poll"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\LogReader\\Controller\\LogController"],"poll"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\LogReader\\Controller\\LogController","poll",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["logreader.log.poll"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/logreader/api/poll"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/apps/logreader/lib/Log/LogIteratorFactory.php","Line":58,"message":"Error while opening /dev/stdout","exception":{},"CustomMessage":"Error while opening /dev/stdout"}}

Browser log

From browser console:

XHRGET
https://NEXTCLOUD_URL/apps/logreader/api/poll?lastReqId=
[HTTP/2 500  256ms]

[WARN] logreader: Unexpected error while polling for new log entries 
Object { app: "logreader", level: 1, error: {…} }
​
app: "logreader"
​
error: Object { stack: "ge@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:153625\nwv@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:164964\nm@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:168156\nEventHandlerNonNull*Pv</<@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:168228\nPv<@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:167133\ni1@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:170929\nrequest@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:174594\nv0.prototype[e]@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:174899\na4/<@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:148348\nf1@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:193078\nm@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:421878\nsetTimeout handler*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\nasync*m@https://NEXTCLOUD_URL/apps/logreader/js/logreader-main.mjs?v=7b303b73-14:2:422219\n", message: "Request failed with status code 500", name: "AxiosError", … }
​

After opening this issue i found the solution myself.

Thanks to this comment nextcloud/docker#2119 (comment) i found this in the Nextcloud administrator manual: https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html#log-type:

I needed to change the Nextcloud config log settings to:

  'log_type' => 'file',
  'logfile' => 'syslog',

Now the log is inside the container and in Nextcloud logreader.

Closing this issue.