cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
RC_Flyer
Level I

Logging to SPLUNK from a JMP script

Has anyone written JSL to send messages to a SPLUNK instance?  The idea would be to capture all of the log messages from multiple applications in a single spot

3 REPLIES 3
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Logging to SPLUNK from a JMP script

I've not used splunk but the idea of central logging is a good one. It does look easy enough to send data to splunk once the server is set up.  This is not tested, but something close to this should do the trick:

New HTTP Request(
	URL( "https://your-hostname:8088/services/collector" ),
	Method( "POST" ),
	Headers([
		"Accept" => "application/json",
		"Authorization" => "Splunk your-hec-token"
	]),
	JSON([
		"event" => "Test message",
		"sourcetype" => "jmp/jsl"
	])
) << Send;
RC_Flyer
Level I

Re: Logging to SPLUNK from a JMP script

At least in our SPLUNK instance the separator between Name and VALUE is a colon.  So, 
"event" => "Test message"

becomes

"event" : "Test message"

Re: Logging to SPLUNK from a JMP script

There are several Python packages that support logging to splunk.  It's far easier to utilize an existing Python package than having to roll your own REST handling interface code in JSL. 

My google query: python package for logging to splunk.

The top hit was

splunk-handler: A popular and widely used asynchronous logging handler that sends events to the Splunk HEC. It is designed to be a "drop-in" replacement for standard Python logging handlers.

With the Python Integration, you can utilize such packages and call from JSL with the Python Submit() or the Python Execute()

Recommended Articles