Graylog Server
repository·master·Indexed 27 days ago
https://github.com/graylog2/graylog2-serverThe core server for Graylog, including tools for developing web interface plugins, Opensearch configuration management, and protobuf specifications. It provides archetypes and helper modules like graylog-web-plugin for plugin development, as well as documentation for installing and configuring plugins such as the CEF message input and NetFlow collector.
What's inside graylog2-server
- Graylog is a free and open log management platform. It is used for managing and analyzing logs across various systems. For detailed technical guides and manuals, visit the official documentation site.
NetFlow Plugin Capabilities and Compatibility
masterThe NetFlow plugin is designed to receive data from Flow exporters and convert them into Graylog messages.
Compatibility:
- Required Graylog version: 2.3.0 and later.
Supported Versions & Features:
- NetFlow V9: Full support.
- IPv6: Supports IPv6 addresses without conversion.
- NetFlow V5: Handles all fields from the fixed V5 format.
- Cisco ASA 5500: Supports events from Cisco ASA 5500, including firewall and routing events (Note: there may be significant duplication of typical syslog reporting in v9 reporting).
Understand Opensearch configuration handling
masterGraylog manages Opensearch configuration using two distinct approaches to ensure the correct settings are applied to the runtime environment:
- Common Configuration: Files located in
main/resources/opensearch/config/commonare considered base configuration. These files are copied to the managed Opensearch process's read-write location during every process start. This action overrides any existing files from previous runs. - Version-Specific Configuration: Files located in subdirectories named after the Opensearch SemVer (e.g.,
main/resources/opensearch/config/2.19.5) are copied specifically for that version.
During startup, the system combines these two sources to prepare the runtime configuration.
- Common Configuration: Files located in
Handle date times in the Graylog Web Interface
masterGraylog follows specific standards for date time handling to ensure consistency between the backend and UI:
Data Exchange and Storage
- Backend Communication: All dates sent to or received from the backend must be in UTC and formatted according to ISO 8601 (e.g.,
2010-07-30T16:03:25.000Z). - State Management: Use the ISO 8601 UTC format when storing date times in UI component states.
UI Display
- Timezones: Dates must always be displayed in the user's local timezone.
- Display Components:
- Use the
Timestampcomponent for standard date/time display. - Use the
RelativeTimecomponent to display human-readable relative time (e.g., "2 minutes ago").
- Use the
- Hooks: Access timezone-aware functionality via the
useUserDateTimehook.
Transformations
- Utility Usage: For all date time transformations, use the
DateTimeutils instead of usingmomentdirectly. This abstraction allows the project to swap underlying libraries without breaking your implementation.
- Backend Communication: All dates sent to or received from the backend must be in UTC and formatted according to ISO 8601 (e.g.,
Develop the Graylog CEF message input plugin
masterTo build the plugin from source, you need Maven 3 and Java 8 or higher.
- Clone the repository.
- Build the JAR file using
mvn package. - (Optional) Create DEB or RPM packages using
mvn jdeb:jdebandmvn rpm:rpm. - Copy the generated JAR from the
targetdirectory to your Graylog plugin directory. - Restart Graylog.
mvn package # Optional: create packages mvn jdeb:jdeb mvn rpm:rpmEnable hot reloading for web interface development
masterTo improve the development experience for the web interface portion of your plugin, you can use hot reloading by linking your plugin into the Graylog web interface directory. Follow these steps:
- Clone the Graylog server repository.
- Navigate to the
graylog2-web-interfacedirectory. - Create a symbolic link from your plugin directory to the
plugin/directory. - Install dependencies and start the development server.
git clone https://github.com/Graylog2/graylog2-server.git cd graylog2-server/graylog2-web-interface ln -s $YOURPLUGIN plugin/ npm install && npm startAccess theme properties in components using GraylogThemeProvider
masterThe Graylog Web Interface uses a
GraylogThemeProvider(defined insrc/theme/GraylogThemeProvider.jsx) to wrap the application. This provider makes the global theme object available to all components via thethemeprop throughstyled-components.To use theme values (such as colors) in your styled components, destructure
themefrom the props function within astyleddeclaration.const StyledElement = styled.div( ({ theme }) => css` background-color: ${theme.colors.global.contentBackground}; `, );Configure Maven Enforcer Rule for Graylog Plugins
masterPlugin builds inheriting from
graylog-plugin-parentorgraylog-plugin-web-parentnow enforce therequireUpperBoundDepsrule. This rule fails the build if a transitive dependency resolves to a version lower than what another dependency in the plugin requires.To resolve build failures:
- Update the outdated dependency to the required version.
- Or, add a
<dependencyManagement>entry for the flagged artifact using the highest required version indicated in the error message. - If you cannot align dependencies, you can override the
enforce-versionsexecution of themaven-enforcer-pluginin your own POM.
Follow Graylog form layout rules
masterWhen building forms in Graylog, adhere to the following layout principles to ensure usability and speed:
- Single Column Layout: Forms must always be laid out in a single column. Multi-column layouts are discouraged as they increase completion time and cause users to skip fields.
- Two-Column Exception: You may use two columns in a single row only when fields are semantically a single unit (e.g.,
first/last name,key/value, orstart/end date). In these cases, both fields in the pair must be of equal width. - Grouping: Use section labels and dividers to group related fields. Limit forms to a maximum of 3 to 4 groups per form or step.
- Field Ordering: Within a group, place required fields before optional fields.
- Advanced Options: Hide fields that most users will not need behind a collapsible section labeled "Advanced options" to prevent form clutter.
Run the frontend documentation and component gallery locally
masterWhile the online documentation is available at https://graylog2.github.io/frontend-documentation/, you can run a local version to contribute or view different branches:
- Navigate to the docs directory:
cd docs - Install dependencies:
yarn install - Start the documentation server:
yarn run docs:server - Access the documentation at
http://localhost:6060.
cd docs yarn install yarn run docs:server- Navigate to the docs directory:
Mark required fields using RequiredMarker
masterGraylog uses a consistent convention for indicating required fields. Do not use the word "optional" for non-required fields; instead, simply leave them unmarked.
To mark a required field, use the
<RequiredMarker />component fromcomponents/common.import { RequiredMarker } from 'components/common';Configure plugin properties during project generation
masterWhen running the
archetype:generatecommand, you will be prompted to define several properties. Key properties include:groupId: The Maven group ID for your plugin (e.g.,org.graylog.plugins).artifactId: The unique identifier for your plugin project (e.g.,graylog-plugin-twitter).package: The Java package name where your code will reside (e.g.,org.graylog.plugins.twitter).pluginClassName: The name of the main class that implements the Graylog plugin interface (e.g.,Twitter).