Usage stats stopped getting collected 4 years back. How to start getting them again?

Greetings,

I have inherited OJS 2.4.5 management responsibilities and noticed that we only have usage stats for 2014. Home>User>Journal Management>Plugin Management>Generic Plugins has, among other things, “Usage Statisics” and “Acron Plugin” enabled. I clicked on “Usage Statistics” and there is a check mark next to “Create log files”.

I also clicked on “Reload Scheduled Tasks” for the “Acron Plugin”, but the reports are still showing the stats from 2014 only. Should I wait till tomorrow and current (2018) stats will start appearing or is there something else I need to do to reactivate them?

May I rephrase my question? What do I need to do to enable usage stats collection in 2.4.5? I’ve read the guide and the forum, but I still can’t make them work :frowning:

I still hope someone can help me :frowning:

Do not know much about OJS2, but start by checking the files/usageStats/ folder. What do you have in the subfolders there? Are there files in the archive folder for example.

Thank you, @ajnyga.

My /var/ojs-files folder has the following:

UsageStats/archive has 218 usage_events_2014xxxx.log files (from 2014),
UsageStats/processing - one file - usage_events_20140805.log
UsageStats/reject - empty
UsageStats/stage - 40 usage_events_2014xxxx.log files
UsageStas/usageEventLogs - one file - usage_events_20141001.log

ok, so try moving the one file usage_events_20140805.log from processing to stage.

After that try to trigger your scheduled tasks (or just wait) and then see what comes up in your php error log.

I am pretty sure that the file there that got stuck back in 2014 has some errors in it.

After you have been able to process the existing files from the stage folder (from there they are sent to processing and then to archive) we need to figure out why no new log files are being created.

It could be related to folder permissions maybe.

Thank you again, @ajnyga.

I moved the file from processing to stage. Then I looked at the php error log and I see there three types of errors with either arrawy_shift(), flock() or assert() and then this:

[Fri Aug 31 12:38:22.064556 2018] [:error] [pid 21841] ojs2 has produced an error\n Message: WARNING: fopen(/var/ojs-files/usageStats/usageEventLogs/usage_events_20180831.log): failed to open stream: Permission denied\n In file: /var/www/html/plugins/generic/usageStats/UsageStatsPlugin.inc.php\n At line: 309\n Stacktrace: \n Server info:\n OS: Linux\n PHP Version: 5.5.9-1ubuntu4.25\n Apache Version: Apache/2.4.7 (Ubuntu)\n DB Driver: mysql\n DB server version: 5.5.61-0ubuntu0.14.04.1

I actually started getting them last week, after trying to enable stats collection, and they pop-up constantly since. It looks like your theory about folder permissions is correct! Which folder(s) permissions should I change and to what?

That very much depends on your server setup. See this FAQ about the issue How should file permissions be set?

The bottom line is that php has to have a permission to write/read to those folders and the files within. In our case I give the folder permissions recursively to a user and group named “apache”, in some cases it could “wwwdata”, but other setups do not require these kind of settings at all.

1 Like

Thank you, @ajnyga!

After changing the permissions and waiting a couple days, our stats from August 2018 magically started to appear again!

1 Like