Usage stats shows 0 in the downloaded files

Hello,

We are using OJS 3.1.0.1

Our journal editors would like to have some usage stats. I have tried to use the built-in “View Report” from “Tools”. However, I’m getting 0s for a newly created journal (i.e., a few months old), and 500 internal server error message for the other two older journals. I can see the usages are being recorded in the usageEventLogs folders, but for some reasons, they are not showing up in the downloaded excel reports.

Does anyone here knows why?

Thanks,
Yanan

Hi @Yanan_Zhao,

Can you check your PHP error log for details on those 500 errors?

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks. Our IT has stopped logging PHP logs. I will ask them to restart again. At the meantime, do you have any idea why the downloaded “View Report” for the newer-ish journal is all '0’s?

Yanan

Hi @Yanan_Zhao,

Check that your base_url in config.inc.php is set correctly, and see if there is anything useful in the usageStats/usageEventLogs directory (inside your OJS files_dir).

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

Thanks for the reply. I have checked the base_url is correct. and I can’t see anything useful in the usageEventLogs files… It seems to have recorded my test visits… see below. Can you tell anything unusual from the logs below?

10.4.120.20 administrative 1 “2020-11-05 09:35:54” Mahika Kai Journal 200 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36”
10.4.120.20 administrative 1 “2020-11-05 09:35:59” Utilising Mātauraka Māori knowledge and western scientific mapping technology to track vegetation changes in the Koukourarata (Port Levy) basin from c1620 to 2019. | Mahika Kai Journal 200 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36”
10.4.120.20 administrative 1 “2020-11-05 09:36:08” https://journals.lincoln.ac.nz/index.php/mk/article/download/1157/827/2437 200 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36”
10.4.120.20 administrative 1 “2020-11-05 09:36:08” https://journals.lincoln.ac.nz/index.php/mk/article/download/1157/827/2437 200 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36”
10.4.120.20 administrative 1 “2020-11-05 09:36:16” Utilising Mātauraka Māori knowledge and western scientific mapping technology to track vegetation changes in the Koukourarata (Port Levy) basin from c1620 to 2019. | Mahika Kai Journal 200 “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36”

Thanks,
Yanan

Please see is dB metrics updated?

Sorry, can you advise how I can do that? I’m new to OJS. Thanks.

In my case, this db metric has stopped work since OJS 3.1.1-4 and now I upgrade my OJS version to 3.2.1-1 and this db metrics still didn’t updated data.

image

I don’t know how to make it work. so many discuss about this but no solution.

in OJS 3.2.1.1 that problem i think influence to dashboard admin. like this screen shoot

image

please how to fix this

@Muhammad_Khoiruddin here are a couple of things to check:

  1. In your SQL database, see if there are any rows for in the metrics table for this journal. So if the journal id is 1, use the following SQL:
select count(*) from metrics where context_id=1
  1. If there are no metrics, your instance may not be set up to process the usage stats logs. Check to see if there is a scheduled task registered for this:
select * from scheduled_tasks;

You should see a listing for plugins.generic.usageStats.UsageStatsLoader.

  1. If you do have that listing, your instance may not be running its scheduled tasks. Read our documentation on how to configure scheduled tasks.

  2. If you do not have that listing, your instance may not have the correct plugins installed. Read our documentation on how to configure the statistics framework.

Thank you @NateWr,
Yes Journal ID = 1

image

the second command:

image

It looks like the UsageStatsLoader is running (the last run was yesterday). My best guess is that there are no log files being written or the plugin is not finding the log files for processing.

I’d recommend looking in your files_dir (defined in config.inc.php) and look for the usageStats directory. For example, if your files_dir is /var/www/files, look at the files in:

/var/www/files/usageStats`

In particular, look for log files in:

/var/www/files/usageStats/usageEventLogs

When the usage stats are processed, they are taken out of this directory for processing. That means you should only see logs since the last run.

Thank you @NateWr

it look like all are okey

config.inc.php files_dir
image

log files :directory:
image

usage event log directory:

image

usage event log file contain:
image

Hmm, and what about the usageStats/archive directory. Do you have logs for all of the old dates in there? Also, what does the base_url setting in your config file look like?

base URL setting

and

Ok, sorry, but I misread your output when counting the metrics table a few posts back. It looks like you have 70,000+ rows in the table. Let’s see if any of them are from the juripol journal. Try:

select journal_id from journals where path="juripol";

That should be 1. If so, try:

select * from metrics where context_id=1 and load_id="usage_events_20201113.log" limit 10;

If there are no entries for that, open up usageStats/archive/usage_events_20201113.log and see if there are any entries for the juripol journal.

yes result in one row

image

second command there is no row

image

image

there are 231 rows contain juripol.

for note:
our last conversation is journal_id = 1
not Journal_id = 3

is any correlation with this?

thank you

here we talk about journal_id = 1, its mean journal name is = “sinkron”

do we miss something?

i have check to juripol journal and also not work to

image

Ok, so journal 1 has the path sinkron. Can you double-check that the log entry for Nov 13 had some entries for this journal?

It seems like they are not getting stored in the metrics table. I’m not sure what exactly is happening, but at this stage you’ll need to try processing some sample usage event logs to debug.

For example, I nnotice that the URLs for the journal sinkron all contain a double slash before index.php:

http://jurnal.polgan.ac.id//index.php/sinkron/...

If you process the logs without that slash, do you get entries in the metrics table?

Our Admin Guide includes a section on how to process log files. (The important thing to note is that you may need to move the log files out of the archive directory – I recommend just creating a small dummy file with sample usage events rather than the whole thing, while you debug.)