Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x
- Puppet >= 5.0.0 < 7.0.0
Start using this module
Add this module to your Puppetfile:
mod 'genebean-nxlog', '2.0.0'
Learn more about managing modules with a PuppetfileDocumentation
nxlog
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with nxlog
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
This module manages NXLog. It is primarily targeted at Windows but should work on Linux too so long as the package is available via some repository. Automated testing is done via Travis CI and tests against both Puppet 3.x and 4.x.
Module Description
This module installs the nxlog
package, builds a config file using
puppetlabs-concat
, and manages the nxlog
service. Since the config file
for NXLog is broken up into sections, and most of these can be repeated, the
choice was made to utilize defined types similar to the way the Apache module
does with virtual hosts.
Setup
What nxlog affects
- nxlog package
- nxlog config file
- nxlog service
Beginning with nxlog
This is an example of how to build a full config file:
class {'nxlog':
conf_dir => 'C:/Program Files (x86)/nxlog/conf', # note the /'s here
conf_file => 'nxlog.conf',
ensure_setting => latest,
nxlog_root => 'C:\Program Files (x86)\nxlog',
}
nxlog::config::extension { 'json':
ext_module => 'xm_json',
}
nxlog::config::input { 'eventlog_json':
input_execs => [
'delete($Keywords)',
'$raw_event = to_json()',
],
input_module => 'im_msvistalog',
}
nxlog::config::output { 'local_json':
output_file_path => 'C:\eventlog-json.txt',
output_module => 'om_file',
}
nxlog::config::output { 'logserver':
output_address => 'logserver.example.com',
output_module => 'om_udp',
output_port => '6371',
}
nxlog::config::route { 'local':
route_destination => [ 'local_json', ],
route_source => [ 'eventlog_json', ],
}
nxlog::config::route { 'logserver':
route_destination => [ 'logserver', ],
route_source => [ 'eventlog_json', ],
}
Usage
Class nxlog
These settings are used both in the config file and by the other parts of the module.
conf_dir
- the directory where nxlog.conf resides
conf_file
- the name of the config file
ensure_setting
- this is passed to the package resource
nxlog_root
- the installation directory for the nxlog program. On Windows this
is a required setting as NXLog will not start otherwise.
Defined Types
Each of these builds a section of the config file.
nxlog::config::extension
- builds an Extension section using the specified
name.
ext_module
- the name of the extension module to useext_options
- an array of options for the added ext_module. Each item in the array will be an line in this section of the config file.
nxlog::config::input
- builds an Input section using the specified name.
input_execs
- an array of Exec statements to include (Optional)input_file_path
- defines the path to use if reading from a local fileinput_module
- the name of the input module to useinput_type
- the name of the registered input reader function to use
nxlog::config::output
- builds an Output section using the specified name.
output_address
- the address of the remote host to send data tooutput_execs
- an array of Exec statements to include (Optional)output_file_path
- defines the path to use if writing to a local fileoutput_module
- the name of the output module to useoutput_port
- the port on the remote host to send data to
nxlog::config::processor
- builds a Processor section using the specified name.
processor_module
- the name of the processor module to useporcessor_input_format
- the format of the data being converted or processedprocessor_output_format
- the format to convert the data toprocessor_csv_output_fields
- fields which are placed in the CSV lines. The field names must have the dollar sign "$" prepended.
nxlog::config::route
- builds a Route section using the specified name.
- route_destination - an array of outputs to send data to
- route_source - an array of inputs to send to the named destination
Limitations
On Windows it is assumed that you are using Chocolatey to install packages.
On Linux it is assumed that you have a custom repo which contains nxlog-ce
.
You can work around this by installing the program separately and setting
ensure_setting => present
.
nxlog::config::processor
chooses a template based on the value of
processor_module
. Not all of the possible modules have had templates generated
for them yet... if you want one that does not yet feel free to file a bug report
or, better yet, send a pull request.
Development
Pull requests are welcome! A Vagrantfile is included in this module to aide in testing and development. All code must have tests before it will be merged but I am happy to help with that part.
Contributors
- Jaime Viloria (@cerealcake) - Added support for specifying output options.
- Jaime Viloria (@cerealcake) - Added support for specifying options for extension modules.
- @egouraud - Added support for specifying the input file used by some input modules.
- Camilo Cota (@camilocot) - Added the
input_type
setting
2020-10-14 - Relasee 2.0.0
- modernization including PDK and removal of legacy facts and top scope references
- add
unix2dos
function to template output so that line endings are correct - directory separator for Linux and Windows
2017-10-11 - Release 1.4.2
- Updated dependencies so the puppetlabs version of the chocolatey module is used
- Updated testing related files
2017-08-06 - Release 1.4.1
- First run at using modulesync
- Stopped testing against Puppet 3
- Started testing against Puppet 5
2016-09-09 Release 1.4.0
- Camilo Cota (@camilocot) added the
input_type
setting - I updated the Gemfile to make json and json_pure work with multiple ruby versions.
- Added additional puppet-lint tests and update puppet-lint
- Added a Travis test for Puppet 3.x w/ strict variables
2015-10-07 Release 1.3.0
- Jaime Viloria (@cerealcake) added support for specifying output options
2015-10-07 Release 1.2.2
- Fixed an indentation issue
2015-10-07 Release 1.2.0
- Fixed error in example code in the README
- Added support for using processors
- Added support for output execs
- Adjusted the service resource so that it restarts when the config is updated
2015-10-07 Release 1.1.0
- Jaime Viloria (@cerealcake) added support for specifying options for extension modules.
- @egouraud added support for specifying the input file used by some input modules.
- support for defining the package name was added
- nxlog_root was made optional as it is not needed on Linux when installing via packages.
2015-06-18 Release 1.0.0
- Initial release
Dependencies
- puppetlabs/chocolatey (>= 3.0.0 < 4.0.0)
- puppetlabs/concat (>= 5.0.0 < 6.0.0)
- puppetlabs/stdlib (>= 5.0.0 < 6.0.0)
BSD 3-Clause License Copyright (c) 2015, Gene Liverman All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.