Skip to content

teragrep/nlf_01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nlf_01 - Teragrep Neon log format plugin for AKV_01

This project implements AKV_01 Plugin and PluginFactory interfaces for Neon log formats. The plugin is used to set more appropriate values for the fields in the produced SyslogMessage based on the type of event processed.

Features

  • Detects the type of event based on the event’s JSON payload.

  • Appropriate values are inserted into the produced SyslogMessage’s fields.

  • In case the event processed is not of expected type, a PluginException will be thrown so the event processing can fallback to a default Plugin implementation.

Documentation

See the official documentation on docs.teragrep.com.

How to compile

The project can be compiled by using Maven. It is recommended to use Java 11.

$ mvn clean package

How to use

The following code block is a simple example on how the plugin can be used. It demonstrates two things: How to initialize a ParsedEvent to be used as the input, and also how to use the NLFPluginFactory to initialize the NLFPlugin and provide it with the initialized ParsedEvent input as a parameter.

import com.teragrep.akv_01.event.EventImpl;
import com.teragrep.akv_01.event.ParsedEvent;
import com.teragrep.nlf_01.NLFPlugin;
import com.teragrep.nlf_01.NLFPluginFactory;
import com.teragrep.rlo_14.SyslogMessage;

// The EventImpl object can be used to produce a ParsedEvent
ParsedEvent parsedEvent = new EventImpl(...).parsedEvent();

// Initialize the plugin via the PluginFactory
NLFPluginFactory nlfPluginFactory = new NLFPluginFactory();
NLFPlugin nlfPlugin = nlfPluginFactory.plugin("");

// The plugin can produce syslogMessages from the provided ParsedEvent
List<SyslogMessage> syslogMessages = nlfPlugin.syslogMessage(parsedEvent);

The plugin uses environment variables CONTAINERLOG_HOSTNAME_ANNOTATION and CONTAINERLOG_APPNAME_ANNOTATION for Container type events. These environment variables should contain the JSON keys from where the values should be gathered. SYSLOGTYPE_PROCESSNAME environment variable is used for Syslog type events. The environment variable should contain the value for the JSON key ProcessName, which is used to determine the event type.

Contributing

You can involve yourself with our project by opening an issue or submitting a pull request.

Contribution requirements:

  1. All changes must be accompanied by a new or changed test. If you think testing is not required in your pull request, include a sufficient explanation as why you think so.

  2. Security checks must pass

  3. Pull requests must align with the principles and values of extreme programming.

  4. Pull requests must follow the principles of Object Thinking and Elegant Objects (EO).

Read more in our Contributing Guideline.

Contributor License Agreement

Contributors must sign Teragrep Contributor License Agreement before a pull request is accepted to organization’s repositories.

You need to submit the CLA only once. After submitting the CLA you can contribute to all Teragrep’s repositories.

About

Teragrep Neon log format plugin for AKV_01

Topics

Resources

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE
Unknown
license-header

Stars

Watchers

Forks

Packages

 
 
 

Languages