diff --git a/gradle.properties b/gradle.properties index bef6f72..f86d269 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ version=1.1.0.BUILD-SNAPSHOT junitVersion=4.11 jodaTimeVersion=2.3 -splunkVersion=1.0.0 +splunkVersion=1.3.0 log4jVersion=1.2.17 springIntegrationVersion=4.0.2.RELEASE commonsPoolVersion=1.6 diff --git a/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java b/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java index eb22179..936cac9 100644 --- a/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java +++ b/src/main/java/org/springframework/integration/splunk/support/SplunkServiceFactory.java @@ -25,6 +25,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import javax.xml.bind.DatatypeConverter; + import com.splunk.Service; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -103,7 +105,7 @@ public class SplunkServiceFactory implements ServiceFactory { catch (Exception e) { if (LOGGER.isInfoEnabled()) { LOGGER.info(String.format("could not connect to Splunk Server @ %s:%d - %s, try next one", - splunkServer.getHost(), splunkServer.getPort(), e.getMessage())); + splunkServer.getHost(), splunkServer.getPort(), e.getMessage())); } } } @@ -133,6 +135,10 @@ public class SplunkServiceFactory implements ServiceFactory { args.put("username", splunkServer.getUsername()); args.put("password", splunkServer.getPassword()); + String auth = splunkServer.getUsername() + ":" + splunkServer.getPassword(); + String authToken = "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes()); + args.put("token", authToken); + return new Callable() { public Service call() throws Exception {