Chat now with support
Chat with Support

We are aware of the intermittent issues with the support portal and are working to resolve them as quickly as possible. If you need assistance with opening a support case, please call support:1 (800) 306-9329 or (949) 754-8000

syslog-ng Open Source Edition 3.16 - Release Notes

python-blocks-nvpairs

  • To reference a name-value pair or a macro in the Python code, use the following format. For example, if the first argument in the definition of the function is called log-message, the value of the HOST macro is log-message['HOST'], and so on. (The log-message contains the entire log message (not just the text body) in a structure similar to a Python dict, but it is actually an object.)

  • You can define new name-value pairs in the Python function. For example, if the first argument in the definition of the function is called log-message, you can create a new name-value pair like this: log_message["new-macro-name"]="value". This is useful when you parse a part of the message from Python, or lookup a value based on data extracted from the log message.

    Note that the names of the name-value pairs are case-sensitive. If you create a new name-value pair called new-macro-name in Python, and want to reference it in another part of the syslog-ng OSE configuration file (for example, in a template), use the ${new-macro-name} macro.

  • You cannot override hard macros (see Hard vs. soft macros).

  • To list all available keys (names of name-value pairs), use the log_message.keys() function.

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating