configuration.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. .. _monitor_configuration:
  2. Monitor Configuration
  3. =====================
  4. Many aspects of the monitor extension are configurable. All configuration files
  5. are stored in the data directory under the ``monitoring`` directory::
  6. <data_directory>
  7. monitoring/
  8. filter.properties
  9. monitor.properties
  10. The ``monitor.properties`` file is the main configuration file whose contents are
  11. described in the following sections. The ``filter.properties``
  12. allows for :ref:`filtering <request_filters>` out those requests from being monitored.
  13. Database persistence with hibernate is described in more detail in the :ref:`monitor_db` section.
  14. .. _monitor_storage:
  15. Monitor Storage
  16. ---------------
  17. How request data is persisted is configurable via the ``storage`` property defined in the
  18. ``monitor.properties`` file. The following values are supported for the ``storage`` property:
  19. * **memory** - Request data is to be persisted in memory alone.
  20. The default value is ``memory``.
  21. The "monitor hibernate" community module allows to also store the requests in a relational database.
  22. Memory Storage
  23. ^^^^^^^^^^^^^^
  24. With memory storage only the most recent 100 requests are stored. And by definition this
  25. storage is volatile in that if the GeoServer instance is restarted, shutdown, or crashes
  26. this data is lost.
  27. .. _monitor_mode:
  28. Monitor Mode
  29. ------------
  30. The monitor extension supports different "monitoring modes" that control how
  31. request data is captured. Currently two modes are supported:
  32. * **history** *(Default)* - Request information updated post request only. No
  33. live information made available.
  34. * **live** - Information about a request is captured and updated in real time.
  35. The monitor mode is set with the ``mode`` property in the ``monitor.properties`` file.
  36. The default value is ``history``.
  37. History Mode
  38. ^^^^^^^^^^^^
  39. History mode persists information (sending it to storage) about a request after
  40. a request has completed. This mode is appropriate in cases where a user is most
  41. interested in analyzing request data after the fact and doesn't require real time
  42. updates.
  43. Live Mode
  44. ^^^^^^^^^
  45. Live mode updates request data (sending it to storage) in real time as it
  46. changes. This mode is suitable for users who care about what a service is doing now.
  47. Bounding Box
  48. ------------
  49. When applicable one of the attributes the monitor extension can capture is the request
  50. bounding box. In some cases, such as WMS and WCS requests, capturing the bounding box
  51. is easy. However in other cases such as WFS it is not always possible to 100% reliably
  52. capture the bounding box. An example being a WFS request with a complex filter element.
  53. How the bounding box is captured is controlled by the ``bboxMode`` property in the
  54. ``monitor.properties`` file. It can have one of the following values.
  55. * **none** - No bounding box information is captured.
  56. * **full** - Bounding box information is captured and heuristics are applied for WFS
  57. requests.
  58. * **no_wfs** - Bounding box information is captured except for WFS requests.
  59. Part of a bounding box is a coordinate reference system (crs).Similar to the WFS case it
  60. is not always straight forward to determine what the crs is. For this reason the ``bboxCrs``
  61. property is used to configure a default crs to be used. The default value for the property is
  62. "EPSG:4326" and will be used in cases where all lookup heuristics fail to determine a crs for
  63. the bounding box.
  64. Request Body Size
  65. -----------------
  66. The monitor extension will capture the contents of the request body when a body is
  67. specified as is common with a PUT or POST request. However since a request body can
  68. be large the extension limits the amount captured to the first 1024 bytes by default.
  69. A value of ``0`` indicates that no data from the request body should be captured. A
  70. value of ``-1`` indicates that no limit should be placed on the capture and the entire
  71. body content should be stored.
  72. This limit is configurable with the ``maxBodySize`` property of the ``monitor.properties``
  73. file.
  74. .. note::
  75. When using database persistence it is important to ensure that the size of the body
  76. field in the database can accommodate the ``maxBodySize`` property.
  77. Ignore Post Processors
  78. ----------------------
  79. The monitor passes request information through post processors which enrich the request
  80. information with DNS lookup, Location using IP database etc. It is possible to disable
  81. these post processors if some enrichments are not required with ``ignorePostProcessors``
  82. property of the ``monitor.properties`` file.
  83. This parameter takes comma separated names of known post processors.
  84. The valid values are ``reverseDNS,geoIp,layerNameNormalizer``
  85. .. _request_filters:
  86. Request Filters
  87. ---------------
  88. By default not all requests are monitored. Those requests excluded include any web admin requests or any :ref:`monitor_query_api` requests. These exclusions are configured in the ``filter.properties`` file::
  89. /rest/monitor/**
  90. /web/**
  91. These default filters can be changed or extended to filter more types of
  92. requests. For example to filter out all WFS requests the following entry
  93. is added::
  94. /wfs
  95. Monitoring threads
  96. ------------------
  97. You can choose the number of post processor threads by configuring the ``postProcessorThreads``
  98. property in the ``monitor.properties`` file. The default is 2.
  99. DNS cache configuration
  100. -----------------------
  101. The reverseDNS post processor caches its result. You can modify the cache configuration
  102. by configuring the ``dnsCacheConfiguration`` property in the ``monitor.properties`` file.
  103. The default policy is ``expireAfterWrite=15m,maximumSize=1000`` . Consult the `guava cache builder documentation <https://guava.dev/releases/32.0.0-jre/api/docs/com/google/common/cache/CacheBuilderSpec.html>`_
  104. for all possibilities.
  105. How to determine the filter path
  106. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  107. The contents of ``filter.properties`` are a series of ant-style patterns that
  108. are applied to the *path* of the request. Consider the following request::
  109. http://localhost:8080/geoserver/wms?request=getcapabilities
  110. The path of the above request is ``/wms``. In the following request::
  111. http://localhost:8080/geoserver/rest/workspaces/topp/datastores.xml
  112. The path is ``/rest/workspaces/topp/datastores.xml``.
  113. In general, the path used in filters is comprised of the portion of the URL
  114. after ``/geoserver`` (including the preceding ``/``) and before the query string ``?``::
  115. http://<host>:<port>/geoserver/<path>?<queryString>
  116. .. note:: For more information about ant-style pattern matching, see the `Apache Ant manual <http://ant.apache.org/manual/dirtasks.html>`_.
  117. Samples
  118. -------
  119. monitor.properties
  120. ^^^^^^^^^^^^^^^^^^
  121. ::
  122. # storage and mode
  123. storage=memory
  124. mode=history
  125. # request body capture
  126. maxBodySize=1024
  127. # bounding box capture
  128. bboxMode=no_wfs
  129. bboxCrs=EPSG:4326
  130. filter.properties
  131. ^^^^^^^^^^^^^^^^^
  132. ::
  133. # filter out monitor query api requests
  134. /rest/monitor/**
  135. # filter out all web requests
  136. /web
  137. /web/**
  138. # filter out requests for WCS service
  139. /wcs