This is an automated email from the ASF dual-hosted git repository.

chetanm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d92be7  Change API call to Splunk to allow retrieval of large 
messages (#4519)
7d92be7 is described below

commit 7d92be7d4179c2db9780c582329c075732220e39
Author: Cosmin Stanciu <[email protected]>
AuthorDate: Tue Jun 25 01:25:21 2019 -0700

    Change API call to Splunk to allow retrieval of large messages (#4519)
    
    Fixes #4518
---
 .../apache/openwhisk/core/containerpool/logging/SplunkLogStore.scala  | 4 ++--
 .../openwhisk/core/containerpool/logging/SplunkLogStoreTests.scala    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStore.scala
 
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStore.scala
index 5c7768b..cd610b5 100644
--- 
a/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStore.scala
+++ 
b/common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStore.scala
@@ -105,12 +105,12 @@ class SplunkLogStore(
   override def fetchLogs(activation: WhiskActivation, context: UserContext): 
Future[ActivationLogs] = {
 
     //example curl request:
-    //    curl -u  username:password -k 
https://splunkhost:port/services/search/jobs -d exec_mode=oneshot -d 
output_mode=json -d "search=search index=\"someindex\" | spath=activation_id | 
search activation_id=a930e5ae4ad4455c8f2505d665aad282 |  table log_message" -d 
"earliest_time=2017-08-29T12:00:00" -d "latest_time=2017-10-29T12:00:00"
+    //    curl -u  username:password -k 
https://splunkhost:port/services/search/jobs -d exec_mode=oneshot -d 
output_mode=json -d "search=search index=\"someindex\" | spath=log_message | 
search activation_id=a930e5ae4ad4455c8f2505d665aad282 |  table log_message" -d 
"earliest_time=2017-08-29T12:00:00" -d "latest_time=2017-10-29T12:00:00"
     //example response:
     //    
{"preview":false,"init_offset":0,"messages":[],"fields":[{"name":"log_message"}],"results":[{"log_message":"some
 log message"}], "highlighted":{}}
     //note: splunk returns results in reverse-chronological order, therefore 
we include "| reverse" to cause results to arrive in chronological order
     val search =
-      s"""search index="${splunkConfig.index}"| spath 
${splunkConfig.activationIdField}| search ${splunkConfig.queryConstraints} 
${splunkConfig.activationIdField}=${activation.activationId.toString}| table 
${splunkConfig.logTimestampField}, ${splunkConfig.logStreamField}, 
${splunkConfig.logMessageField}| reverse"""
+      s"""search index="${splunkConfig.index}"| spath 
${splunkConfig.logMessageField}| search ${splunkConfig.queryConstraints} 
${splunkConfig.activationIdField}=${activation.activationId.toString}| table 
${splunkConfig.logTimestampField}, ${splunkConfig.logStreamField}, 
${splunkConfig.logMessageField}| reverse"""
 
     val entity = FormData(
       Map(
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStoreTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStoreTests.scala
index d505a36..f2e7ecb 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStoreTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/logging/SplunkLogStoreTests.scala
@@ -126,7 +126,7 @@ class SplunkLogStoreTests
               outputMode shouldBe Some("json")
               execMode shouldBe Some("oneshot")
               search shouldBe Some(
-                s"""search index="${testConfig.index}"| spath 
${testConfig.activationIdField}| search ${testConfig.queryConstraints} 
${testConfig.activationIdField}=${activation.activationId.toString}| table 
${testConfig.logTimestampField}, ${testConfig.logStreamField}, 
${testConfig.logMessageField}| reverse""")
+                s"""search index="${testConfig.index}"| spath 
${testConfig.logMessageField}| search ${testConfig.queryConstraints} 
${testConfig.activationIdField}=${activation.activationId.toString}| table 
${testConfig.logTimestampField}, ${testConfig.logStreamField}, 
${testConfig.logMessageField}| reverse""")
 
               (
                 Success(

Reply via email to