Python library to easily send CEF formatted messages to syslog server
Project description
syslogcef
Python library to easily send CEF formatted messages to syslog server.
It uses cefevent to format message payloads and offer two strategies to send syslogs over the network: RFC 5424 or RFC 3164. RFC 5424 is the default.
Install:
pip install syslogcef
Test sending a few messages with:
python3 -m syslogcef.testmessages --host <host> --port <port> --proto [TCP|UDP]
Usage:
from syslogcef import SyslogCEFSender, Rfc3164SyslogSender
# Create syslog sender.
syslog = SyslogCEFSender(
# Syslog server settings:
host='10.1.2.3',
port='514',
protocol='TCP',
# Hopefully the above names does not clash with any CEF field name.
# CEF fields applied to all events:
deviceProduct='MyProgram',
deviceVendor='MyCompany',
deviceVersion='1.0.2',
# Overriding the default strategy to send syslog over the network with RFC 3164 format.
# Do not specify this argument to use RFC 5424.
syslog_sender_class=Rfc3164SyslogSender)
# Register CEF events.
syslog.register_event('100', name='CPU temp is OK', severity=0)
syslog.register_event('101', name='CPU temp is rising', severity=5)
syslog.register_event('102', name='CPU temp is too high', severity=9,
# CEF fields applied to all '102' events:
reason="Exceeds 70 degres celsius")
# Send one syslog message.
syslog.send('102', message="The CPU temp is 88 degres celsius.",
# CEF fields applied only to this event:
sourceHostName="mydevice.mydomain.com",
sourceMacAddress="00:00:ee:00:52:bb")
See cefevent for complete list of fields.
Read the full ArcSight CEF format for more informations.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
syslogcef-0.1.7.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file syslogcef-0.1.7.tar.gz
.
File metadata
- Download URL: syslogcef-0.1.7.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dd51e837ca356bd4e218514eb79f3741a9cb04ba87727aaa55ca3566773b3ca |
|
MD5 | 8956197f2cf6cf71f73865f996e9cbdc |
|
BLAKE2b-256 | 24152928f7adbd96c38e5cc3737a00cc6d5c3648c2bab37de531180345bb4e88 |
File details
Details for the file syslogcef-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: syslogcef-0.1.7-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8207de4c4b15ea974d41a0b7e718cd9a52b1255842374f959191adf439d98204 |
|
MD5 | 6ed0b088a6b0cfe2b726f473fe832b06 |
|
BLAKE2b-256 | c048d08678b1b8deb1af3eedef7c6096658a3b803ca924017ab9a7ff1df065cd |