nextcloud / logreader

📜 Log reader for Nextcloud
56 stars 27 forks source link

[Bug]: NC28 syntax error accessing /settings/admin/logging #1073

Closed cvandesande closed 7 months ago

cvandesande commented 7 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

After upgrading to NC28, I get 500 errors accessing the settings/admin/logging page The logs indicate a syntax error image

{
  "reqId": "BtIhSHTQ29Hjm39tZCnW",
  "level": 0,
  "time": "2023-12-12T16:15:40+00:00",
  "remoteAddr": "192.168.9.3",
  "user": "cvandesande",
  "app": "PHP",
  "method": "GET",
  "url": "/settings/admin/logging",
  "message": "Creation of dynamic property OCA\\FirstRunWizard\\Settings\\Personal::$urlGenerator is deprecated at /usr/share/nginx/html/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0",
  "version": "28.0.0.11",
  "data": {
    "app": "PHP"
  }
}
{
  "reqId": "BtIhSHTQ29Hjm39tZCnW",
  "level": 3,
  "time": "2023-12-12T16:15:40+00:00",
  "remoteAddr": "192.168.9.3",
  "user": "cvandesande",
  "app": "index",
  "method": "GET",
  "url": "/settings/admin/logging",
  "message": "Syntax error",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0",
  "version": "28.0.0.11",
  "exception": {
    "Exception": "JsonException",
    "Message": "Syntax error",
    "Code": 4,
    "Trace": [
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/logreader/lib/Service/SettingsService.php",
        "line": 52,
        "function": "json_decode",
        "args": [
          "",
          null,
          512,
          4194304
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/logreader/lib/Service/SettingsService.php",
        "line": 69,
        "function": "getRelativeDates",
        "class": "OCA\\LogReader\\Service\\SettingsService",
        "type": "->",
        "args": []
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/logreader/lib/Settings/Admin.php",
        "line": 46,
        "function": "getAppSettings",
        "class": "OCA\\LogReader\\Service\\SettingsService",
        "type": "->",
        "args": []
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php",
        "line": 129,
        "function": "getForm",
        "class": "OCA\\LogReader\\Settings\\Admin",
        "type": "->",
        "args": []
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php",
        "line": 86,
        "function": "formatSettings",
        "class": "OCA\\Settings\\Controller\\AdminSettingsController",
        "type": "->",
        "args": [
          [
            [
              [
                "OCA\\LogReader\\Settings\\Admin"
              ]
            ]
          ]
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php",
        "line": 149,
        "function": "getSettings",
        "class": "OCA\\Settings\\Controller\\AdminSettingsController",
        "type": "->",
        "args": [
          "logging"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php",
        "line": 71,
        "function": "getIndexResponse",
        "class": "OCA\\Settings\\Controller\\AdminSettingsController",
        "type": "->",
        "args": [
          "admin",
          "logging"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "index",
        "class": "OCA\\Settings\\Controller\\AdminSettingsController",
        "type": "->",
        "args": [
          "logging"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Settings\\Controller\\AdminSettingsController"
          ],
          "index"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Settings\\Controller\\AdminSettingsController"
          ],
          "index"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Settings\\Controller\\AdminSettingsController",
          "index",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "logging",
            "settings.AdminSettings.index"
          ]
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/settings/admin/logging"
        ]
      },
      {
        "file": "/usr/share/nginx/html/nextcloud/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/usr/share/nginx/html/nextcloud/apps/logreader/lib/Service/SettingsService.php",
    "Line": 52,
    "message": "Syntax error",
    "exception": {},
    "CustomMessage": "Syntax error"
  }
}

Steps to reproduce

  1. Upgrade to NC28
  2. Add missing DB indexes (May not be required, but were my steps)
  3. Access logging page

Expected behavior

View logs

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

None

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{ig:list systemoud-7788dcd7bf-6rgmb:/usr/share/nginx/html/nextcloud$ php occ conf
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": ["***REMOVED SENSITIVE VALUE***"],
        "apps_paths": [
            {
                "path": "\/usr\/share\/nginx\/html\/nextcloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/usr\/share\/nginx\/html\/nextcloud\/custom-apps",
                "url": "\/custom-apps",
                "writable": true
            }
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "28.0.0.11",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR",
            "HTTP_X_FORWARDED",
            "HTTP_FORWARDED_FOR"
        ],
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "loglevel": 0,
        "maintenance": false,
        "enable_previews": false,
        "secret": "***REMOVED SENSITIVE VALUE***",
        "filesystem_check_changes": 1,
        "filelocking.enabled": "true",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "dbindex": 0
        },
        "trashbin_retention_obligation": "auto",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpsecure": "ssl",
        "theme": "",
        "app_install_overwrite": [
            "joplin"
        ],
        "encryption.legacy_format_support": false,
        "encryption.key_storage_migrated": false,
        "default_language": "en",
        "default_phone_region": "CA"
    }
}

List of activated Apps

Enabled:
  - activity: 2.20.0
  - admin_audit: 1.18.0
  - bruteforcesettings: 2.8.0
  - calendar: 4.6.0
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.0
  - contactsinteraction: 1.9.0
  - dav: 1.29.1
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notes: 4.9.0
  - notifications: 2.16.0
  - notify_push: 0.6.5
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.0
  - sharebymail: 1.18.0
  - support: 1.11.0
  - survey_client: 1.16.0
  - suspicious_login: 6.0.0
  - systemtags: 1.18.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - twofactor_nextcloud_notification: 3.8.0
  - twofactor_totp: 10.0.0-beta.2
  - updatenotification: 1.18.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - circles: 28.0.0-dev (installed 0.15.2)
  - dashboard: 7.8.0 (installed 7.0.0)
  - encryption: 2.16.0 (installed 2.5.0)
  - files_external: 1.20.0 (installed 1.4.1)
  - files_pdfviewer: 2.9.0 (installed 1.2.1)
  - files_rightclick: 0.15.1 (installed 1.4.0)
  - photos: 2.4.0 (installed 1.3.0)
  - user_ldap: 1.19.0

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

magnus-score commented 7 months ago

Hi, try to restart php-fpm.service

cvandesande commented 7 months ago

Hi! The issue continues after restarting both nginx & php-fpm

cvandesande commented 7 months ago

I just noticed my issue appears to be with the logreader app, and this is a duplicate of https://github.com/nextcloud/logreader/issues/1064

stefanbenten commented 7 months ago

I am running into the same issue after the upgrade to 28.0.0.11. Restarted both PHP-FPM (8.2) and webserver and issue is still persistent. All other functionality looks to be ok.

hunter-nl commented 7 months ago

I am running into the same issue after the upgrade to 28.0.0.11

masterwishx commented 7 months ago

Have same issue , using linuxserver container 28.0.0-ls290 Logging and activity blank page :

image image

tzerber commented 7 months ago

I can confirm i have the same issue, fresh install via docker , fpm image.

peacepenguin commented 7 months ago

exact same issue here. after updating nextcloud to v28, error 500, same syntax error in logs.

joshtrichards commented 7 months ago

A workaround while #1075 is pending is the following:

./occ config:app:set logreader relativedates --value="false"
MP715 commented 7 months ago

I’m also experiencing the same issue, but along with Logging, Activity is blank too. Also, there are missing settings under Notification. The workaround above didn't work for me.

spitzlei commented 7 months ago

I’m also experiencing the same issue, but along with Logging, Activity is blank too. Also, there are missing settings under Notification. The workaround above didn't work for me.

The empty activity and logging is related to the fpm/nginx setup. I had that too and its because *.mjs is delivered as octet/stream instead of application/javascipt (and being blocked by the browser then). I've added mjs to the mime.types in nginx folder and activity + and logging is showing up again.

JappeHallunken commented 7 months ago

I run my nextcloud on LIGHTTPD and I just get an error message in top right corner: Could not load log entries

cvandesande commented 7 months ago

The empty activity and logging is related to the fpm/nginx setup. I had that too and its because *.mjs is delivered as octet/stream instead of application/javascipt (and being blocked by the browser then). I've added mjs to the mime.types in nginx folder and activity + and logging is showing up again.

Just to tack onto this very helpful comment, to fix the Activity stream by adding mjs to mime.types involved adding a new types block. (At least that was the case for me). My config below

http {
    include /etc/nginx/mime.types;
    types {
        application/javascript js mjs;
    }
    default_type  application/octet-stream;
...
tzerber commented 7 months ago

The empty activity and logging is related to the fpm/nginx setup. I had that too and its because *.mjs is delivered as octet/stream instead of application/javascipt (and being blocked by the browser then). I've added mjs to the mime.types in nginx folder and activity + and logging is showing up again.

Just to tack onto this very helpful comment, to fix the Activity stream by adding mjs to mime.types involved adding a new types block. (At least that was the case for me). My config below

http {
    include /etc/nginx/mime.types;
    types {
        application/javascript js mjs;
     }
    default_type  application/octet-stream;
...

Works like a charm, thank you!

Xav-Pe commented 7 months ago

Same error after upgrade from 27 to 28 with the latest docker image (28.0.0)

Server configuration detail

Operating system: Linux 5.10.0-26-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64

Webserver: Apache/2.4.57 (Debian) (apache2handler)

Database: mysql 10.7.8

PHP version: 8.2.13

Modules loaded: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, session, PDO, pdo_sqlite, standard, posix, random, Reflection, Phar, SimpleXML, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, apcu, bcmath, exif, gd, gmp, imagick, intl, ldap, memcached, pcntl, pdo_mysql, pdo_pgsql, redis, sodium, sysvsem, zip, Zend OPcache

Nextcloud version: 28.0.0 - 28.0.0.11

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: unknown

<details><summary>Signing status</summary>

[]
</details>

<details><summary>List of activated apps</summary>

Enabled:
 - activity: 2.20.0
 - circles: 28.0.0-dev
 - cloud_federation_api: 1.11.0
 - comments: 1.18.0
 - contactsinteraction: 1.9.0
 - 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_pdfviewer: 2.9.0
 - files_reminders: 1.1.0
 - files_sharing: 1.20.0
 - files_trashbin: 1.18.0
 - files_versions: 1.21.0
 - firstrunwizard: 2.17.0
 - logreader: 2.13.0
 - lookup_server_connector: 1.16.0
 - nextcloud_announcements: 1.17.0
 - notes: 4.9.0
 - notifications: 2.16.0
 - oauth2: 1.16.3
 - password_policy: 1.18.0
 - photos: 2.4.0
 - privacy: 1.12.0
 - provisioning_api: 1.18.0
 - recommendations: 2.0.0
 - related_resources: 1.3.0
 - serverinfo: 1.18.0
 - settings: 1.10.0
 - sharebymail: 1.18.0
 - support: 1.11.0
 - survey_client: 1.16.0
 - systemtags: 1.18.0
 - text: 3.9.1
 - theming: 2.3.0
 - twofactor_backupcodes: 1.17.0
 - updatenotification: 1.18.0
 - user_status: 1.8.1
 - viewer: 2.2.0
 - weather_status: 1.8.0
 - workflowengine: 2.10.0
Disabled:
 - admin_audit
 - bruteforcesettings: 1.6.0
 - encryption
 - files_rightclick: 1.6.0
 - nextbackup: 21.1.0
 - suspicious_login
 - twofactor_totp
 - user_ldap

</details>

<details><summary>Configuration (config/config.php)</summary>

{
    "htaccess.RewriteBase": "\/",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "filelocking.enabled": true,
    "memcache.locking": "\\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
        }
    ],
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "nextcloud.mydomain"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "28.0.0.11",
    "overwrite.cli.url": "http:\/\/nextcloud.mydomain",
    "overwriteprotocol": "https",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "theme": "",
    "loglevel": 2,
    "default_phone_region": "FR",
    "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
    "maintenance": false,
    "config_is_read_only": false,
    "trashbin_retention_obligation": "15,30",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpmode": "smtp",
    "mail_sendmailmode": "smtp",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "587",
    "mail_smtpauth": 1,
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
}

</details>

Cron Configuration: Array
(
[backgroundjobs_mode] => cron
[lastcron] => 1702564501
)

External storages: yes

<details><summary>External storage configuration</summary>

No mounts configured

</details>

Encryption: no

User-backends:

OC\User\Database

Browser: Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0
susnux commented 7 months ago

The empty activity and logging is related to the fpm/nginx setup. I had that too and its because *.mjs is delivered as octet/stream instead of application/javascipt (and being blocked by the browser then). I've added mjs to the mime.types in nginx folder and activity + and logging is showing up again.

This is part of the upgrade guide since Nextcloud 27: 1: https://docs.nextcloud.com/server/27/admin_manual/installation/nginx.html 2: https://docs.nextcloud.com/server/27/admin_manual/release_notes/upgrade_to_27.html?highlight=mjs#web-server-configuration

susnux commented 7 months ago

A fix will be released with Nextcloud 28.0.1, until then use the workaround from https://github.com/nextcloud/logreader/issues/1073#issuecomment-1854809916

masterwishx commented 7 months ago

A workaround while #1075 is pending is the following:

./occ config:app:set logreader relativedates --value="false"

not worked for me

cvandesande commented 7 months ago

A fix will be released with Nextcloud 28.0.1, until then use the workaround from #1073 (comment)

Setting the logreader config value to false resolves the 500 error, but now I have a new issue with the logs image

In the web console I get the following error:

[DEBUG] logreader: Unexpected AxiosError "Network Error"

Stack trace:
Ae@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:153625
Pv</</c.onerror@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:168487
EventHandlerNonNull*Pv</<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:168464
Pv<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:167133
i1@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:170929
request@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:174594
v0.prototype[e]@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:174899
a4/<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:148348
E1@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:193012
o@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:408878
r4/_/<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:146243
setup/<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:1429772
zr@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:54856
tr@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:62613
insert@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:66059
M@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:86720
v2/<@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:88078
nR/e.prototype._update@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:60210
n@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:60957
e.prototype.get@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:57159
e@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:57076
aR@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:61060
fe.prototype.$mount@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:105209
IR/e.prototype._init@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:73101
fe@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:73793
@https://nextcloud.redacted.com/apps/logreader/js/logreader-main.mjs?v=7190dbd8-6:2:1432103

Object { app: "logreader", level: 0, error: {…} }
logreader-main.mjs:2:404207

After which my browser hangs and I'm forced to close to tab

@susnux Should I open a new issue?

tzerber commented 7 months ago

@cvandesande Your nginx conf is wrong, please see the links above. Nginx configuration changed since NC27 ;)

EDIT : Probably this

# Set the `immutable` cache control options only for assets with a cache busting `v` argument
map $arg_v $asset_immutable {
    "" "";
    default "immutable";
}

and this

   # Serve static files
    location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutable";
        access_log off;     # Optional: Don't log access to assets

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

is missing or is different in your config (like mine :D )

cvandesande commented 7 months ago

Thank you @tzerber I was missing those config blocks in NGINX. The logs now work in Chrome, but I still have the same error in Firefox :( (Even after clearing browser cache, and testing from a private window)

tzerber commented 7 months ago

Thank you @tzerber I was missing those config blocks in NGINX. The logs now work in Chrome, but I still have the same error in Firefox :( (Even after clearing browser cache, and testing from a private window)

Your activity app is probably working now too ;)

I am using latest Firefox, and after adjusting my config to the one from NC27's documentation (links above, here too https://docs.nextcloud.com/server/27/admin_manual/installation/nginx.html#nginx-config ) i have no noticeable problems. Some apps (unrelated to this logger sub-project) have problems with the missing bz2 extension and some Symphony framework stuff, but in general it works if you have the proper configuration for Nginx.

cvandesande commented 7 months ago

Yeah, the Activity app was already resolved, see my earlier comment. I should clarify, in Firefox I get the Could not load log entries error but it disappears after a few seconds, and the logs do appear after a few more seconds.

I still see

[DEBUG] logreader: Unexpected AxiosError "Network Error"

Error in the Firefox console. Do you get that error in the web console?

AmatorPhasma commented 7 months ago

Thank you @tzerber I was missing those config blocks in NGINX. The logs now work in Chrome, but I still have the same error in Firefox :( (Even after clearing browser cache, and testing from a private window)

if you use the Firefox with the "uBlock Origin" Addon, this was blocking a part at my end from the nextcloud logging page. err_ublock_nc_w_firefox

masterwishx commented 7 months ago

A workaround while #1075 is pending is the following:

./occ config:app:set logreader relativedates --value="false"

not worked for me

should we set back to "true" if this not helps and wait for update ?

./occ config:app:set logreader relativedates --value="true"
cvandesande commented 7 months ago

Thank you @tzerber I was missing those config blocks in NGINX. The logs now work in Chrome, but I still have the same error in Firefox :( (Even after clearing browser cache, and testing from a private window)

if you use the Firefox with the "uBlock Origin" Addon, this was blocking a part at my end from the nextcloud logging

Same here thanks @AmatorPhasma that resolves my final issue!

AmatorPhasma commented 7 months ago

@MP715

The empty activity and logging is related to the fpm/nginx setup. I had that too and its because *.mjs is delivered as octet/stream instead of application/javascipt (and being blocked by the browser then). I've added mjs to the mime.types in nginx folder and activity + and logging is showing up again.

Just to tack onto this very helpful comment, to fix the Activity stream by adding mjs to mime.types involved adding a new types block. (At least that was the case for me). My config below

http {
    include /etc/nginx/mime.types;
    types {
        application/javascript js mjs;
    }
    default_type  application/octet-stream;
...

Where do I add this snippet? My nextcloud config?

Depends on your config/style

You can put it in the /etc/nginx/nginx.conf by default this should the location of this tow lines:

http {
    ...
    include /etc/nginx/mime.types;
    default_type  application/octet-stream;
    ...
}

or you can add this to the config file in /etc/nginx/conf.d/nexctloud.conf:

server {
    server_name cloud.xxx.xxx;
    listen 8080;
    ...
    ...
    types {
        text/javascript js mjs;
    }
    ...
    ...
    location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutable";
        access_log off;     # Optional: Don't log access to assets

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }
    ...
    ...
}
tzerber commented 7 months ago

Just FYI: NC docs as well as https://www.ietf.org/rfc/rfc9239.pdf says it should be text/javascript not application/javascript, but that also creates other nginx problems. Working on it at the moment, but i suspect it also causes issues with some browsers.

gstrauss commented 7 months ago

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types lists .js and .mjs as text/javascript, with a link to RFC9239 Specifically, see https://www.rfc-editor.org/rfc/rfc9239#name-iana-considerations

Separately, lighttpd 1.4.71 and later provide a default set of mime types (include .js and .mjs) if mimetype.assign is not configured in lighttpd.conf, though most distro do provide mimetype.assign based off the system /etc/mime.types.

One more data point: on a modern Fedora system, .js and .mjs in /etc/mime.types are listed as text/javascript.

tzerber commented 7 months ago

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types lists .js and .mjs as text/javascript, with a link to RFC9239 Specifically, see https://www.rfc-editor.org/rfc/rfc9239#name-iana-considerations

Separately, lighttpd 1.4.71 and later provide a default set of mime types (include .js and .mjs) if mimetype.assign is not configured in lighttpd.conf, though most distro do provide mimetype.assign based off the system /etc/mime.types.

One more data point: on a modern Fedora system, .js and .mjs in /etc/mime.types are listed as text/javascript.

Just FYI, i don't think this issue is the place to discuss it ;) Read this nginx mailing archive and around it for more info

tmknight commented 7 months ago

A fix will be released with Nextcloud 28.0.1, until then use the workaround from #1073 (comment)

In my implementation (docker fpm) it was down to missing mjs config in nginx (types and location) per https://github.com/nextcloud/logreader/issues/1073#issuecomment-1856211939 by @AmatorPhasma and nothing to do with logreader as is being suggested.

See https://docs.nextcloud.com/server/27/admin_manual/installation/nginx.html#nextcloud-in-the-webroot-of-nginx and compare to what you may have (or haven't) in your .conf.

vindic commented 7 months ago

Same issue on two servers with apache2 configuration without using PHP-FPM.

One on Ubuntu 22.04 // PHP 8.2 // Apache 2.4.52

One on Ubuntu 20.04 // PHP 8.2 // Apache 2.4.41

https://github.com/nextcloud/logreader/issues/1073#issuecomment-1854809916 fix the internal error and show some logs.

VinceMasuka commented 7 months ago

Neither the above suggested modifications nor the update to Nextcloud v28.0.1 helped on latest Debian with PHP v8.2 and latest nginx (tested with latest Firefox and latest Chrome).

Some other suggestions? Anyone?

susnux commented 7 months ago

Neither the above suggested modifications nor the update to Nextcloud v28.0.1 helped on latest Debian with PHP v8.2 and latest nginx (tested with latest Firefox and latest Chrome).

What issue do you face?

This issue here is used for quite some off topic, because here are three different issues that are mixed up:

  1. The internal server error -> This is fixed for 28.0.1 and was caused by the app setting (fix see above)
  2. JS files not loaded due to server misconfiguration -> Caused by your NGinx not configured to serve .mjs as application/javascript or text/javascript.
  3. No log entires shown (but might appear after some time when polling is enabled) -> Your Adblocker behaves faulty, disable it for your Nextcloud instance and report it to your Adblocker.

This issue here is about (1) meaning you see only the "Internal server error" notice

For (2) you see a Nextcloud page but the app is not loaded there is a empty app page.

For (3) you see the Logreader UI but no log entries.

palto42 commented 7 months ago

With the workaround suggested in #1073 the error disappeared, but the logging page is now empty. Also the update to 28.0.1 didn't change anything, logs page is still completely blank. I tried to toggle the value of occ config:app:set logreader relativedates betwee true and false, but no difference. The admin overview page still complains about some errors in the logs...

masterwishx commented 7 months ago

With the workaround suggested in #1073 the error disappeared, but the logging page is now empty. Also the update to 28.0.1 didn't change anything, logs page is still completely blank. I tried to toggle the value of occ config:app:set logreader relativedates betwee true and false, but no difference. The admin overview page still complains about some errors in the logs...

Please check https://github.com/nextcloud/logreader/issues/1073#issuecomment-1856211939

palto42 commented 7 months ago

Please check #1073 (comment)

Thanks, adding the mime-type mjs fixed it.

VinceMasuka commented 7 months ago

What issue do you face?

This issue here is used for quite some off topic, because here are three different issues that are mixed up:

1. The internal server error -> This is fixed for 28.0.1 and was caused by the app setting (fix see above)

2. JS files not loaded due to server misconfiguration -> Caused by your NGinx not configured to serve .mjs as application/javascript or text/javascript.

3. No log entires shown (but might appear after some time when polling is enabled) -> Your Adblocker behaves faulty, disable it for your Nextcloud instance and report it to your Adblocker.

This issue here is about (1) meaning you see only the "Internal server error" notice

For (2) you see a Nextcloud page but the app is not loaded there is a empty app page.

For (3) you see the Logreader UI but no log entries.

Ah yes... obviously. Sorry for that: It's the blank logging page I'm facing (as seen in the screenshot of masterwishx above).

Besides: My config/stlye lays within /etc/nginx/nginx.conf. The mentioned two lines are already in there.

cvandesande commented 7 months ago

It's the blank logging page I'm facing (as seen in the screenshot of masterwishx above).

For those of us that faced that issue after solving the 500 errors, the cause of no logs was an ad blocker. For me it was ublock origin, but it stands to reason other ad blockers could have the same issue

VinceMasuka commented 7 months ago

It's the blank logging page I'm facing (as seen in the screenshot of masterwishx above).

For those of us that faced that issue after solving the 500 errors, the cause of no logs was an ad blocker. For me it was ublock origin, but it stands to reason other ad blockers could have the same issue

Thanks for the hint. But actually I read that, too. I'm using no browser ad blocker add-in at all, I'm afraid (I have a PiHole in place what makes such a plugin unneccessary).

cvandesande commented 7 months ago

I nearly suggested a pihole might be the cause, but I thought that was being presumptuous. It would be helpful to know if a pihole causes this issue as well since you have an opportunity to test

VinceMasuka commented 7 months ago

I just deactivated PiHole in order to be sure; It does have no effect on the logging issue if I do.

susnux commented 7 months ago

@VinceMasuka can you check the browser console if there are any errors and check also the network tab

nursoda commented 7 months ago

I tested on a native minimal NC 28.0.1 (which does include https://github.com/nextcloud/logreader/pull/1079) installation without any network security/privacy appliances but the issue (described in detail in https://github.com/nextcloud/server/issues/42370#issuecomment-1868325845) is still present for me. In another NC many-apps-installed-instance on the same server, /settings/admin/logging immediately loads correctly – 🤔

saschabrockel commented 6 months ago

Also not fixed for me. I have this for so many apps / plugins. For example activity-api.mjs:1, activity-sidebar.mjs:1 files_zip-main.mjs:1 and also logreader-main.mjs:1.

The page for logs is just blank.

bai-ivan commented 6 months ago

Also not fixed for me. I have this for so many apps / plugins. For example activity-api.mjs:1, activity-sidebar.mjs:1 files_zip-main.mjs:1 and also logreader-main.mjs:1.

The page for logs is just blank.

Your webserver is not serving the mjs file extension properly. I suspect you're using nginx and your config is a bit outdated. Please re-check it with the official documentation of Nextcloud https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

If not using Nginx check if your webserver is serving the mjs file extension with text/javascript or in worst case - application/javascript mime type.

saschabrockel commented 6 months ago

@bai-ivan you are right. It's an old example issue. They have changed the things I have set up. I guess there will be a bunch of people having this issue and I can help now. Just update your nginx.conf to this updated example of Nextcloud:

https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf