Skip to content

Commit

Permalink
Add source code
Browse files Browse the repository at this point in the history
  • Loading branch information
dlancelin committed Dec 19, 2018
1 parent b04fa72 commit f52a4e9
Show file tree
Hide file tree
Showing 21 changed files with 2,642 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ buildNumber.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar

node_modules/
node/
build/
cache/
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
dist: trusty
sudo: required
language: java
jdk:
- openjdk8
addons:
apt:
packages:
- rpm
install:
- git clone --branch 2.4 --depth=1 --no-single-branch https://github.com/Graylog2/graylog2-server ../graylog2-server
- (cd ../graylog2-server && mvn -DskipTests=true compile -B -V)
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dskip.web.build=true -B -V
script:
- mvn package -B
before_deploy:
- mvn jdeb:jdeb && export RELEASE_DEB_FILE=$(ls target/*.deb)
- mvn rpm:rpm && export RELEASE_RPM_FILE=$(find target/ -name '*.rpm' | tail -1)
- rm -f target/original-*.jar
- export RELEASE_PKG_FILE=$(ls target/*.jar)
- echo "Deploying release to GitHub releases"
deploy:
provider: releases
api_key:
secure: L0SCYpBQTuuXmzrl68iF8y80jjXRXtjQzdq+gbf0+hPGZuRxcl/UwJcEz4pOBNAmLy+zh+xz/IZPNNm/KnYLNrrJk69a1LsJ58H3xpis8ycdzjIQvXuJn6i7Pffrd5nER9TpsiokERzBlT7hiEJaB36pvxQGUVSbhoCxciQ8x+9Dnh4Xx6HFtbzqJlB69hQMA5r4ojOoinbbaM4qBr7/ypAydwuRiYiXFPWinL2JJHTLeDb5XSNyDcHqLOY3l9hPQ/mCuz1ufgyjbXBhVAd8zxsksjvVR5O6XUlSUxM/TWfSmmTgRnU23jJuOV1bSZWlMBeK6WNw2y6lxzR2BsEDa1c+HOAg33FNo9laMW7OTumI3Xsdy3vtCaPnb1cHKQH6cXSvu2vRzVNST8edwQjTs/jT842/Eodo0X7WH9Jdn+dI/L4zCk8O4OEeTMBBapBdujqhuRB0eHIAZxy4arEGFwKx/v1UtL9UgzWT+T1hX+T3Zk1JsnCg1IU9L0/J5OWrMB6jyFeyx5kU4s2/b83DDisyNq2LC8waML7Z7giyj8PMr5QKEjhF5/Fe21eGjBJaHjnzQwHlaFBkhHGbrmzQvDsh3KX0pxQKIdy0frsT1pvoxRqz7zvnUTvpF+DqmbQldh9ALGpdbJONLgIqmclui+NgshEU4dKPhMsOg6+dpI0=
file:
- "${RELEASE_PKG_FILE}"
- "${RELEASE_DEB_FILE}"
- "${RELEASE_RPM_FILE}"
skip_cleanup: true
draft: true
on:
repo: airbus-cyber/graylog-plugin-logging-alert
jdk: openjdk8
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

All notable changes to this project will be documented in this file.

## [1.0.0](https://github.com/airbus-cyber/graylog-plugin-logging-alert/tree/1.0.0) (2018-12-19)

* First release
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Logging Alert Plugin for Graylog

[![Build Status](https://travis-ci.org/airbus-cyber/graylog-plugin-logging-alert.svg?branch=master)](https://travis-ci.org/airbus-cyber/graylog-plugin-logging-alert)
[![License](https://img.shields.io/badge/license-GPL--3.0-orange.svg)](https://www.gnu.org/licenses/gpl-3.0.txt)
[![GitHub Release](https://img.shields.io/badge/release-v1.0.0-blue.svg)](https://github.com/airbus-cyber/graylog-plugin-logging-alert/releases)

#### Alert notification plugin for Graylog to generate log messages from alerts

Expand Down Expand Up @@ -39,7 +41,15 @@ Then, in the popup that occurs, you can configure the **Title** of the notificat

You can configure the **Alert Severity**. You have the choice between 4 levels of severity.

You can also configure the **Log Content** to log the information you want.
You can also configure the **Log Content** to log the information you want. Some plugin-specific fields values can be added to the log content.

| Plugin-specific Fields | Description |
| -------------------------- | ------------------------------------------------------- |
| logging_alert.id | ID of the alert |
| logging_alert.severity | Severity of the alert |
| logging_alert.detect_time | Timestamp of the first message that triggered the alert |
| logging_alert.alert_url | URI of the Graylog alert |
| logging_alert.messages_url | URI to the retrieve messages that triggered the alert |

The parameter **Split Fields** allow you to split the alert based on message field values. Thus, a different alert id is generated for each value of one or more message fields.

Expand All @@ -55,7 +65,7 @@ Make sure you also configured alert conditions for the stream so that the alerts

Click on **Configure** in the **System / Configurations** section to update the plugin configuration.

In the popup that occurs, you can configure the default value of the parameters that are set when adding a new notification : **Default Alert Severity**, **Default Log Content** and **Default Aggregation Time Range**.
In the popup that occurs, you can configure the default value of the parameters that are set when adding a new notification: **Default Alert Severity**, **Default Log Content** and **Default Aggregation Time Range**.

You can define a **Line Break Substitution** of the log content in order to help parsing log fields and their values. Thus a separator can be inserted between the fields of the log content.

Expand Down
6 changes: 6 additions & 0 deletions build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require('path');

module.exports = {
// Make sure that this is the correct path to the web interface part of the Graylog server repository.
web_src_path: path.resolve(__dirname, '../graylog2-server/graylog2-web-interface'),
};
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "LoggingAlert",
"version": "1.0.0",
"description": "Graylog plugin LoggingAlert Web Interface",
"repository": {
"type": "git",
"url": "https://github.com/airbus-cyber/graylog-plugin-logging-alert"
},
"scripts": {
"build": "webpack --bail"
},
"keywords": [
"graylog"
],
"author": "Airbus CyberSecurity",
"license": "GPL-3.0",
"dependencies": {},
"devDependencies": {
"graylog-web-plugin": "file:../graylog2-server/graylog2-web-interface/packages/graylog-web-plugin",
"react": "^0.14.9",
"react-addons-test-utils": "^0.14.8",
"react-dom": "^0.14.9",
"webpack": "^3.4.1"
}
}
236 changes: 236 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.1</maven>
</prerequisites>

<parent>
<groupId>org.graylog.plugins</groupId>
<artifactId>graylog-plugin-web-parent</artifactId>
<version>2.4.3</version>
</parent>

<groupId>com.airbus-cyber-security.graylog</groupId>
<artifactId>graylog-plugin-logging-alert</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>Graylog ${project.artifactId} plugin.</description>
<url>https://www.graylog.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<graylog.version>2.4.3</graylog.version>
<graylog2.plugin-dir>/usr/share/graylog-server/plugin</graylog2.plugin-dir>
<auto-value.version>1.5.1</auto-value.version>

<!-- Test dependencies -->
<assertj-core.version>3.8.0</assertj-core.version>
<assertj-joda-time.version>2.0.0</assertj-joda-time.version>
<junit.version>4.12</junit.version>
<mockito.version>2.8.9</mockito.version>
<powermock.version>1.7.0</powermock.version>
<slf4j-test.version>1.1.0</slf4j-test.version>
</properties>

<dependencies>
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>graylog2-server</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>${auto-value.version}</version>
<scope>provided</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>uk.org.lidalia</groupId>
<artifactId>slf4j-test</artifactId>
<version>${slf4j-test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-joda-time</artifactId>
<version>${assertj-joda-time.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>build</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<annotationProcessor>com.google.auto.value.processor.AutoValueProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Graylog-Plugin-Properties-Path>${project.groupId}.${project.artifactId}</Graylog-Plugin-Properties-Path>
</manifestEntries>
</archive>
<outputDirectory>target</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<minimizeJar>false</minimizeJar>
<artifactSet>
<includes>
<include>com.airbus-cyber-security.graylog:*</include>
</includes>
</artifactSet>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<mavenExecutorId>forked-path</mavenExecutorId>
<tagNameFormat>@{project.version}</tagNameFormat>
<preparationGoals>clean test</preparationGoals>
<goals>package</goals>
</configuration>
</plugin>
<plugin>
<artifactId>jdeb</artifactId>
<groupId>org.vafer</groupId>
<configuration>
<deb>${project.build.directory}/${project.artifactId}-${project.version}.deb</deb>
<dataSet>
<data>
<src>${project.build.directory}/${project.build.finalName}.jar</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>${graylog2.plugin-dir}</prefix>
<filemode>644</filemode>
<user>root</user>
<group>root</group>
</mapper>
</data>
</dataSet>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<configuration>
<group>Application/Internet</group>
<prefixes>
<prefix>/usr</prefix>
</prefixes>
<defineStatements>
<defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
<defineStatement>_binaries_in_noarch_packages_terminate_build 0</defineStatement>
</defineStatements>
<defaultFilemode>644</defaultFilemode>
<defaultDirmode>755</defaultDirmode>
<defaultUsername>root</defaultUsername>
<defaultGroupname>root</defaultGroupname>
<mappings>
<mapping>
<directory>${graylog2.plugin-dir}</directory>
<sources>
<source>
<location>${project.build.directory}/</location>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
</project>
8 changes: 8 additions & 0 deletions src/deb/control/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: [[name]]
Version: [[version]]
Architecture: all
Maintainer: Airbus CyberSecurity
Section: web
Priority: optional
Depends: graylog-server
Description: [[description]]
Loading

0 comments on commit f52a4e9

Please sign in to comment.