Usage Statistics are not logged if usage-statistics.dbfile is not configured, or if IP is not mappable to a location #2965
Labels
bug
component: statistics
Related to Statistics (Solr or Google Analytics)
Estimate TBD
Needs to have an estimate added
help wanted
Needs a volunteer to claim to move forward
Projects
Milestone
Describe the bug
Despite implication in the comments in
usage-statistics.cfg
, DSpace's usage statistics engine does not function at all if theusage-statistics.dbfile
is not configured. The comments imply that statistics would still "work" but would just be missing location data.To Reproduce
Steps to reproduce the behavior:
usage-statistics.dbfile
commented out (which is the default setting)ERROR org.dspace.statistics.SolrLoggerServiceImpl @ The required 'dbfile' configuration is missing in solr-statistics.cfg!
(This error improperly mentions the wrong configuration file as well)viewevent
, either using the UI or by using thiscurl
command:curl -X POST 'http://localhost:8080/server/api/statistics/viewevents' -H "Content-Type:application/json" --data '{"targetId":"[uuid-of-object]", "targetType":"[object-type]"}'
("[object-type]" can be "item", "collection" or "community")curl -v 'http://localhost:8080/server/api/statistics/usagereports/[uuid-of-object]_TotalVisits'
You'll find that the views will not increase (they will remain at zero unless they were previously non-zero).This same behavior can ALSO be seen if you configure the
usage-statistics.dbfile
to a valid GeoLite or DB-IP MMDB database, but the IP address of the client is NOT found in GeoLite or DB-IP (e.g. if the IP address is 127.0.0.1 it won't be in those database).The only difference in behavior is that in that second scenario, after the
viewevent
is POSTed, you will see this error in your logs:Expected behavior
Expected behavior is that the views should still be counted, even if they are unable to be "mapped" to a specific location. In other words, the total location-based visits may be less than the "TotalVisits" (as some visits may not be mapped to a location).
We could optionally choose to exclude, by default, hits from localhost / 127.0.0.1 .... or some sort of "deny list". However, other IPs should be counted, regardless of whether they are able to be mapped to a location.
Related work
This bug was initially discovered in testing of #2782. See this comment where the bug was encountered....in the following comment, a temporary workaround was discovered by using
X-Forwarded-For
to "fake" other IP addresses in order to generate non-zero statistical events.Tentatively scheduling this for 7.1, as it doesn't seem high priority to resolve. Ideally most DSpace sites will have a location database installed/configured, and therefore this bug will be unlikely to appear.
The text was updated successfully, but these errors were encountered: