CAP_VARBUFFERS

(User-Defined Buffer-Lengths)


Home Page

Configure Syslogd2

Sample Files

Deployment

New Concepts

The Config File

Compile & Install

Misc Topics

Capabilities

CAP_???

The Reason for Varbuffers
Configuring VarBuffers

Demonstrations

Reference

Glossary of Terms

External Links

Syslogd2 Project Site
DBD2 Home Page
DBD2 Project Site

Other References

RFC 3164 (The BSD Syslog Protocol)
RFC 3339 (Internet Time Format)
RFC 5424 (Syslog Version 1)

Focus on Network

Syslogd2 Input Options
Syslogd2 Output Options
Queueing and Data Loss

The Reason for VarBuffers

[Top of page]

Traditional syslog logging applications have no need to change the size of their working buffers as they expect (more or less) fixed-length messages with predictable maximum-lengths. This is not true of Syslogd2.

Part of Syslogd2's designed operation is and operation is to gather and forward data from a maximum number and type of inputs. Prior to (but especially since) the implementation of CAP_JOURNALTHREADS, Syslogd2 had the ability to access or create certain pieces of meta-data. One of the original goals for Syslogd2 was to select specific messaes (based on content rather than facility/priority (facpri) and to forward any user-provided information (static-data or otherwise) to downstream processors. As the design and implementation of DBD2 matured, it became clear taht DBD2 could well act as one of those primary 'downstream processes', putting named-data fields (in name=value format) into one or more databases for user reporting.

What was somewhat less obvious (until actual testing) is that the number of fields and length of the overall data strings from CAP_JOURNALTHREADS) (let alone any user-application) was sufficient to cause routine crashes of both Syslogd2 and DBD2 due to buffer overflow conditions.

The 'obvious' solution would have been to increase the buffer size, but how big is 'reasonable' ? CAP_JOURNALTHREADS routinely produces sd-string lengths of over 700 bytes (assuming all fields are length-limited to 80 characters). At least 3 fields ('MESSAGE', 'SYSLOG_RAW' and '_CMDLINE') can each easily reach a thousand or more bytes if unconstrained. Fortunately (for me), such long strings are not that useful for adminstration, so truncation is certainly one option that has been implemented to cope with demands for oversize data buffers. However, there are times when admins may have legitimate desires to transmit (or log to disk) the entirety of long data strings (or a high number of data fields). This leads to the other option I chose to implement - which is to allow the user to modify the lengths of internal buffers at run-time, giving the user control over the tradeoff between long data-strings and memory conservation.

Syslogd2 compiles with default values for all variable buffers that should be adequate for the vast majority of logging situations. There are several possible scenarios however, where the default buffer values have proven (or are likely to prove) woefully inadequate. One of these occurred during the implementation of CAP_JOURNALTHREADS. Due to the over 700 byte length of the aggregate SD-String generated by (not quite) all available journal fields, Syslogd2 routinely 'blew up' while processing input filters (where the SD-String is manipulated independent of the overall input-string or message-string).

To address this issue, I now create an estimated SDStringLength based on the number of journal fields being displayed, their average length, plus the global and individual lengths specified by the user. I use this estimate as a 'floor' for the MaxSDStringLength variable whenever CAP_JOURNALTHREADS is declared. This estimation process should work to resolve the issue of long SDStringLength values from CAP_JOURNALTHREADS, but will do nothing to resolve the same issue when triggered by user-defined static-data-fields provided to Syslogd2 as input. This is the primary reason for CAP_VARBUFFERS. Other reasons may surface as Syslogd2 gains usage and experiences.

Configuring VarBuffers

[Top of page]

Like all global variables in Syslogd2, the bufferlengths exposed to the user by CAP_VARBUFFERS are configured using the --defaults command. Multiple instances of the --defaults command may exist in a given configuration file. No configuration is ncessary if the default values are satisfactory.


As Syslogd2 continues to mature, additional internal buffer-lengths may be added to the above list.

[Top of page]