The Python destination allows you to write your own destination in Python. The python() destination has the following options. The class() option is mandatory. For details on writing destinations in Python, see python: writing custom Python destinations.
Type: | string |
Default: | N/A |
Description: The name of the Python class that implements the destination, for example:
python( class("MyPythonDestination") );
If you want to store the Python code in an external Python file, the class() option must include the name of the Python file containing the class, without the path and the .py extension, for example:
python( class("MyPythonfilename.MyPythonDestination") );
For details, see Python code in external files
Description: This option enables putting outgoing messages into the disk-buffer file of the destination to avoid message loss in case of a system failure on the destination side. It has the following options:
reliable() | |||
Type: | yes|no | ||
Default: | no | ||
Description: If set to yes, syslog-ng PE cannot lose logs in case of reload/restart, unreachable destination or syslog-ng PE crash. This solution provides a slower, but reliable disk-buffer option. It is created and initialized at startup and gradually grows as new messages arrive. If set to no, the normal disk-buffer option will be used. This provides a faster, but less reliable disk-buffer option.
|
disk-buf-size() | |
Type: | number [bytes] |
Default: | |
Description: This is a required option. The maximum size of the disk-buffer file in bytes. The minimum value is 1048576 bytes. If you set a smaller value, the minimum value will be used automatically. It replaces the old log-disk-fifo-size() option. |
mem-buf-length() | |
Type: | number [messages] |
Default: | 10000 |
Description: Use this option if the option reliable() is set to no. This option contains the number of messages stored in overflow queue. It replaces the old log-fifo-size() option. It inherits the value of the global log-fifo-size() option if provided. If it is not provided, the default value is 10000 messages. Note that this option will be ignored if the option reliable() is set to yes. |
mem-buf-size() | |
Type: | number [bytes] |
Default: | 163840000 |
Description: Use this option if the option reliable() is set to yes. This option contains the size of the messages in bytes that is used in the memory part of the disk-buffer file. It replaces the old log-fifo-size() option. It does not inherit the value of the global log-fifo-size() option, even if it is provided. Note that this option will be ignored if the option reliable() is set to no. |
qout-size() | |
Type: | number [messages] |
Default: | 64 |
Description: The number of messages stored in the output buffer of the destination. Note that if you change the value of this option and the disk-buffer file already exists, the change will take effect when the disk-buffer file becomes empty. |
Options reliable() and disk-buf-size() are required options.
In the following case reliable disk-buffer() is used.
destination d_demo { network("127.0.0.1" port(3333) disk-buffer( mem-buf-size(10000) disk-buf-size(2000000) reliable(yes) dir("/tmp/disk-buffer") ) ); };
In the following case normal disk-buffer() is used.
destination d_demo { network("127.0.0.1" port(3333) disk-buffer( mem-buf-length(10000) disk-buf-size(2000000) reliable(no) dir("/tmp/disk-buffer") ) ); };
Type: | number |
Default: | 0 |
Description: The syslog-ng PE application can store fractions of a second in the timestamps according to the ISO8601 format. The frac-digits() parameter specifies the number of digits stored. The digits storing the fractions are padded by zeros if the original timestamp of the message specifies only seconds. Fractions can always be stored for the time the message was received.
NOTE: The syslog-ng PE application can add the fractions to non-ISO8601 timestamps as well.
NOTE: As syslog-ng PE is precise up to the microsecond, when the frac-digits() option is set to a value higher than 6, syslog-ng PE will truncate the fraction seconds in the timestamps after 6 digits.
Type: | number |
Default: | Use global setting. |
Description: The number of messages that the output queue can store.
Accepted values: |
drop-message|drop-property|fallback-to-string| silently-drop-message|silently-drop-property|silently-fallback-to-string |
Default: | Use the global setting (which defaults to drop-message) |
Description: Controls what happens when type-casting fails and syslog-ng PE cannot convert some data to the specified type. By default, syslog-ng PE drops the entire message and logs the error. Currently the value-pairs() option uses the settings of on-error().
drop-message: Drop the entire message and log an error message to the internal() source. This is the default behavior of syslog-ng PE.
drop-property: Omit the affected property (macro, template, or message-field) from the log message and log an error message to the internal() source.
fallback-to-string: Convert the property to string and log an error message to the internal() source.
silently-drop-message: Drop the entire message silently, without logging the error.
silently-drop-property: Omit the affected property (macro, template, or message-field) silently, without logging the error.
silently-fallback-to-string: Convert the property to string silently, without logging the error.
Type: | string |
Default: | N/A |
Description: This option allows you to pass custom values from the configuration file to the Python code. Enclose both the option names and their values in double-quotes. The Python code will receive these values during initialization as the options dictionary. For example, you can use this to set the IP address of the server from the configuration file, so it is not hard-coded in the Python object.
python( class("MyPythonClass") options( "host" "127.0.0.1" "port" "1883" "otheroption" "value") );
For example, you can refer to the value of the host field in the Python code as options["host"]. Note that the Python code receives the values as strings, so you might have to cast them to the type required, for example: int(options["port"])
Type: | string |
Default: |
None |
Description:If you receive the following error message during syslog-ng PE startup, set the persist-name() option of the duplicate drivers:
Error checking the uniqueness of the persist names, please override it with persist-name option. Shutting down.
This error occurs if you use identical drivers in multiple sources, for example, if you configure two file sources to read from the same file. In this case, set the persist-name() of the drivers to a custom string, for example, persist-name("example-persist-name1").
NOTE: Starting with
log { source { python(class(PyNetworkSource) options("port" "8080") persist-name("<unique-string>); }; source { python(class(PyNetworkSource) options("port" "8081")); }; };
Alternatively, you can include the following line in the Python package: @staticmethod generate_persist_name. For example:
from syslogng import LogSource class PyNetworSource(LogSource): @staticmethod def generate_persist_name(options): return options["port"] def run(self): pass def request_exit(self): pass
Type: | number |
Default: | 0 |
Description: Sets the maximum number of messages sent to the destination per second. Use this output-rate-limiting functionality only when using the disk-buffer option as well to avoid the risk of losing messages. Specifying 0 or a lower value sets the output limit to unlimited.
Type: | parameter list of the value-pairs() option |
Default: | scope("selected-macros" "nv-pairs") |
Description: The value-pairs() option creates structured name-value pairs from the data and metadata of the log message. For details on using value-pairs(), see Structuring macros, metadata, and other value-pairs.
NOTE: Empty keys are not logged.
You can use this option to limit which name-value pairs are passed to the Python code for each message. Note that if you use the value-pairs() option, the Python code receives the specified value-pairs as a Python dict. Otherwise, it receives the message object. In the following example, only the text of the log message is passed to Python.
destination d_python_to_file { python( class("pythonexample.TextDestination") value-pairs(key(MESSAGE)) ); };
Microsoft Azure Sentinel is Microsoft's native cloud based SIEM solution. Beside Microsoft's own cloud services, it can accept log messages from external sources. Microsoft provides 26 predefined Data connectors and a HTTP Data Collector API for further integrations. Using this public HTTP REST interface, syslog-ng Premium Edition (syslog-ng PE) can ingest log messages directly to Microsoft Azure Sentinel cloud using the http() destination driver.
For more information about Microsoft Azure Sentinel, see Microsoft Azure: Azure Sentinel documentation.
For more information about Data connectors used in Microsoft Azure Sentinel, see Microsoft Azure: Connect data sources.
|
Caution:
This is a Preview Feature, which provides an insight to planned enhancements to functionality in the product. Consider this Preview Feature a work in progress, as it may not represent the final design and functionality. This feature has completed QA release testing, but its full impact on production systems has not been determined yet, and potential future changes in functionality and the user interface may result in compatibility issues in your current settings. One Identity recommends the following:
However, you are welcome to try this feature and if you have any feedback, Contact One Identity. Support Policy on Product Preview Features The One Identity Support Team will:
|
|
Caution:
Hazard of data loss! The sentinel() destination's fields() parameter is optional and has the following default values: fields("Computer=$HOST HostName=$HOST ProcessID=$PID SyslogMessage=$MSGHDR$MSG Facility=$FACILITY SeverityLevel=$LEVEL HostIP=$SOURCEIP EventTime=$S_ISODATE") Although it is possible to customize these default values, an incorrect configuration may result in log loss. The sentinel() destination is an EXPERIMENTAL feature, and data loss resulting from customized default values is not yet covered by support. Therefore, One Identity recommends that you do not customize the default values of the fields() parameter unless you know exactly what you are doing. |
The current implementation of the sentinel() destination has the following limitations:
Only the PUT and the POST methods are supported.
HTTPS connections, as well as password-based and certificate-based authentication, are supported.
If the server returns a status code beginning with 4 (for example, 404) to the POST or PUT request, syslog-ng PE drops the message without attempting to resend it.
NOTE: Typically, only the central syslog-ng PE server uses this destination. For more information on the server mode, see Server mode.
destination d_sentinel { sentinel( workspace-id("<MS provided Workspace ID / UUID>") auth-secret("<MS provided Shared key / Secret>") ); }
Starting with version 7.0.19, syslog-ng Premium Edition (syslog-ng PE) can ingest log messages directly to Microsoft Azure Sentinel by using Microsoft Azure Sentinel's public HTTP Data Collector API interface.
The syslog-ng PE application can directly post log messages to the Microsoft Azure Sentinel cloud using the http() destination driver.
To configure syslog-ng PE to forward messages to Microsoft Azure Sentinel, you must have an active Microsoft Azure Sentinel Workspace. For more information, see Microsoft Azure Sentinel: Quickstart: On-board Azure Sentinel.
While configuring your Microsoft Azure Sentinel Workspace according to the Microsoft Azure Sentinel: Quickstart: On-board Azure Sentinel guide's Connect data sources section, you will find certain credentials of the selected Microsoft Azure Sentinel Workspace (namely, WORKSPACE ID and PRIMARY KEY) that you should make a note of. The WORKSPACE ID and PRIMARY KEY credentials are required so that syslog-ng PE can authenticate to Microsoft servers.
To gather the required credentials to configure syslog-ng PE as a Data connector for Microsoft Azure Sentinel,
Select Syslog from the list of connectors.
A new panel will open on the right.
WORKSPACE ID
In the syslog-ng PE configuration, this will function as the workspace-id parameter.
PRIMARY KEY
In the syslog-ng PE configuration, this will function as the auth-secret parameter.
In your syslog-ng PE configuration, you can use the credentials you have gathered like this:
d_sentinel { sentinel( workspace-id("01234567-89ab-cdef-0123-456789abcdef") // Provided by Microsoft: unique hexadecimal number, identifying your Sentinel instance. auth-secret("MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZgo=") // Provided by Microsoft: Base64-encoded secret, identifying your application. # optional log-type("Syslog_CL") ); };
|
Caution:
Hazard of data loss! The sentinel() destination's fields() parameter is optional and has the following default values: fields("Computer=$HOST HostName=$HOST ProcessID=$PID SyslogMessage=$MSGHDR$MSG Facility=$FACILITY SeverityLevel=$LEVEL HostIP=$SOURCEIP EventTime=$S_ISODATE") Although it is possible to customize these default values, an incorrect configuration may result in log loss. The sentinel() destination is an EXPERIMENTAL feature, and data loss resulting from customized default values is not yet covered by support. Therefore, One Identity recommends that you do not customize the default values of the fields() parameter unless you know exactly what you are doing. |
© 2023 One Identity LLC. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy