Library for sending log events to Splunk
from splunkhecwriter import SplunkHECWriter
hec_token = '<HEC-TOKEN-HERE>'
splunk_server = '127.0.0.1'
hec_writer = SplunkHECWriter(splunk_host=splunk_server, splunk_hec_token=hec_token)
msg = { 'foo': 'bar' }
hec_writer.send_msg(msg=msg)
from splunkhecwriter import SplunkHECWriter
hec_token = '<HEC-TOKEN-HERE>'
splunk_server = '127.0.0.1'
hec_writer = SplunkHECWriter(splunk_host=splunk_server, splunk_hec_token=hec_token)
msgs = []
msgs.append({ 'foo': 'bar' })
msgs.append({ 'bar': 'foo'})
hec_writer.send_msgs(msgs=msgs)
from splunkhecwriter import SplunkHECWriter
hec_token = '<HEC-TOKEN-HERE>'
splunk_server = '127.0.0.1'
sourcetype= 'foobar:json'
source = 'hec'
host = 'foobar'
hec_writer = SplunkHECWriter(
splunk_host=splunk_server,
splunk_hec_token=hec_token,
sourcetype=sourcetype,
source=source,
host=host)
msg = { 'foo': 'bar' }
hec_writer.send_msg(msg=msg)
This project is licensed under the Apache License - see the LICENSE.md file for details
This custom component is neither affiliated with nor endorsed by Splunk.