Skip to content

Instantly share code, notes, and snippets.

Damien Dallimore damiendallimore

Block or report user

Report or block damiendallimore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@damiendallimore
damiendallimore / SplunkJavaLoggingExamples.java
Created Aug 5, 2012
Simple examples to demonstrate using the SplunkJavaLogging framework
View SplunkJavaLoggingExamples.java
package com.splunk.dev.logging.examples;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.dtdsoftware.splunk.logging.SplunkLogEvent;
import com.dtdsoftware.splunk.logging.SplunkLogEventFactory;
/**
* Simple examples to demonstrate using the SplunkJavaLogging framework
@damiendallimore
damiendallimore / GoGenHandler.py
Created Nov 8, 2016
Custom output handler for wrapping Gogen with the Splunk Command Modular Input. Just add this class to command_ta/bin/outputhandlers.py
View GoGenHandler.py
class GoGenHandler:
def __init__(self,**args):
self.index = args['index']
self.source = args['source']
self.sourcetype = args['sourcetype']
self.host = args['host']
def __call__(self,raw_cmd_output):
print "<stream><event><data>%s</data><source>%s</source><sourcetype>%s</sourcetype><index>%s</index><host>%s</host></event></stream>" % (encodeXMLText(raw_cmd_output),self.source,self.sourcetype,self.index,self.host)
@damiendallimore
damiendallimore / Splunk_Search_Java_Stacktace
Created Sep 12, 2013
Splunk Search for Java Exception Stacktrace events formatted by Splunk Java Logging
View Splunk_Search_Java_Stacktace
index=main sourcetype=logback throwable_class | makemv delim="," stacktrace_elements | table _time throwable_message throwable_class stacktrace_elements
@damiendallimore
damiendallimore / jdklogging.properties
Created Aug 5, 2012
Example logging framework configuration files for using SplunkJavaLogging REST/Raw TCP appenders
View jdklogging.properties
handlers = com.dtdsoftware.splunk.logging.jdk.handler.SplunkRestHandler
#handlers = com.dtdsoftware.splunk.logging.jdk.handler.SplunkRawTCPHandler
# Set the default logging level for the root logger
.level = INFO
# Set the default logging level for the splunk logger
splunk.logger = INFO
# Set the default logging level for new SplunkRestHandler instances
@damiendallimore
damiendallimore / PayloadOnlyMessageHandler.java
Created Oct 17, 2014
Custom Splunk JMS Modular Input message handler to output just the message payload
View PayloadOnlyMessageHandler.java
package com.splunk.modinput.jms.customhandler;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.jms.Message;
import com.splunk.modinput.Stream;
import com.splunk.modinput.StreamEvent;
@damiendallimore
damiendallimore / listEvents_example.txt
Created Nov 12, 2013
Example Splunk REST API stanza settings for polling the Cloudstack listEvents API endpoint. http://cloudstack.apache.org/docs/api/apidocs-4.1/TOC_Domain_Admin.html
View listEvents_example.txt
Endpoint URL
https://foobar.com/client/api
HTTP Method
GET
Authentication Type
@damiendallimore
damiendallimore / authhandlers.py
Created Nov 12, 2013
Custom Auth handler that the Splunk REST API Modular Input can use to connect to the Cloudstack REST API
View authhandlers.py
from requests.auth import AuthBase
import hmac
import base64
import hashlib
import urlparse
import urllib
class CloudstackAuth(AuthBase):
def __init__(self,**args):
@damiendallimore
damiendallimore / Splunk_Search_Splunk_Java_Agent_Method_Analysis
Last active Dec 22, 2015
Splunk Search for method tracing events collected by Splunk Java Agent
View Splunk_Search_Splunk_Java_Agent_Method_Analysis
index=main sourcetype=splunk-java-agent name=method* | transaction appName,threadID,className,methodName startswith="method_entered" endswith="method_exited" | stats min(duration) as "Min Execution Time" max(duration) as "Max Execution Time" avg(duration) as "Avg Execution Time" count as "Total Calls" sum(duration) as "Cumulative Execution Time" by className,methodName
View TcpInputDataExample.java
/**
* Stream some data to Splunk over raw TCP
*/
private static void tcpInputDataExample() {
Service splunkService = connectAndLoginToSplunkExample();
// Retrieve the input
TcpInput myInput = (TcpInput) splunkService.getInputs().get("5153");
// Open the socket and stream
View CreateUserExample.java
/**
* Create a user and then update it
*/
private static void createUserExample() {
Service splunkService = connectAndLoginToSplunkExample();
String username = "testuser";
String password = "changeme";
String[] roles = { "power", "testrole" };
User user = splunkService.getUsers().create(username, password, roles);
You can’t perform that action at this time.