mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Move implementation agnostic usage-stats configs to new config module
Not sure if I need to add usage-statistics.cfg to module overlay pom for filter
This commit is contained in:
@@ -55,7 +55,7 @@ public class DisplayStatisticsServlet extends DSpaceServlet
|
||||
{
|
||||
|
||||
// is the statistics data publically viewable?
|
||||
boolean privatereport = ConfigurationManager.getBooleanProperty("solr-statistics", "authorization.admin");
|
||||
boolean privatereport = ConfigurationManager.getBooleanProperty("usage-statistics", "authorization.admin");
|
||||
|
||||
// is the user a member of the Administrator (1) group?
|
||||
boolean admin = Group.isMember(context, 1);
|
||||
|
@@ -92,18 +92,17 @@ public class ElasticSearchLogger {
|
||||
try {
|
||||
LookupService service = null;
|
||||
// Get the db file for the location
|
||||
String dbfile = ConfigurationManager.getProperty("solr-statistics", "dbfile");
|
||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
||||
if (dbfile != null) {
|
||||
try {
|
||||
service = new LookupService(dbfile,
|
||||
LookupService.GEOIP_STANDARD);
|
||||
service = new LookupService(dbfile, LookupService.GEOIP_STANDARD);
|
||||
} catch (FileNotFoundException fe) {
|
||||
log.error("The GeoLite Database file is missing (" + dbfile + ")! Solr Statistics cannot generate location based reports! Please see the DSpace installation instructions for instructions to install this file.", fe);
|
||||
log.error("The GeoLite Database file is missing (" + dbfile + ")! Usage Statistics cannot generate location based reports! Please see the DSpace installation instructions for instructions to install this file.", fe);
|
||||
} catch (IOException e) {
|
||||
log.error("Unable to load GeoLite Database file (" + dbfile + ")! You may need to reinstall it. See the DSpace installation instructions for more details.", e);
|
||||
}
|
||||
} else {
|
||||
log.error("The required 'dbfile' configuration is missing in solr-statistics.cfg!");
|
||||
log.error("The required 'dbfile' configuration is missing in usage-statistics.cfg!");
|
||||
}
|
||||
locationService = service;
|
||||
|
||||
@@ -270,7 +269,7 @@ public class ElasticSearchLogger {
|
||||
|
||||
try {
|
||||
if (isSpiderBot &&
|
||||
!ConfigurationManager.getBooleanProperty("solr-statistics", "logBots", true)) {
|
||||
!ConfigurationManager.getBooleanProperty("usage-statistics", "logBots", true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ public class SolrLogger
|
||||
{
|
||||
log.info("solr-statistics.spidersfile:" + ConfigurationManager.getProperty("solr-statistics", "spidersfile"));
|
||||
log.info("solr-statistics.server:" + ConfigurationManager.getProperty("solr-statistics", "server"));
|
||||
log.info("solr-statistics.dbfile:" + ConfigurationManager.getProperty("solr-statistics", "dbfile"));
|
||||
log.info("usage-statistics.dbfile:" + ConfigurationManager.getProperty("usage-statistics", "dbfile"));
|
||||
|
||||
CommonsHttpSolrServer server = null;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class SolrLogger
|
||||
|
||||
LookupService service = null;
|
||||
// Get the db file for the location
|
||||
String dbfile = ConfigurationManager.getProperty("solr-statistics", "dbfile");
|
||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
||||
if (dbfile != null)
|
||||
{
|
||||
try
|
||||
@@ -119,7 +119,7 @@ public class SolrLogger
|
||||
}
|
||||
else
|
||||
{
|
||||
log.error("The required 'dbfile' configuration is missing in solr-statistics.cfg!");
|
||||
log.error("The required 'dbfile' configuration is missing in usage-statistics.cfg!");
|
||||
}
|
||||
locationService = service;
|
||||
|
||||
@@ -168,7 +168,7 @@ public class SolrLogger
|
||||
try
|
||||
{
|
||||
if(isSpiderBot &&
|
||||
!ConfigurationManager.getBooleanProperty("solr-statistics", "logBots",true))
|
||||
!ConfigurationManager.getBooleanProperty("usage-statistics", "logBots",true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -295,6 +295,7 @@ public class SolrLogger
|
||||
}
|
||||
}
|
||||
|
||||
//@TODO remove metadataStorage object from all see: DS-421
|
||||
public static Map<String, String> getMetadataStorageInfo()
|
||||
{
|
||||
return metadataStorageInfo;
|
||||
|
@@ -24,7 +24,7 @@ public class DnsLookup {
|
||||
Resolver res = new ExtendedResolver();
|
||||
|
||||
// set the timeout, defaults to 200 milliseconds
|
||||
int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200);
|
||||
int timeout = ConfigurationManager.getIntProperty("usage-statistics", "resolver.timeout", 200);
|
||||
res.setTimeout(0, timeout);
|
||||
|
||||
Name name = ReverseMap.fromAddress(hostIp);
|
||||
|
@@ -199,7 +199,7 @@ public class StatisticsDataGenerator {
|
||||
Map<String, String> metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
||||
|
||||
String prevIp = null;
|
||||
String dbfile = ConfigurationManager.getProperty("solr-statistics", "dbfile");
|
||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
||||
LookupService cl = new LookupService(dbfile,
|
||||
LookupService.GEOIP_STANDARD);
|
||||
int countryErrors = 0;
|
||||
|
@@ -470,7 +470,7 @@ public class StatisticsImporter
|
||||
solr = new CommonsHttpSolrServer(sserver);
|
||||
|
||||
metadataStorageInfo = SolrLogger.getMetadataStorageInfo();
|
||||
String dbfile = ConfigurationManager.getProperty("solr-statistics", "dbfile");
|
||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
||||
try
|
||||
{
|
||||
geoipLookup = new LookupService(dbfile, LookupService.GEOIP_STANDARD);
|
||||
|
@@ -383,7 +383,7 @@ public class StatisticsImporterElasticSearch {
|
||||
// Verbose option
|
||||
boolean verbose = line.hasOption('v');
|
||||
|
||||
String dbfile = ConfigurationManager.getProperty("solr-statistics", "dbfile");
|
||||
String dbfile = ConfigurationManager.getProperty("usage-statistics", "dbfile");
|
||||
try
|
||||
{
|
||||
geoipLookup = new LookupService(dbfile, LookupService.GEOIP_STANDARD);
|
||||
|
@@ -56,7 +56,7 @@ public class StatisticsAuthorizedMatcher extends AbstractLogEnabled implements M
|
||||
//We have always got rights to view stats on the home page (admin rights will be checked later)
|
||||
boolean authorized = dso == null || AuthorizeManager.authorizeActionBoolean(context, dso, action, false);
|
||||
//If we are authorized check for any other authorization actions present
|
||||
if(authorized && ConfigurationManager.getBooleanProperty("solr-statistics", "authorization.admin"))
|
||||
if(authorized && ConfigurationManager.getBooleanProperty("usage-statistics", "authorization.admin"))
|
||||
{
|
||||
//If we have no user, we cannot be admin
|
||||
if(context.getCurrentUser() == null)
|
||||
|
@@ -11,33 +11,9 @@
|
||||
# tomcat still running on port 8080
|
||||
server = ${solr.server}/statistics
|
||||
|
||||
# The location for the Geo Database retrieved on update/installation
|
||||
dbfile = ${dspace.dir}/config/GeoLiteCity.dat
|
||||
|
||||
# Timeout for the resolver in the dns lookup
|
||||
# Time in milliseconds, defaults to 200 for backward compatibility
|
||||
# Your systems default is usually set in /etc/resolv.conf and varies
|
||||
# between 2 to 5 seconds, to high a value might result in solr exhausting
|
||||
# your connection pool
|
||||
resolver.timeout = 200
|
||||
|
||||
# Control if the statistics pages should be only shown to authorized users
|
||||
# If enabled, only the administrators for the DSpaceObject will be able to
|
||||
# view the statistics.
|
||||
# If disabled, anyone with READ permissions on the DSpaceObject will be able
|
||||
# to view the statistics.
|
||||
authorization.admin=true
|
||||
|
||||
# A comma-separated list that contains the bundles for which the bitstreams will be displayed
|
||||
query.filter.bundles=ORIGINAL
|
||||
|
||||
# Enable/disable logging of spiders in solr statistics.
|
||||
# If false, and IP matches an address in spiderips.urls, event is not logged.
|
||||
# If true, event will be logged with the 'isBot' field set to true
|
||||
# (see query.filter.* for query filter options)
|
||||
# Default value is true.
|
||||
#logBots = true
|
||||
|
||||
# control solr statistics querying to filter out spider IPs
|
||||
# false by default
|
||||
#query.filter.spiderIp = false
|
||||
|
23
dspace/config/modules/usage-statistics.cfg
Normal file
23
dspace/config/modules/usage-statistics.cfg
Normal file
@@ -0,0 +1,23 @@
|
||||
# The location for the Geo Database retrieved on update/installation
|
||||
dbfile = ${dspace.dir}/config/GeoLiteCity.dat
|
||||
|
||||
# Timeout for the resolver in the dns lookup
|
||||
# Time in milliseconds, defaults to 200 for backward compatibility
|
||||
# Your systems default is usually set in /etc/resolv.conf and varies
|
||||
# between 2 to 5 seconds, to high a value might result in solr exhausting
|
||||
# your connection pool
|
||||
resolver.timeout = 200
|
||||
|
||||
# Control if the statistics pages should be only shown to authorized users
|
||||
# If enabled, only the administrators for the DSpaceObject will be able to
|
||||
# view the statistics.
|
||||
# If disabled, anyone with READ permissions on the DSpaceObject will be able
|
||||
# to view the statistics.
|
||||
authorization.admin=true
|
||||
|
||||
# Enable/disable logging of spiders in solr statistics.
|
||||
# If false, and IP matches an address in spiderips.urls, event is not logged.
|
||||
# If true, event will be logged with the 'isBot' field set to true
|
||||
# (see query.filter.* for query filter options)
|
||||
# Default value is true.
|
||||
#logBots = true
|
Reference in New Issue
Block a user