matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.94k stars 2.66k forks source link

Cron Archive runs no error, but does not update numbers in report #19023

Open heurteph-ei opened 2 years ago

heurteph-ei commented 2 years ago

From: https://forum.matomo.org/t/cron-archive-runs-no-error-but-does-not-update-numbers-in-report/44677 Several users report the same issue It seems this issue appeared since version 4.7.1+

Garrett

When using the cron to archive reports, new events are not reflected in the numbers. If I change the settings to allow archive via browser, all the number update as they should.

I’ve setup cron to run the core:archive and have an error log setup to make sure everything is working properly. The cron job is setup under the www-data user as follows:

*/15 * * * * php /var/www/html/URL/console core:archive --matomo-domain=URL > /home/USER/MatomoErrors/matomo-archive-errors.log I have it running every 15 minutes as I’m trouble shooting the issue.

The log file outputs the following:

INFO [2022-02-06 21:15:02] 7645  ---------------------------
INFO [2022-02-06 21:15:02] 7645  INIT
INFO [2022-02-06 21:15:02] 7645  Running Matomo 4.7.1 as Super User
INFO [2022-02-06 21:15:02] 7645  ---------------------------
INFO [2022-02-06 21:15:02] 7645  NOTES
INFO [2022-02-06 21:15:02] 7645  - Async process archiving supported, using CliMulti.
INFO [2022-02-06 21:15:02] 7645  - Reports for today will be processed at most every 900 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2022-02-06 21:15:02] 7645  - Archiving was last executed without error 3 min 16s ago.
INFO [2022-02-06 21:15:02] 7645  ---------------------------
INFO [2022-02-06 21:15:02] 7645  START
INFO [2022-02-06 21:15:02] 7645  Starting Matomo reports archiving...
INFO [2022-02-06 21:15:02] 7645  Start processing archives for site 1.
INFO [2022-02-06 21:15:02] 7645    Will invalidate archived reports for today in site ID = 1's timezone (2022-02-06 00:00:00).
INFO [2022-02-06 21:15:02] 7645    Will invalidate archived reports for yesterday in site ID = 1's timezone (2022-02-05 00:00:00).
INFO [2022-02-06 21:15:02] 7645  Finished archiving for site 1, 0 API requests, Time elapsed: 0.078s [1 / 1 done]
INFO [2022-02-06 21:15:02] 7645  Done archiving!
INFO [2022-02-06 21:15:02] 7645  ---------------------------
INFO [2022-02-06 21:15:02] 7645  SUMMARY
INFO [2022-02-06 21:15:02] 7645  Processed 0 archives.
INFO [2022-02-06 21:15:02] 7645  Total API requests: 0
INFO [2022-02-06 21:15:02] 7645  done: 0 req, 123 ms, no error
INFO [2022-02-06 21:15:02] 7645  Time elapsed: 0.123s
INFO [2022-02-06 21:15:02] 7645  ---------------------------
INFO [2022-02-06 21:15:02] 7645  SCHEDULED TASKS
INFO [2022-02-06 21:15:02] 7645  Starting Scheduled tasks... 
INFO [2022-02-06 21:15:02] 7645  done
INFO [2022-02-06 21:15:02] 7645  ---------------------------

It acts as if there is just nothing to archive??? I’m so stuck. Everything seems to be working perfect otherwise. I’ve checked all permissions on files and folders, my system check is all clear, and I just don’t know what else could be causing the issue.

Click to view System Check

``` ### Mandatory checks #### PHP version >= 7.2.5: ✔ 7.4.3 #### PDO extension: ✔ #### PDO\MYSQL extension: ✔ #### MYSQLI extension: ✔ #### Other required extensions: ✔ zlib ✔ json ✔ filter ✔ hash ✔ session #### Required functions: ✔ debug_backtrace ✔ eval ✔ hash ✔ gzcompress ✔ gzuncompress ✔ pack #### Required PHP configuration (php.ini): ✔ session.auto_start = 0 ✔ max_execution_time = 0 OR = -1 OR >= 30 #### Directories with write access: ✔ $DOC_ROOT/tmp ✔ $DOC_ROOT/tmp/assets ✔ $DOC_ROOT/tmp/cache ✔ $DOC_ROOT/tmp/climulti ✔ $DOC_ROOT/tmp/latest ✔ $DOC_ROOT/tmp/logs ✔ $DOC_ROOT/tmp/sessions ✔ $DOC_ROOT/tmp/tcpdf ✔ $DOC_ROOT/tmp/templates_c #### Directories with write access for Tag Manager: ✔ $DOC_ROOT/js ### Optional checks #### Required Private Directories: ✔ All private directories are inaccessible from the internet. #### Recommended Private Directories: ✔ All private directories are inaccessible from the internet. #### File integrity: ✔ #### 64-bit PHP Binary: ✔ #### Tracker status: ✔ #### Memory limit: ✔ 1024M #### Time zone: ✔ #### Open URL: ✔ fopen #### PageSpeed disabled: ✔ #### GD > 2.x + Freetype (graphics): ✔ #### Other extensions: ✔ json ✔ libxml ✔ dom ✔ SimpleXML ✔ openssl #### Other functions: ✔ shell_exec ✔ set_time_limit ✔ mail ✔ parse_ini_file ✔ glob ✔ gzopen ✔ md5_file #### Filesystem: ✔ #### Setup Cron - Managing processes via CLI: ✔ Ok #### Last Successful Archiving Completion: ✔ The archiving process completed successfully 00:11:25 ago. #### Database abilities: ✔ UTF8mb4 charset ✔ LOAD DATA INFILE ✔ CREATE TEMPORARY TABLES ✔ Changing transaction isolation level #### Max Packet Size: ✔ #### Forced SSL Connection: ✔ #### Geolocation: ✔ geoip2php (continent_code, continent_name, country_code, country_name, region_code, region_name, city_name, postal_code, lat, long) #### Update over HTTPS: ✔ #### Writable JavaScript Tracker ("/matomo.js"): ✔ ### Informational results #### Matomo Version: 4.7.1 #### Matomo Update History: 4.7.0,4.6.2, #### Matomo Install Version: 4.6.2 #### Latest Available Version: 4.7.1 #### Is Git Deployment: 0 #### PHP_OS: Linux #### PHP_BINARY: /usr/sbin/php-fpm7.4 #### PHP SAPI: fpm-fcgi #### Timezone Version: 0.system #### PHP Timezone: UTC #### PHP Time: 1644179189 #### PHP Datetime: 2022-02-06 20:26:29 #### PHP Disabled functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, pcntl_unshare, #### PHP INI max_execution_time: 600 #### PHP INI post_max_size: 4G #### PHP INI max_input_vars: 1000 #### PHP INI zlib.output_compression: #### Suhosin Installed: 0 #### DB Prefix: matomo_ #### DB Charset: utf8mb4 #### DB Adapter: PDO\MYSQL #### MySQL Version: 10.3.32-MariaDB-0ubuntu0.20.04.1 #### Num Tables: 119 #### Browser Segment Archiving Enabled: 1 #### Development Mode Enabled: 0 #### Internet Enabled: 1 #### Multi Server Environment: 0 #### Auto Update Enabled: 1 #### Custom User Path: 0 #### Custom Include Path: 0 #### Release Channel: latest_stable #### Plugins Activated: API, Actions, Annotations, BotTracker 2.06, BulkTracking, Contents, CoreAdminHome, CoreConsole, CoreHome, CorePluginsAdmin, CoreUpdater, CoreVisualizations, CoreVue, CustomDimensions, CustomJsTracker, CustomOptOut 2.0.1, DBStats, Dashboard, DevicePlugins, DevicesDetection, Diagnostics, Ecommerce, Events, Feedback, GeoIp2, Goals, Heartbeat, ImageGraph, Insights, Installation, Intl, IntranetMeasurable, LanguagesManager, Live, Login, MarketingCampaignsReporting 4.1.1, Marketplace, MobileMessaging, Monolog, Morpheus, MultiSites, Overlay, PagePerformance, PrivacyManager, ProfessionalServices, Proxy, Referrers, Resolution, RssWidget, SEO, ScheduledReports, SegmentEditor, SitesManager, TagManager, Tour, Transitions, TwoFactorAuth, UserCountry, UserCountryMap, UserId, UserLanguage, UsersManager, VisitFrequency, VisitTime, VisitorInterest, VisitsSummary, WebsiteMeasurable, Widgetize #### Plugins Deactivated: MobileAppMeasurable #### Plugins Invalid: #### Server Info: nginx/1.18.0 #### Had visits in last 1 day: 1 #### Had visits in last 3 days: 1 #### Had visits in last 5 days: 1 #### Archive Time Last Started: 1644178502 #### Archive Time Last Finished: 1644178503 #### User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 #### Browser Language: en-us,en #### Total Invalidation Count: 4 #### In Progress Invalidation Count: 4 #### Scheduled Invalidation Count: 0 #### Earliest invalidation ts_started: 2022-02-05 21:15:02 #### Latest invalidation ts_started: 2022-02-06 06:30:02 #### Earliest invalidation ts_invalidated: 2022-01-27 21:00:02 #### Latest invalidation ts_invalidated: 2022-02-06 06:15:02 #### Number of segment invalidations: 0 #### Number of plugin invalidations: 0 #### List of plugins being invalidated: #### Anonymize Referrer: #### Do Not Track enabled: 1 ```

Timothy van Exel

We’re experience the exact same issue with Matomo version 4.8.0. When we change “Archive reports when viewed from the browser” to yes then all stats are updated nicely, when we change it to no and use the cronjob below, nothing happens.

As asked by @sgiehl I executed the command with the -v option this is the result:
INFO [2022-03-21 08:52:25] 99070  ---------------------------
INFO [2022-03-21 08:52:25] 99070  NOTES
INFO [2022-03-21 08:52:25] 99070  - Async process archiving supported, using CliMulti.
INFO [2022-03-21 08:52:25] 99070  - Reports for today will be processed at most every 1800 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2022-03-21 08:52:25] 99070  - Archiving was last executed without error 4s ago.
INFO [2022-03-21 08:52:25] 99070  - Will only process the following periods: day, week, month (--force-periods)
INFO [2022-03-21 08:52:25] 99070  ---------------------------
INFO [2022-03-21 08:52:25] 99070  START
INFO [2022-03-21 08:52:25] 99070  Starting Matomo reports archiving...
DEBUG [2022-03-21 08:52:25] 99070  Applying queued rearchiving...
INFO [2022-03-21 08:52:25] 99070  Start processing archives for site 1.
DEBUG [2022-03-21 08:52:25] 99070  Checking for queued invalidations...
DEBUG [2022-03-21 08:52:25] 99070    Today archive can be skipped due to no visits for idSite = 1, skipping invalidation...
DEBUG [2022-03-21 08:52:25] 99070    Yesterday archive can be skipped due to no visits for idSite = 1, skipping invalidation...
DEBUG [2022-03-21 08:52:25] 99070  Done invalidating
DEBUG [2022-03-21 08:52:25] 99070  No next invalidated archive.
INFO [2022-03-21 08:52:25] 99070  Finished archiving for site 1, 0 API requests, Time elapsed: 0.029s [1 / 3 done]
INFO [2022-03-21 08:52:25] 99070  Start processing archives for site 2.
DEBUG [2022-03-21 08:52:25] 99070  Checking for queued invalidations...
DEBUG [2022-03-21 08:52:25] 99070    Today archive can be skipped due to no visits for idSite = 2, skipping invalidation...
DEBUG [2022-03-21 08:52:25] 99070    Yesterday archive can be skipped due to no visits for idSite = 2, skipping invalidation...
DEBUG [2022-03-21 08:52:25] 99070  Done invalidating
DEBUG [2022-03-21 08:52:25] 99070  No next invalidated archive.
INFO [2022-03-21 08:52:25] 99070  Finished archiving for site 2, 0 API requests, Time elapsed: 0.012s [2 / 3 done]
INFO [2022-03-21 08:52:25] 99070  Start processing archives for site 4.
DEBUG [2022-03-21 08:52:25] 99070  Checking for queued invalidations...
INFO [2022-03-21 08:52:25] 99070    Will invalidate archived reports for today in site ID = 4's timezone (2022-03-21 00:00:00).
DEBUG [2022-03-21 08:52:25] 99070    Found usable archive for [idSite = 4, period = day 2022-03-21,2022-03-21, segment = , plugin = , report = ], skipping invalidation.
INFO [2022-03-21 08:52:25] 99070    Will invalidate archived reports for yesterday in site ID = 4's timezone (2022-03-20 00:00:00).
DEBUG [2022-03-21 08:52:25] 99070    Found usable archive for [idSite = 4, period = day 2022-03-20,2022-03-20, segment = , plugin = , report = ], skipping invalidation.
DEBUG [2022-03-21 08:52:25] 99070  Done invalidating
DEBUG [2022-03-21 08:52:25] 99070  No next invalidated archive.
INFO [2022-03-21 08:52:25] 99070  Finished archiving for site 4, 0 API requests, Time elapsed: 0.018s [3 / 3 done]
DEBUG [2022-03-21 08:52:25] 99070  No more sites left to archive, stopping.
INFO [2022-03-21 08:52:25] 99070  Done archiving!
INFO [2022-03-21 08:52:25] 99070  ---------------------------
INFO [2022-03-21 08:52:25] 99070  SUMMARY
INFO [2022-03-21 08:52:25] 99070  Processed 0 archives.
INFO [2022-03-21 08:52:25] 99070  Total API requests: 0
INFO [2022-03-21 08:52:25] 99070  done: 0 req, 138 ms, no error
INFO [2022-03-21 08:52:25] 99070  Time elapsed: 0.138s
INFO [2022-03-21 08:52:25] 99070  ---------------------------
INFO [2022-03-21 08:52:25] 99070  SCHEDULED TASKS
DEBUG [2022-03-21 08:52:25] 99070  26 scheduled tasks loaded
INFO [2022-03-21 08:52:25] 99070  Starting Scheduled tasks...
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 0:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 1:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 2:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 3:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 4:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 5:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 6:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 7:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 8:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 9:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 10:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 11:
DEBUG [2022-03-21 08:52:25] 99070  Executing tasks with priority 12:
INFO [2022-03-21 08:52:25] 99070  done
INFO [2022-03-21 08:52:25] 99070  ---------------------------

Site ID 4 is the site for which reports should be generated.

Stefan Giehl: So for some reason the (possibly empty) archive that was created before is considered as “usable”. That means Matomo has marked it as finished, which actually should never be the case for yesterday or today. Which timezones are you using for the site in Matomo and on your server?

The following settings are configured on the website and the server: image

Click to view System Check

``` ### Mandatory checks #### PHP version >= 7.2.5: ✔ 7.4.3 #### PDO extension: ✔ #### PDO\MYSQL extension: ✔ #### MYSQLI extension: ✔ #### Other required extensions: ✔ zlib ✔ json ✔ filter ✔ hash ✔ session #### Required functions: ✔ debug_backtrace ✔ eval ✔ hash ✔ gzcompress ✔ gzuncompress ✔ pack #### Required PHP configuration (php.ini): ✔ session.auto_start = 0 ✔ max_execution_time = 0 OR = -1 OR >= 30 #### Directories with write access: ✔ $DOC_ROOT/tmp ✔ $DOC_ROOT/tmp/assets ✔ $DOC_ROOT/tmp/cache ✔ $DOC_ROOT/tmp/climulti ✔ $DOC_ROOT/tmp/latest ✔ $DOC_ROOT/tmp/logs ✔ $DOC_ROOT/tmp/sessions ✔ $DOC_ROOT/tmp/tcpdf ✔ $DOC_ROOT/tmp/templates_c ### Optional checks #### Required Private Directories: ✔ #### File integrity: ✔ #### 64-bit PHP Binary: ✔ #### Tracker status: ✔ #### Memory limit: ✔ 512M #### Time zone: ✔ #### Open URL: ✔ curl #### PageSpeed is turned off: ✔ #### GD > 2.x + FreeType (graphics): ✔ #### Other extensions: ✔ json ✔ libxml ✔ dom ✔ SimpleXML ✔ openssl #### Other functions: ✔ shell_exec ✔ set_time_limit ✔ mail ✔ parse_ini_file ✔ glob ✔ gzopen ✔ md5_file #### Filesystem: ✔ #### Set up Cron - Managing processes via CLI: ✔ Ok #### Last Successful Archiving Completion: ✔ The archiving process completed successfully 00:34:45 ago. #### Database abilities: ✔ UTF8mb4 charset ✔ LOAD DATA INFILE ✔ CREATE TEMPORARY TABLES ✔ Changing transaction isolation level #### Max Packet Size: ✔ #### Forced SSL Connection: ✔ #### Geolocation: ⚠ Warning: The default location provider guesses a visitor's country based on the language they use. This is not very accurate, so we recommend installing and using a geolocation database. #### Update over HTTPS: ✔ #### Writable JavaScript Tracker ("/matomo.js" & "/piwik.js"): ✔ ### Informational results #### Matomo Version: 4.8.0 #### Matomo Update History: 4.4.0,4.2.1,4.1.1,3.11.0, #### Matomo Install Version: Unknown - pre 3.8. #### Latest Available Version: 4.8.0 #### Is Git Deployment: 0 #### PHP_OS: Linux #### PHP SAPI: apache2handler #### Timezone Version: 0.system #### PHP Timezone: UTC #### PHP Time: 1647603587 #### PHP Datetime: 2022-03-18 11:39:47 #### PHP Disabled functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, pcntl_unshare, #### PHP INI max_execution_time: 3600 #### PHP INI post_max_size: 20G #### PHP INI max_input_vars: 1000 #### PHP INI zlib.output_compression: #### Curl Version: 7.68.0, OpenSSL/1.1.1f #### Suhosin Installed: 0 #### DB Prefix: piwik_ #### DB Charset: utf8mb4 #### DB Adapter: PDO\MYSQL #### MySQL Version: 5.7.37-log #### Num Tables: 363 #### Browser Segment Archiving Enabled: 1 #### Development Mode Enabled: 0 #### Internet Enabled: 1 #### Multi Server Environment: 0 #### Auto Update Enabled: 1 #### Custom User Path: 0 #### Custom Include Path: 0 #### Release Channel: latest_stable #### Plugins Activated: API, Actions, Annotations, BulkTracking, Contents, CoreAdminHome, CoreConsole, CoreHome, CorePluginsAdmin, CoreUpdater, CoreVisualizations, CoreVue, CustomDimensions, CustomJsTracker, CustomVariables 4.0.1, DBStats, Dashboard, DevicePlugins, DevicesDetection, Diagnostics, Ecommerce, Events, Feedback, ForceSSL 4.0.1, GeoIp2, Goals, Heartbeat, ImageGraph, Insights, Installation, Intl, IntranetMeasurable, InvalidateReports 4.0.1, LanguagesManager, Live, Login, Marketplace, MobileMessaging, Monolog, Morpheus, MultiSites, Overlay, PagePerformance, PrivacyManager, ProfessionalServices, Proxy, Referrers, Resolution, RssWidget, SEO, ScheduledReports, SegmentEditor, SitesManager, Tour, Transitions, TwoFactorAuth, UserCountry, UserCountryMap, UserId, UserLanguage, UsersManager, VisitFrequency, VisitTime, VisitorInterest, VisitsSummary, WebsiteMeasurable, Widgetize #### Plugins Deactivated: BotTracker 2.07, CustomAlerts 4.0.3, DevicePixelRatio 2.0.0, JsTrackerForceAsync 4.0.0, MarketingCampaignsReporting 4.1.1, MobileAppMeasurable, Provider 4.0.3, QueuedTracking 4.0.2, ReferrersManager 4.0.1, SearchEngineKeywordsPerformance 3.4.1, SecurityInfo 3.0.7, TagManager, TreemapVisualization 3.1.1 #### Plugins Invalid: #### Server Info: Apache/2.4.41 (Ubuntu) #### Had visits in last 1 day: 1 #### Had visits in last 3 days: 1 #### Had visits in last 5 days: 1 #### Archive Time Last Started: 1647601501 #### Archive Time Last Finished: 1647601502 #### User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0 #### Browser Language: en-us,en #### Total Invalidation Count: 1125 #### In Progress Invalidation Count: 0 #### Scheduled Invalidation Count: 0 #### Earliest invalidation ts_started: #### Latest invalidation ts_started: #### Earliest invalidation ts_invalidated: 2022-03-15 08:21:23 #### Latest invalidation ts_invalidated: 2022-03-18 10:20:02 #### Number of segment invalidations: 0 #### Number of plugin invalidations: 0 #### List of plugins being invalidated: #### Anonymize Referrer: #### Do Not Track enabled: 0 ```

Babita De Boer

Experiencing the same thing. Since using to 4.8.0. We have freshly installed a new matomo server wanted to use the "Archive reports when viewed from the browser” to “No” and we set the cron to run every 30 minutes.

It keeps saying exactly what the user above me says, specifically this part “Processed 0 archives” :

INFO [2022-03-17 23:20:02] 50612 ---------------------------
INFO [2022-03-17 23:20:02] 50612 SUMMARY
INFO [2022-03-17 23:20:02] 50612 Processed 0 archives.
INFO [2022-03-17 23:20:02] 50612 Total API requests: 0
INFO [2022-03-17 23:20:02] 50612 done: 0 req, 343 ms, no error
INFO [2022-03-17 23:20:02] 50612 Time elapsed: 0.343s
INFO [2022-03-17 23:20:02] 50612 ---------------------------
MatomoForumNotifications commented 2 years ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/cron-archive-runs-no-error-but-does-not-update-numbers-in-report/44677/12

creopard commented 2 years ago

Same issue here. Setting up a cron in cPanel it will execute successfully but with the same log results as already posted by @heurteph-ei and the report numbers won't update.

However, executing the cron command (like php /var/www/html/URL/console core:archive --matomo-domain=URL > /home/USER/MatomoErrors/matomo-archive-errors.log) in a real shell window, the numbers will update.

Someone in the forum mentioned that

the ENV var was not properly set

But what variables are expected here and can they be added to the execution command for the cron?

creopard commented 2 years ago

As a workaround I'm now using wget for the cronjob to get the archiving update done:

Example: wget -O /home/public_html/matomo-archive-output.log 'https://www.example.com/path-to-matomo/misc/cron/archive.php?token_auth=TOKENID_AS_SET_IN_ADMIN_SECTION' &> /dev/null

Just set your domain, paths and the token_auth-id to your needs and wget will then generate the matomo-archive-output.log file. (The command &> /dev/null will prevent wget sending you an email every time it got executed)

Nevertheless, it would be great to have the "native" php command working again in the crontab...

heurteph-ei commented 2 years ago

@tsteur @sgiehl any analyze?

creopard commented 2 years ago

It seems to be the same behaviour with the web cron:

Here is the log from 2022-10-25 22:00:05 night:

INFO CoreAdminHome[2022-10-25 22:00:05 UTC] [e9294] ---------------------------
INFO CoreAdminHome[2022-10-25 22:00:05 UTC] [e9294] INIT
INFO CoreAdminHome[2022-10-25 22:00:05 UTC] [e9294] Running Matomo 4.12.2 as Super User
INFO CoreAdminHome[2022-10-25 22:00:05 UTC] [e9294] ---------------------------
INFO CoreAdminHome[2022-10-25 22:00:05 UTC] [e9294] NOTES
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] - Async process archiving supported, using CliMulti.
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] - Reports for today will be processed at most every 3600 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] - Archiving was last executed without error 9 Stunden 39 Minuten ago.
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] ---------------------------
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] START
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Starting Matomo reports archiving...
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Start processing archives for site 1.
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Will invalidate archived reports for yesterday in site ID = 1's timezone (2022-10-25 00:00:00).
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Finished archiving for site 1, 0 API requests, Time elapsed: 0.159s [1 / 1 done]
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Done archiving!
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] ---------------------------
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] SUMMARY
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Processed 0 archives.
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Total API requests: 0
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] done: 0 req, 440 ms, no error
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Time elapsed: 0.440s
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] ---------------------------
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] SCHEDULED TASKS
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Starting Scheduled tasks...
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: executing task Piwik\Plugins\CustomJsTracker\Tasks.updateTracker...
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: finished. Time elapsed: 0.077s
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteLogData...
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] done
INFO CoreAdminHome[2022-10-25 22:00:06 UTC] [e9294] ---------------------------

This morning 2022-10-26 07:40:10, I noticed that the numbers again were not updated to I did set up a new cron and set to 1 minute execution time. This resulted in the following log (successfully updating the numbers):

INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] ---------------------------
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] INIT
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] Running Matomo 4.12.2 as Super User
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] ---------------------------
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] NOTES
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] - Async process archiving supported, using CliMulti.
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] - Reports for today will be processed at most every 3600 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] - Archiving was last executed without error 9 Stunden 39 Minuten ago.
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] ---------------------------
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] START
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] Starting Matomo reports archiving...
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] Start processing archives for site 1.
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] Will invalidate archived reports for today in site ID = 1's timezone (2022-10-26 00:00:00).
INFO CoreAdminHome[2022-10-26 07:40:03 UTC] [ac318] Will invalidate archived reports for yesterday in site ID = 1's timezone (2022-10-25 00:00:00).
INFO CoreAdminHome[2022-10-26 07:40:05 UTC] [ac318] Archived website id 1, period = day, date = 2022-10-26, segment = '', 31 visits found. Time elapsed: 1.928s
INFO CoreAdminHome[2022-10-26 07:40:05 UTC] [ac318] Archived website id 1, period = day, date = 2022-10-25, segment = '', 205 visits found. Time elapsed: 1.928s
INFO CoreAdminHome[2022-10-26 07:40:06 UTC] [ac318] Archived website id 1, period = week, date = 2022-10-24, segment = '', 413 visits found. Time elapsed: 0.540s
INFO CoreAdminHome[2022-10-26 07:40:07 UTC] [ac318] Archived website id 1, period = month, date = 2022-10-01, segment = '', 4512 visits found. Time elapsed: 0.995s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Archived website id 1, period = year, date = 2022-01-01, segment = '', 49289 visits found. Time elapsed: 1.835s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Finished archiving for site 1, 5 API requests, Time elapsed: 5.862s [1 / 1 done]
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Done archiving!
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] ---------------------------
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] SUMMARY
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Processed 5 archives.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Total API requests: 5
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] done: 5 req, 6056 ms, no error
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Time elapsed: 6.056s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] ---------------------------
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] SCHEDULED TASKS
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Starting Scheduled tasks...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.invalidateOutdatedArchives...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Browser triggered archiving disabled, archives will be invalidated during core:archive.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.000s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.deleteOldFingerprintSalts...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.purgeOutdatedArchives...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Purging archives in 206 archive tables.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Purged 160 range archive rows from piwik_archive_numeric_2022_08 & piwik_archive_blob_2022_08.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Purged 121 range archive rows from piwik_archive_numeric_2022_09 & piwik_archive_blob_2022_09.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Purged 24 range archive rows from piwik_archive_numeric_2022_10 & piwik_archive_blob_2022_10.
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.287s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\Login\Tasks.cleanupBruteForceLogs...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\UsersManager\Tasks.cleanupExpiredTokens...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.000s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\UsersManager\Tasks.setUserDefaultReportPreference...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\UsersManager\Tasks.cleanUpExpiredInvites...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.000s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CustomJsTracker\Tasks.updateTracker...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.019s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.purgeInvalidatedArchives...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.004s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.purgeInvalidationsForDeletedSites...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.000s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteReportData...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.002s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.deleteLogData...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.000s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.cleanupTrackingFailures...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\CoreUpdater\Tasks.sendNotificationIfUpdateAvailable...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.001s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\Marketplace\Tasks.clearAllCacheEntries...
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: finished. Time elapsed: 0.006s
INFO CoreAdminHome[2022-10-26 07:40:09 UTC] [ac318] Scheduler: executing task Piwik\Plugins\Marketplace\Tasks.sendNotificationIfUpdatesAvailable...
INFO CoreAdminHome[2022-10-26 07:40:10 UTC] [ac318] Scheduler: finished. Time elapsed: 0.145s
INFO CoreAdminHome[2022-10-26 07:40:10 UTC] [ac318] done
INFO CoreAdminHome[2022-10-26 07:40:10 UTC] [ac318] ---------------------------

What makes me wonder is this line in both logs:

Archiving was last executed without error 9 Stunden [hours] 39 Minuten [minutes] ago.

Shouldn't that be a different time each time?