Usage stats warnings: system can't remove the base url

Hi,

I am getting a lot of (thousands) these errors when running scheduled tasks:
[Warning] The line number X from the file /files/usageStats/processing/usage_events_20170207.log contains an url that the system can't remove the base url from.

Basically all rows with an url like this are causing the warning http://site.fi/journal/article/download/7897/6303/21280

If an url does not have “download” in it, there seems to be no warnings.

Does this mean that all file downloads are now not being counted?

OJS 3.0.2

Hi @ajnyga

I’ll take a look…

Thanks!
Bozana

Hi @ajnyga

Hmmm… What do you have in your config.inc.php? What is your base_url and do you maybe have any base URL override settings (e.g. base_url[index] = …?

Best,
Bozana

Hi,

base_url = “http://journal.fi

I have five override settings for subdomains. It seems that the download hits for those journals are not causing errors. At least I can not seem to find any.

Edit: however, there are also cases where a download hit has not caused a warning and the journal base_url is the default url.

But, in all cases where there is an error, the url is a download url.

Hi @ajnyga

Strange… I cannot reproduce it :frowning: My download URLs do not cause that warning…
Here is the function where that happens: https://github.com/pkp/pkp-lib/blob/master/classes/core/Core.inc.php#L255 i.e. this function return an empty/no URL for some reason in that specific cases…
s. also https://github.com/pkp/pkp-lib/blob/master/plugins/generic/usageStats/PKPUsageStatsLoader.inc.php#L508, where the warning is logged…

And I especially do not understand why ‘download’ would be a problem :open_mouth:
(Without ‘download’ it is not a valid/functioning OJS URL…)

Hmmm… I’ll try to figure out a possible reason…

Edit: so is in your cases the base_url totally the same as in the logged URL?

Thanks!
Bozana

I can send you the two log files if you want to take a look. As I said, I am getting thousands of these warnings on daily basis.

Do you have restfull url’s turned on?

I would then also need your config.inc.php (with all the URLs configurations – other parts I do not need).
Hmmm… I am not sure about restfull url’s? Where to look for that?

We solved this with @bozana (thanks!)

The problem was that our site has five journals using subdomains and these subdomains are defined in config.inc.php with base_url settings. The rest of the journals are using the default url format.

However, while debugging this we noticed that only the journals with base_url’s defined were getting hits in the metrics table. The way I solved this was that I added base_url settings for all journals to the config.inc.php, so also for those that use the default http://domain.fi/journalname/

Although this is probably solved now, I do think that the way OJS handles the base_url settings should be changed someway. I recall a similar issue: OJS3 rewriting subdomains for journals, problem with admin panel journal drop down - #8 by asmecher

Edit: just to confirm that the usage statistics were now processed with 0 errors.