GeoServer is great for publishing OGC services and it’s used by many of our customers to publish data online. However, GeoServer does not provide robust usage analytics by itself. Therefore many organisations using GeoServer have a limited understanding on usage trends, what data is being used and by which web maps. Spatineo provides a tool called Spatineo Monitor that provides you this information as well as a number of other features. We offer a free trial that you can try out. This article gives you instructions on how to configure your GeoServer and send those log files for Spatineo to analyze.
Configuring GeoServer to produce access logs
An access log is a file to which the server writes information about each request it has fulfilled. Despite its name, GeoServer is an application that runs in an application server and it is that server which writes this file. The most common servers that are used to run GeoServer are Tomcat and Jetty, but there is a large number of other options as well. This article covers Tomcat as that is the recommended server for GeoServer. If you are using something else, you will find similar information in that server’s documentation.
Tomcat 7 and 8
Start by editing your apache-tomcat-7.0.x/conf/server.xml file. Within the tag you should have a configuration tag. Typically this is almost at the very end of the file. We recommend using a slightly different log file pattern to ensure that all crucial information is captured. The default format is called “common”, while our recommandation is to use the “combined” log format. The difference between the two is that the latter will store both referring websites and user agents in addition to all the information in the common format. Here is an example Valve configuration using the combined format:
Note that in addition to the pattern which defines what information is written into the log file, the tag also configures the directory (logs) where files are stored, the naming convention of log files (prefix localhost_access_log. and suffix .txt). You might need to change these to suit your environment.
After making changes to this configuration, you must reboot Tomcat for the changes to take effect.
When the server is set up to produce access logs, you will find the log files in the directory configured in your server.xml file. The contents of these files should be a large number for rows such as these:
10.11.12.13 - - [15/May/2017:08:09:10 +0300] "GET /geoserver/ows?LAYERS=foo%3Abar&TRANSPARENT=TRUE&STYLES=&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A3067&BBOX=327680,6855680,332800,6860800&WIDTH=256&HEIGHT=256 HTTP/1.1" 200 2480 "http://www.geoportal.com/map" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.92 Safari/537.4"
10.11.12.14 - - [15/May/2017:08:09:14 +0300] "GET /geoserver/ows?LAYERS=foo%3Agah&STYLES=mystyle&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EPSG%3A3067&BBOX=312320,6814720,317440,6819840&WIDTH=1024&HEIGHT=1024 HTTP/1.1" 200 2480 "https://www.mymap.com/" "Jakarta Commons-HttpClient/3.0-beta1"
Note that after rebooting the server, you might have to wait a bit before requests appear into the file. Each row represents a single request to your server.
Sending files to Spatineo
The analytics we provide requires analyzing your log files. To transfer these logs, we provide a secure SFTP server for receiving them but for trial purposes you can also just send us a zip file containing the logs. Once the files have arrived, we analyze them automatically and results will appear in Spatineo Monitor. To set up transferring your files, please get in touch with us!
Once the log files have been analyzed, you can browse the analytics information in Spatineo Monitor and dig deep into how your particular service and data sets are used. Our software also provides excellent reporting capabilities that helps you communicate how your services work and are being used.