Usage statistics OJS country_id

Hi, I have OJS (can’t jump to 3.xx due to the need for subscriptions)

I’m trying to get the usage statistics working correctly and I need to be able to identify article and pdf reads by IP and country. I’ve been told that my metrics table is not collecting all of the info that I need. the country_id column is null.

How do I collect IP and country stats? My institutional subscribers ask annually how many reads are from their IP address.2017-08-10_17-18-01

Hi @MarkAGregory,

To identify the country, you’ll need to make sure the GeoIP database is installed. See
for details.

Alec Smecher
Public Knowledge Project Team

1 Like

Thx Alec, I understand that I need to re-process all the log files now. Where do I find these files and where do I move them to if I want them to be re-processed?

Hi @MarkAGregory

The processed log files are in the usageStats/archive/ folder in your files_dir. You will have to move them into the usageEventLogs/ folder, for them to be processed again. Once the scheduled task is triggered next time, they should be processed.

Currently, there is no possibility for the plugin to consider the subscribers IP – there are no IP addresses statistics at the moment.


Thank you for the help. The folder /files/usageStats/usageEventLogs has many files in it.
In the folder /files/usageStats/ there was a file I’ve unzipped this back into /files/usageStats/usageEventLogs
The folder /files/usageStats/archive is empty

I’m wondering if the log files are being processed at all?

How would I know?

I’m really disappointed to hear about no way to track subscribers by the IP address. Is there any way to see how many times a subscriber has accessed the website?

Hi @MarkAGregory

It would be best if you could track for some time what is going on i.e. if everything is working well: The new/current log files should be in the folder usageStats/usageEventLogs. If you have a Cron job or Acron plugin enabled, the scheduled task will be run and thus the log files will be processed once per day. During the processing, the log files will be first moved to the folder usageStats/stage, then usageStats/processing. After the log files are processed i.e. statistics calculated and saved, the log files will be moved to the folder usageStats/archive (if the processing was successful) or usageStats/reject (if an error occurred when processing). Each time the scheduled task is run, you will have a scheduled task log file in in the folder files_fir/scheduledTaskLogs/ – the files start with the name Usagestatisticsfileloadertask-…
If the processing was successful you will see the statistics in your DB table metrics. It would be good if you could take a look if the numbers there roughly correspond to your log files entries. When the statistics are in the DB table metrics, you can also display them with a chart on the article page (s. Usage Statistics plugin settings for that).
If the processing was not successful, you will have an error message in the current file Usagestatisticsfileloadertask-… in the folder files_fir/scheduledTaskLogs/. In that case you would need to remove/fix the problem and rebuild/re-process the log file again.
You can rebuild/re-process the log files by moving them in the folder usageStats/usageEventLogs again and triggering/running the scheduled task (note that the scheduled task is run only one time per day, so that you might have to wait for a day).


Hi Bozana, I copied all the log files back to start the process again. In the scheduled task logs I get this

[2017-08-14 03:25:59] [Notice] Task process started.
[2017-08-14 03:25:59] [Notice] Task process stopped.

Nothing appears to be happening.

The folder usageStats/usageEventLogs is full of files.

I’ve checked and the Acron plugin is enabled.

any ideas?

Hi @MarkAGregory

Just to double check: the Acron and Usage Statistics plugin are enabled for the journal, from where you trigger the scheduled task, right?
Could you take a look in your DB table scheduled_tasks, when the UsageStatsLoader has been run the last time? – Maybe it was already run that day? You could delete that row in the DB table scheduled_tasks and try to trigger it again (by visiting e.g. the journal home or the journal article page).
If that does not work, could you also track if there is any error in your error log files, when triggering it?
Make the whole backup before doing it/rebuilding the statistics – to be on the safe side…


Hi Bozana, I’ve got everything turned on.
I copied all the log files back into usageStats/usageEventLogs

thd db states that UsageStatsLoader ran last 2017-08-17 12:38:54

I now get this message

Usage statistics file loader task - 5995c69e64941 - Error
Your OJS installation automatically executed and finished this task and you
can download the log file here:

I looked in this file and about 5 per cent of the 800 files were marked invalid log files. I checked usageStats/usageEventLogs and now there is only one file in this folder - todays file.

I’ve found the rejects folder contains most of the files for the past couple of weeks now.

I’m really stuck here and have no idea how to fix this.

Hi @MarkAGregory

Could you maybe send me the processing errors logged in that scheduled task log file? – For me to try to figure out what is the problem…


Thank you for your help Bozana, we appear to have found the issue and will move forward now.