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.
-
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 defaultPlugin
implementation.
See the official documentation on docs.teragrep.com.
The project can be compiled by using Maven. It is recommended to use Java 11.
$ mvn clean package
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.
You can involve yourself with our project by opening an issue or submitting a pull request.
Contribution requirements:
-
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.
-
Security checks must pass
-
Pull requests must align with the principles and values of extreme programming.
-
Pull requests must follow the principles of Object Thinking and Elegant Objects (EO).
Read more in our Contributing Guideline.
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.