Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage Statistics are not logged if usage-statistics.dbfile is not configured, or if IP is not mappable to a location #2965

Closed
tdonohue opened this issue Sep 11, 2020 · 1 comment
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
Milestone

Comments

@tdonohue
Copy link
Member

tdonohue commented Sep 11, 2020

Describe the bug
Despite implication in the comments in usage-statistics.cfg, DSpace's usage statistics engine does not function at all if the usage-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:

  1. Leave the usage-statistics.dbfile commented out (which is the default setting)
  2. Start up DSpace. In the logs, you'll see 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)
  3. Try to generate a viewevent, either using the UI or by using this curl 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")
  4. Now, access the 'usagereport' for that same object, e.g. 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:

ERROR org.dspace.statistics.SolrLoggerServiceImpl @ Unable to get location of request: The address 127.0.0.1 is not in
the database.

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.

@tdonohue tdonohue added bug component: statistics Related to Statistics (Solr or Google Analytics) Estimate TBD Needs to have an estimate added labels Sep 11, 2020
@tdonohue tdonohue added this to the 7.1 milestone Sep 11, 2020
@tdonohue tdonohue added this to To Do in DSpace 7.1 release via automation Sep 11, 2020
@tdonohue tdonohue removed this from To Do in DSpace 7.1 release Jul 13, 2021
@tdonohue tdonohue added this to To Do in DSpace 7.x Tier 3: Medium Priority via automation Jul 13, 2021
@tdonohue tdonohue removed this from the 7.1 milestone Jul 13, 2021
@tdonohue tdonohue added the help wanted Needs a volunteer to claim to move forward label Sep 3, 2021
@tdonohue tdonohue added this to the 7.5 milestone Mar 9, 2023
@tdonohue
Copy link
Member Author

tdonohue commented Mar 9, 2023

Closing, this was fixed in 7.5 by #8571

@tdonohue tdonohue closed this as completed Mar 9, 2023
DSpace 7.x Tier 3: Medium Priority automation moved this from To Do to Done Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Development

No branches or pull requests

1 participant