OJS 3.5 – Usage Statistics Not Loading / Jobs Not Found / UsageStats Processing Issue

1. OJS & Server Environment

  • OJS Version: 3.5

  • PHP Version: 8.2.29

  • Database: MariaDB 10.11.10

  • Web Server: LiteSpeed

  • OS Platform: Linux

OJS Settings Related to Queues and Jobs:

Steps I took leading up to the issue

queues
default_connection: database
``queues
default_connection: database
default_queue: queue
job_runner: 1
job_runner_max_jobs: 30
job_runner_max_execution_time: 30
job_runner_max_memory: 80
process_jobs_at_task_scheduler: 1
delete_failed_jobs_after: 180``

  1. Files Directory: public_html

  2. Usage Stats Directory: public_html/usageStats
    2. Usage Stats Directory Structure

    ```usageStats/
    ├── archive/          # Logs that have been processed
    ├── dispatch/         # Jobs waiting to be dispatched
    ├── processing/       # Logs currently being processed
    ├── reject/           # Logs failed to process
    ├── stage/            # Logs waiting to be picked up by job
    ├── usageEventLogs/   # Processed logs stored in database-friendly format
    └── salt              # File containing unique salt for usage stats
    ```
    

    Example of staged logs (waiting to process):
    ls -l usageStats/stage/ -rw-r--r-- 1 u951848545 o200407452 13137 Sep 13 20:24 usage_events_20250913.log -rw-r--r-- 1 u951848545 o200407452 23061 Sep 14 23:36 usage_events_20250914.log -rw-r--r-- 1 u951848545 o200407452 10850 Sep 15 17:11 usage_events_20250915.log -rw-r--r-- 1 u951848545 o200407452 6449 Sep 16 11:04 usage_events_20250916.log
    Permissions:

    • stage/*.log should be readable by PHP: chmod 644 usageStats/stage/*.log

    • salt file should also be readable: chmod 644 usageStats/salt

    3. Jobs Table in Database

    Check jobs related to usageStats:

USE u951848545_ojs_jviral;

SELECT * FROM jobs WHERE queue='usageStats';

Empty

/opt/alt/php82/usr/bin/php lib/pkp/tools/jobs.php run UsageStatsFileLoader -vvv

Observations

  • Jobs are not picked up even after inserting manually.

  • stage/*.log are present but remain unprocessed.

  • processing/ and dispatch/ directories remain empty.

  • Job runner is enabled in config, but CLI still reports no jobs available.
    For example, OJS 3.5

Additional information

Hi , we do not have any queue named usageStats when dispatching job , the default queue named as queue unless any custom modification done in the codebase manually or updated the default queue in the config. so pushing jobs in a custom queue named usageStats will not be picked by job runner or worker without custom modification or passing queue name as worker param . Also the configuration of job_runner should be On or Off instead of 1 or 0 . both are same but in few places we have some strict checking so better to follow the right convention .

Also with the default configuration, does the usage stats jobs not executing ? can you clarify that ?

Regards

PKP Dev Team

OJS 3.5 Statistics Not Working

Dear PKP Support Team,

I am experiencing an issue with OJS 3.5 where article and issue statistics are not working. I have verified the following:

  • All jobs (php jobs.php statistics:process / scheduled tasks / cron) are running correctly.

  • File permissions on the server are properly set.

  • No related errors appear in the server logs.

Despite this, the statistics data is not being recorded in the database and does not appear on the dashboard. Could you please advise on how to resolve this issue?

1 Like

Hi,

I am experiencing the same issue with OJS 3.5 and I don’t know what to do.

Regards,
Tarcisio Pereira

1 Like

Hi @Sam_Ryzal

Are your usage stats log files correctly created and the usage written into the log files? What happens with them, in which folder are they?
Do you see that the scheduled task UsageStatsLoader is executed and its log file exist for every day in your filesFolder/scheduledTaskLogs/ ?
How do you see that the jobs are running correctly? Also the usage stats jobs?

Best,
Bozana

Here also an explanation how it all works:

Every day UsageStatsLoader scheduled task is run. UsageStatsLoader considers log files in the folder usageEventLogs and stage. Thereby the files from usageEventLogs are first copied to the stage folder. It then dispatches lots of jobs in a chain (that should be executed one after another, in a specific order) for all the log files there.
Note: The log files and folders need to have correct access permissions. When using the build-in runner, the web user needs read and write access to the log files and folders.
Once the job chain is dispatched, the files are moved to the folder dispatch. They stay there until they are not processed by the jobs. When a file is fully processed by the jobs, and statistics calculated and saved in their DB tables, it is moved to the folder archive.

The scheduled tasks have their log files under files_folder/scheduledTaskLogs/. There one can also see the log files for UsageStatsLoader scheduled task. If an error occurs when that task is run, one will find it in that log file. So, it is good to control the scheduled task running there.

When the built-in job runner is used, the jobs on the queue are run on a user request, when a user requests the web page/site.
These are the statistics jobs, that exist only in a chain:
First the job ProcessUsageStatsLogFile is run, that reads a log file and saves the entries in temporary DB tables.
The job RemoveDoubleClicks is then run on those temporary DB tables, to remove the double clicks – all the accesses of one and the same URL withing 30 seconds by the same user will be reduced to 1.
The job CompileUniqueInvestigations consideres unique accesses – all the accesses of one submission within an hour by the same user will be counted as 1 unique investigation.
The job CompileUniqueRequests consideres unique file downlaods – all the downloads for one submission within an hour by the same user will be counted as 1 unique request.
The job CompileContextMetrics then calculates daily statistics for the journal index page.
The job CompileIssueMetrics calculates daily statistics for issues.
The job CompileSubmissionMetrics calculates daily statistics for submissions.
The job CompileSubmissionGeoDailyMetrics calculates daily Geo statistics for submissions.
The job CompileCounterSubmissionDailyMetrics calculates the COUNTER R5 daily metrics for submissions.
The job CompileCounterSubmissionInstitutionDailyMetrics calculates the COUNTER R5 daily metrics for submissions and institutions.
The job DeleteUsageStatsTemporaryRecords deletes the entries in the temporary tables – because all the statistics for that day should be calculated at that moment.
The job ArchiveUsageStatsLogFile moves the processed log file into the archive folder.
The job CompileMonthlyMetrics calculates the monthly Geo statistics, COUNTER R5 submissions and COUNTER R5 submissions+institutional statistics.

As admin the jobs can be seen under “Administration”. Or in the DB table jobs. If a job fails, they can be seen under “Administration” or in the DB table failed_jobs. There, also the reason why the job failed can be found there.

Hi Bozana, i followed your detailed guide, set permission to 775 for folder, and 644 for files, and ran the jobs but it seems to fail.

The files are not moved within the userStat folders and the scheduledTaskLogs are just job started | job stopped. Am i missing something?

Thanks in advance

Hi @tundesign

Do you also use OJS 3.5?

In OJS 3.5, the UsageStatsLoader scheduled task log file should contain something like:
2025-12-17 16:15:43] ``http://ojs-domain
[2025-12-17 16:15:43] [Notice] Task process started.
[2025-12-17 16:15:43] [Notice] File /path/to/files/folder/usageStats/processing/usage_events_20251211.log was moved to dispatch folder.
[2025-12-17 16:15:43] [Notice] File /path/to/files/folder/usageStats/processing/usage_events_20251216.log was moved to dispatch folder.
[2025-12-17 16:15:43] [Notice] The background jobs that will process the log files and store the statistics data have been dispatched.
[2025-12-17 16:15:43] [Notice] Task process stopped.

Is this what you have as well? I.e. are there entries that the log file was moved to dispatch folder?

thanks for replying, yes i have 3.5.0.2.
my scheduled task log file are like this
[2025-12-17 17:45:39] http://ojs-domain
[2025-12-17 17:45:39] [Notice] Task process started.
[2025-12-17 17:45:39] [Notice] Task process stopped.

the entries are stuck in /usageEventLogs/
archive | dispatch | processing | stage reject folders were not present, i made it.
php lib/pkp/tools/jobs.php run -v

shows

[INFO] No jobs available to run in the queue named queue.

php lib/pkp/tools/scheduler.php run -v works but nothing shows
ive upgraded from 3.5.0.1, but the statistics were not funcioning either

i have a custom folder for my public files, but it’s properly setup in my config.inc.php. Can this have an impact on the normal work of the code?

thanks for your help

I’ve managed to start the statistics reading the docs, with
php lib/pkp/tools/reprocessUsageStatsMonth.php YYYYMM

i think i’ll setup a cron job, probably the internal one is not working with my config

Thanks a lot

Hi @tundesign

So did it all work with that reprocessing tool?
It does actually almost the same as the daily stats processing, so I really do not understand why would one process work and the other not.
I also do not understand why your scheduled task log file looks like that – it seems like there is some problem with getting the log file from the folder and moving it into other folders…
:thinking:

Hi @bozana probably a permission misconfiguration.

My actual config is

job_runner = On

process_jobs_at_task_scheduler = Off

task_runner = On

the permissions are 775 for folder and 644 for files

the logs were piling up in the usageEventLogs folder.

after running php lib/pkp/tools/reprocessUsageStatsMonth.php YYYYMM
the backlog was correctly loaded and processed

i’ve tested running php lib/pkp/tools/jobs.php list -vvv

after that i’ve ran php lib/pkp/tools/scheduler.php test "APP\tasks\UsageStatsLoader"

and php lib/pkp/tools/jobs.php run -v

everithing was functioning as espected. So

i thing is a mix of misconfigured opion and file permissions. I’m waiting the cron to process yesterday files.

yes indeed, i think that was caused by the lacking permissions

thanks