episciences icon indicating copy to clipboard operation
episciences copied to clipboard

[Feature request] Statistics for new front end websites

Open rtournoy opened this issue 10 months ago • 0 comments

We need a script to update the statistics for the web sites using the new React front ends

Previously with PHP each public download/consult action was tracked and considered for statistics. It is no longer the case with the new websites.

We need a script to parse the server logs and inject the values in the table STAT_TEMP.

The script will parse the server logs.

here is an example layout for server logs: var/logs/mbj.episciences.org/2025/01/01-mbj.episciences.org.access_log

The script need to take 2 parameters for input:

  • [ ] Required : --rvcode: the RVCODE of the journal, example: mbj
  • [ ] Optional --date: a date with this format : YYYY-mm-dd, example: 2025-03-01
  • [ ] Optional --verbose: if given the script will log to the console, if not given only log to the file

If date parameter is absent the script will fallback to the day before, "current date - 1 day"

For a given RVCODE as parameter the goal is to read the file with a given date and extract the relevant values for the server logs, reformat and inject into the Table STAT_TEMP.

3 Patterns to consider:

# "notice" (page consultation): /articles/14460

# "file" (downloads): /articles/14460/download /articles/14460/preview

There is existing code to anonymise the IP adresses It is not useful to filter bots as they will be filtered by another script The values need to be filtered for malicious input before prepared for insert into the database

Logs:

  • Use monolog for logging into a file
  • verbose mode will log to the console

rtournoy avatar Mar 18 '25 14:03 rtournoy