Clean NC15 install - Can't download logs (internal server error)

Nextcloud version: 15.0.0
Operating system and version: CentOS 7
Apache or nginx version: Apache/2.4.6 (CentOS)
PHP version: 7.2.12

The issue you are facing:
After a clean install of Nextcloud 15 on a CentOS 15 server (an old laptop I’ve been using exclusively for PlexMediaServer) following the guide on “https://www.marksei.com/how-to-install-nextcloud-15-server-on-centos-7” I can view but not download the logs on “ADMIN => LOGGING => DOWNLOAD LOGS”.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Open logs menu on “ADMIN => LOGGING”
  2. Click on 3 dots menu
  3. Click on “Download Logs” button.

The output of your Nextcloud log in Admin > Logging:

[index] Error: UnexpectedValueException: Log file not available at <<closure>>

0. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 166
   download()
1. /var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 99
   executeController(OC\Settings\Cont ... {}, "download")
2. /var/www/html/nextcloud/lib/private/AppFramework/App.php line 118
   dispatch(OC\Settings\Cont ... {}, "download")
3. /var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
   main("OC\\Settings\\C ... r", "download", OC\AppFramework\ ... {}, {_route: "settings.LogSettings.download"})
4. <<closure>>
   __invoke({_route: "settings.LogSettings.download"})
5. /var/www/html/nextcloud/lib/private/Route/Router.php line 297
   call_user_func(OC\AppFramework\ ... {}, {_route: "settings.LogSettings.download"})
6. /var/www/html/nextcloud/lib/base.php line 987
   match("/settings/admin/log/download")
7. /var/www/html/nextcloud/index.php line 42
   handleRequest()

GET /index.php/settings/admin/log/download
from 192.168.1.1 by sputnik at 2018-12-27T20:22:16+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'removed',
  'passwordsalt' => 'removed',
  'secret' => 'cJPzjhQL2sysJx6SGTpmR3GSpvW7odframRG4SEiMwszI5rU',
  'trusted_domains' =>
  array (
    0 => '192.168.1.200',
    2 => 'removed',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.0.10',
  'overwrite.cli.url' => 'http://192.168.1.200/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'removed',
  'dbpassword' => 'removed',
  'installed' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 3,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'removed',
  'mail_smtpport' => 'removed',
  'mail_from_address' => 'removed',
  'mail_domain' => 'removed',
  'mail_smtpname' => 'removed',
  'mail_smtppassword' => 'removed',
);

The output of your Apache/nginx/system log in /var/log/____:

Access Log

192.168.1.1 - - [27/Dec/2018:17:42:07 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:42:31 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:42:27 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:42:27 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:42:53 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:01 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:42:47 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:23 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:07 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:07 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:32 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:27 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:53 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:44:01 -0300] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:47 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
192.168.1.1 - - [27/Dec/2018:17:43:47 -0300] "GET /index.php/apps/logreader/poll?lastReqId=XCU0ePYPVgJhEG5Ucbr6KAAAAAA HTTP/1.1" 200 2 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"

error_log

[Thu Dec 27 17:01:38.673919 2018] [auth_digest:notice] [pid 6874] AH01757: generating secret for digest authentication ...
[Thu Dec 27 17:01:38.674615 2018] [lbmethod_heartbeat:notice] [pid 6874] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 27 17:01:38.675555 2018] [ssl:warn] [pid 6874] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 27 17:01:38.703090 2018] [mpm_prefork:notice] [pid 6874] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.12 configured -- resuming normal operations
[Thu Dec 27 17:01:38.703115 2018] [core:notice] [pid 6874] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Dec 27 17:08:21.516135 2018] [authz_core:error] [pid 6879] [client 192.168.1.1:60248] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Thu Dec 27 17:08:28.692683 2018] [authz_core:error] [pid 7025] [client 192.168.1.1:60261] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Thu Dec 27 17:08:31.851652 2018] [authz_core:error] [pid 7028] [client 192.168.1.1:60267] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Thu Dec 27 17:08:39.034498 2018] [authz_core:error] [pid 7053] [client 192.168.1.1:60285] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Thu Dec 27 17:08:54.136850 2018] [authz_core:error] [pid 7028] [client 192.168.1.1:60308] AH01630: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
1 Like

I also have this issue.
Also if access the nextcloud.log with WINSCP directly, the content isn’t updated anymore.

check your config to add ‘logfile’ => ‘/path/to/logfile’
Path must be writeable by webserver-user.
you may also specify ‘loglevel’ and ‘log_type’, while journald did’nt work well for me.
(edit: there should be default for those values, but maybe they don’t work. so check to set them manually. if it works, this may be a bug with default values.)

Added logfile to config.php

‘loglevel’ => 2,
‘logfile’ => ‘/var/www/nextcloud/data/nextcloud.log’,

The file existed and was being written to by www-data, but still not possible to download log from nc admin logging page. Copied the error shown in admin>logging to pastbin.

This is on a clean install of NC14 upgraded to NC15 on Rpi3B+ 1TB HP/Nextcloudbox

Added:
‘logfile’ => ‘/volume1/web/nextcloud/data/nextcloud.log’,

Log file is now updated!

If i try to download the log file in menu “Logging” i still get “Internal Server Error”.

can you access the logfile and locate the full error-line as of error 1 and 3 and paste them too?
Do you have a separate php-error log and can find anything there?

The lines with denied by server for .ocdata are wanted, but i still would guess something with filename and access-security-settings, we don’t see yet.

Added tail of nextcloud.log to pastbin

Edit: added tail of php log too

Sorry guys, watching the discussion I feel I should have stated this from beginning.

Since my clean install I have no problem at all grabbing the file at “/var/www/html/nextcloud/data/nextcloud.log” and it’s normally written with updates. The only issue is when trying to download it on web interface. So it’s not a problem with webserver user write permission in my case.

@obel1x, out of curiosity, does it work for you on 15.x?

Thank you

@joelfabiani right now, checking my version its still 14.0.4 - thought to be on 15. I would have gone checking it like this, cause it worked for me having files in another place ever since…

Ok so there my be 15.X related problems with download, also they are written - are they known?