Skip to content

Python library for sending events to Splunk HEC (Http Event Collector)

License

Notifications You must be signed in to change notification settings

hellqvio86/splunkhecwriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI - Python Version PyPI GitHub GitHub issues GitHub last commit PyPI - Downloads

splunkhecwriter

Library for sending log events to Splunk

Example Code block 1

  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)

Example Code block 2

  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)

Example Code block 3

  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)

License

This project is licensed under the Apache License - see the LICENSE.md file for details

Disclaimer

This custom component is neither affiliated with nor endorsed by Splunk.

About

Python library for sending events to Splunk HEC (Http Event Collector)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published