You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/08/06 04:16:16 UTC

[43/48] lucene-solr:jira/http2: SOLR-12622: Ref guide example for configuring SolrSlf4jReporter

SOLR-12622: Ref guide example for configuring SolrSlf4jReporter


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b33df4ec
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b33df4ec
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b33df4ec

Branch: refs/heads/jira/http2
Commit: b33df4ecff2c138dd248b945833e2e59e4aa0424
Parents: 664187f
Author: Varun Thacker <va...@apache.org>
Authored: Sat Aug 4 11:13:14 2018 -0700
Committer: Varun Thacker <va...@apache.org>
Committed: Sat Aug 4 11:13:22 2018 -0700

----------------------------------------------------------------------
 solr/solr-ref-guide/src/metrics-reporting.adoc | 54 ++++++++++++++++++---
 1 file changed, 47 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b33df4ec/solr/solr-ref-guide/src/metrics-reporting.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/metrics-reporting.adoc b/solr/solr-ref-guide/src/metrics-reporting.adoc
index 631b5a1..ede9764 100644
--- a/solr/solr-ref-guide/src/metrics-reporting.adoc
+++ b/solr/solr-ref-guide/src/metrics-reporting.adoc
@@ -161,13 +161,19 @@ Reporter configurations are specified in `solr.xml` file in `<metrics><reporter>
     <int name="port">9999</int>
     <int name="period">60</int>
   </reporter>
-  <reporter name="collection1Updates" registry="solr.core.collection1" class="org.apache.solr.metrics.reporters.SolrSlf4jReporter">
-    <int name="period">300</int>
-    <str name="prefix">example</str>
-    <str name="logger">updatesLogger</str>
-    <str name="filter">QUERYHANDLER./update</str>
-  </reporter>
- </metrics>
+  <metrics>
+    <reporter name="log_metrics" group="core" class="org.apache.solr.metrics.reporters.SolrSlf4jReporter">
+      <int name="period">60</int>
+      <str name="filter">QUERY./select.requestTimes</str>
+      <str name="filter">QUERY./get.requestTimes</str>
+      <str name="filter">UPDATE./update.requestTimes</str>
+      <str name="filter">UPDATE./update.clientErrors</str>
+      <str name="filter">UPDATE./update.errors</str>
+      <str name="filter">SEARCHER.new.time</str>
+      <str name="filter">SEARCHER.new.warmup</str>
+      <str name="logger">org.apache.solr.metrics.reporters.SolrSlf4jReporter</str>
+    </reporter>
+  </metrics>
 ...
 </solr>
 ----
@@ -247,6 +253,40 @@ It takes the following arguments, in addition to the common arguments <<Reporter
 The name of the logger to use. Default is empty, in which case the group (or the initial part of the registry name that identifies a metrics group) will be used if specified in the plugin configuration.
 
 Users can specify logger name (and the corresponding logger configuration in e.g., Log4j configuration) to output metrics-related logging to separate file(s), which can then be processed by external applications.
+Here is an example for configuring the default log4j2.xml which ships in solr. This can be used in conjunction with the solr.xml example provided earlier in this page to configure the SolrSlf4jReporter
+
+[source,text]
+----
+<Configuration>
+  <Appenders>
+  ...
+    <RollingFile
+        name="MetricsFile"
+        fileName="${sys:solr.log.dir}/solr_metrics.log"
+        filePattern="${sys:solr.log.dir}/solr_metrics.log.%i" >
+      <PatternLayout>
+        <Pattern>
+          %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{node_name} %X{collection} %X{shard} %X{replica} %X{core}] %m%n
+        </Pattern>
+      </PatternLayout>
+      <Policies>
+        <OnStartupTriggeringPolicy />
+        <SizeBasedTriggeringPolicy size="32 MB"/>
+      </Policies>
+      <DefaultRolloverStrategy max="10"/>
+    </RollingFile>
+  ...
+  </Appenders>
+
+  <Loggers>
+  ...
+    <Logger name="org.apache.solr.metrics.reporters.SolrSlf4jReporter" level="info" additivity="false">
+      <AppenderRef ref="MetricsFile"/>
+    </Logger>
+  ...
+  </Loggers>
+</Configuration>
+----
 
 Each log line produced by this reporter consists of configuration-specific fields, and a message that follows this format: