An open API service indexing awesome lists of open source software.

https://github.com/teragrep/nlf_01

Teragrep Neon log format plugin for AKV_01
https://github.com/teragrep/nlf_01

teragrep

Last synced: 28 days ago
JSON representation

Teragrep Neon log format plugin for AKV_01

Awesome Lists containing this project

README

        

// Before publishing your new repository:
// 1. Write the readme file
// 2. Update the issues link in Contributing section in the readme file
// 3. Update the discussion link in config.yml file in .github/ISSUE_TEMPLATE directory

= nlf_01 - Teragrep Neon log format plugin for AKV_01

// Add a short description of your project. Tell what your project does and what it's used for.

This project implements https://github.com/teragrep/akv_01[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

// List your project's 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 https://docs.teragrep.com[docs.teragrep.com].

== How to compile
The project can be compiled by using https://maven.apache.org/guides/getting-started/index.html[Maven]. It is recommended to use Java 11.

[source,bash]
----
$ 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.

[source,java]
----
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 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.

// add instructions how people can start to use your project

== Contributing

// Change the repository name in the issues link to match with your project's name

You can involve yourself with our project by https://github.com/teragrep/nlf_01/issues/new/choose[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 http://www.extremeprogramming.org/values.html[values] of extreme programming.
. Pull requests must follow the principles of Object Thinking and Elegant Objects (EO).

Read more in our https://github.com/teragrep/teragrep/blob/main/contributing.adoc[Contributing Guideline].

=== Contributor License Agreement

Contributors must sign https://github.com/teragrep/teragrep/blob/main/cla.adoc[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.