jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/371950 )

Change subject: Send logs to logstash
......................................................................


Send logs to logstash

Add logstash-logback-encoder as a dependency to enable sending logs to
logstash. The acutal logback configuration is entirely in puppet. This
repo provides a default logback configuration which is loaded unless
a different configuration is specified in /etc/default/wdqs-*

This change needs to be deployed with its related puppet change.

Bug: T172710
Change-Id: Ie9075dfbc34055748976648fa3d06a91fd2d9563
---
M dist/src/script/runBlazegraph.sh
M dist/src/script/runUpdate.sh
M pom.xml
M tools/pom.xml
M war/pom.xml
5 files changed, 35 insertions(+), 11 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/dist/src/script/runBlazegraph.sh b/dist/src/script/runBlazegraph.sh
index 4be9c04..e4c5b07 100755
--- a/dist/src/script/runBlazegraph.sh
+++ b/dist/src/script/runBlazegraph.sh
@@ -9,6 +9,7 @@
 PORT=${PORT:-"9999"}
 DIR=${DIR:-`dirname $0`}
 HEAP_SIZE=${HEAP_SIZE:-"16g"}
+LOG_CONFIG=${LOG_CONFIG:-""}
 MEMORY=${MEMORY:-"-Xms${HEAP_SIZE} -Xmx${HEAP_SIZE}"}
 GC_LOGS=${GC_LOGS:-"-Xloggc:/var/log/wdqs/wdqs-blazegraph_jvm_gc.%p.log \
          -XX:+PrintGCDetails \
@@ -52,9 +53,14 @@
 # Blazegraph HTTP User Agent for federation
 USER_AGENT="Wikidata Query Service; https://query.wikidata.org/";;
 
+LOG_OPTIONS=""
+if [ ! -z "$LOG_CONFIG" ]; then
+    LOG_OPTIONS="-Dlogback.configurationFile=${LOG_CONFIG}"
+fi
+
 echo "Running Blazegraph from `pwd` on :$PORT/$CONTEXT"
 exec java \
-     -server -XX:+UseG1GC ${MEMORY} ${DEBUG} ${GC_LOGS} \
+     -server -XX:+UseG1GC ${MEMORY} ${DEBUG} ${GC_LOGS} ${LOG_OPTIONS} \
      -Dcom.bigdata.rdf.sail.webapp.ConfigParams.propertyFile=${CONFIG_FILE} \
      -Dorg.eclipse.jetty.server.Request.maxFormContentSize=200000000 \
      -Dcom.bigdata.rdf.sparql.ast.QueryHints.analytic=true \
diff --git a/dist/src/script/runUpdate.sh b/dist/src/script/runUpdate.sh
index e56a96f..b09b161 100755
--- a/dist/src/script/runUpdate.sh
+++ b/dist/src/script/runUpdate.sh
@@ -1,5 +1,9 @@
 #!/usr/bin/env bash
 
+if [ -r /etc/default/wdqs-updater ]; then
+  . /etc/default/wdqs-updater
+fi
+
 HOST=http://localhost:9999
 CONTEXT=bigdata
 MEMORY="-Xms2g -Xmx2g"
@@ -13,6 +17,7 @@
          -XX:+UseGCLogFileRotation \
          -XX:NumberOfGCLogFiles=10 \
          -XX:GCLogFileSize=20M"
+LOG_CONFIG=${LOG_CONFIG:-""}
 NAMESPACE=wdq
 UPDATER_OPTS=${UPDATER_OPTS:-""}
 
@@ -53,13 +58,9 @@
 if [ ! -z "$SKIPSITE" ]; then
     ARGS="$ARGS --skipSiteLinks"
 fi
-
-LOG=""
-if [ -f /etc/wdqs/updater-logs.xml ]; then
-    LOG="-Dlogback.configurationFile=/etc/wdqs/updater-logs.xml"
-fi
-if [ -f updater-logs.xml ]; then
-    LOG="-Dlogback.configurationFile=updater-logs.xml"
+LOG_OPTIONS=""
+if [ ! -z "$LOG_CONFIG" ]; then
+    LOG_OPTIONS="-Dlogback.configurationFile=${LOG_CONFIG}"
 fi
 
 CP=lib/wikidata-query-tools-*-jar-with-dependencies.jar
@@ -67,4 +68,4 @@
 SPARQL_URL=$HOST/$CONTEXT/namespace/$NAMESPACE/sparql
 AGENT=-javaagent:lib/jolokia-jvm-1.3.1-agent.jar=port=8778,host=localhost
 echo "Updating via $SPARQL_URL"
-exec java -cp $CP $MEMORY $GC_LOGS $LOG $TIMEOUT_ARG $AGENT ${UPDATER_OPTS} 
$MAIN $ARGS --sparqlUrl $SPARQL_URL "$@"
+exec java -cp $CP $MEMORY $GC_LOGS $LOG_OPTIONS $TIMEOUT_ARG $AGENT 
${UPDATER_OPTS} $MAIN $ARGS --sparqlUrl $SPARQL_URL "$@"
diff --git a/pom.xml b/pom.xml
index 866e8a8..7cbdbac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,7 @@
     <blazegraph.version>2.1.5-SNAPSHOT</blazegraph.version>
     <jackson.version>2.2.3</jackson.version>
     <jetty.version>9.2.3.v20140905</jetty.version>
+    <logback.version>1.2.3</logback.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <sesame.version>2.7.12</sesame.version>
     <slf4j.version>1.7.10</slf4j.version>
@@ -84,12 +85,12 @@
       <dependency>
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-classic</artifactId>
-        <version>1.1.2</version>
+        <version>${logback.version}</version>
       </dependency>
       <dependency>
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-core</artifactId>
-        <version>1.1.2</version>
+        <version>${logback.version}</version>
       </dependency>
       <dependency>
         <groupId>com.blazegraph</groupId>
@@ -555,6 +556,12 @@
         <version>1.4.01</version>
       </dependency>
       <dependency>
+        <groupId>net.logstash.logback</groupId>
+        <artifactId>logstash-logback-encoder</artifactId>
+        <version>4.11</version>
+        <scope>runtime</scope>
+      </dependency>
+      <dependency>
         <groupId>org.jhades</groupId>
         <artifactId>jhades</artifactId>
         <version>1.0.4</version>
diff --git a/tools/pom.xml b/tools/pom.xml
index faeca64..28d668c 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -115,6 +115,11 @@
       <artifactId>common</artifactId>
     </dependency>
     <dependency>
+      <groupId>net.logstash.logback</groupId>
+      <artifactId>logstash-logback-encoder</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
       <scope>runtime</scope>
diff --git a/war/pom.xml b/war/pom.xml
index a7a7b64..638a048 100644
--- a/war/pom.xml
+++ b/war/pom.xml
@@ -40,6 +40,11 @@
       <scope>runtime</scope>
     </dependency>
     <dependency>
+      <groupId>net.logstash.logback</groupId>
+      <artifactId>logstash-logback-encoder</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
       <groupId>org.jhades</groupId>
       <artifactId>jhades</artifactId>
       <scope>runtime</scope>

-- 
To view, visit https://gerrit.wikimedia.org/r/371950
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie9075dfbc34055748976648fa3d06a91fd2d9563
Gerrit-PatchSet: 8
Gerrit-Project: wikidata/query/rdf
Gerrit-Branch: master
Gerrit-Owner: Gehel <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to