Commit graph

224 commits

Author SHA1 Message Date
670e5b1d30
Refactor plugins.Action to separate configuration step
Refactored the Action interface in the plugins package to separate the configuration step from the process method. The new Config method accepts a configuration map and returns an error. The modified server.go uses this Config method to apply configurations before calling Process. File action plugin specifically has been updated to support this new interface where configurations are now updated via Config method before invoking Process.
2023-12-25 21:08:03 +01:00
68b1544125
Add SHA hashing and base64 encoding methods to template
Implemented new template functions to allow conversion of strings to SHA-1, SHA-256, and SHA-512 hash formats, as well as base64 encoding. These changes include the creation of the SHAAlgo type and associated constants representing different SHA algorithms. The additional functionality will enhance template handling by adding more options for string encryption and encoding.
2023-12-23 22:00:23 +01:00
b6f6b6a664
Implement Actions interface and update rule handling in Server
Introduced an Actions interface for plugins in 'action.go' and implemented a corresponding registry in 'registry.go'. Additionally, adjusted rule related behavior in 'Server' to account for actions, with relevant new fields in Ruleset and Rule. This enables multiple actions on a log message based on defined rules and further modularises the codebase, paving the path for addition of more plugin actions.
2023-12-23 20:29:38 +01:00
6987f4627c
Add HostMatch field and related functionality in Ruleset and Server
The Ruleset struct has been updated to include a 'HostMatch' field. A corresponding conditional block to handle 'HostMatch' was added in the 'Server' object's ruleset cycle. This allows the rules to include host-specific matches and debug information about matches found. Further expansion of this functionality can enable detailed rule application based on the target host.
2023-12-22 21:52:33 +01:00
1aaa9ac247
Remove unnecessary line break in server.go
An unnecessary line break in the server.go file was removed, which was situated between connection error handling and the read loop. Such spacing did not contribute to readability or function, hence impacting the overall code cleanliness.
2023-12-22 17:33:26 +01:00
0fae461408
Implement Ruleset configuration in logranger
Added a Ruleset configuration to the logranger application, along with associated error handling. The code now loads a ruleset file from configuration, checks for duplicate rules, and logs each rule as it is found. The ruleset is also integrated within the server setup. The PIDFile now includes a default RuleFile reference in config.go.
2023-12-22 17:31:41 +01:00
77ad132bc7
Add more pattern to .gitignore
The provided diff includes an extra pattern to the .gitignore list - 'etc/*.local.*.toml'. This was done to ensure that all variations of local configuration files are ignored by Git, preventing them from being unnecessarily tracked.
2023-12-22 17:31:28 +01:00
f02d5be680
Update 'parser' struct annotation in config.go
The 'parser' struct in config.go has been updated with Fig configuration annotation. This allows ease of configuration as it sources the configuration options from the environment, making the code cleaner and more flexible.
2023-12-22 16:08:54 +01:00
5d72bcac91
Refactor processing deadline logics in server.go
The processing deadline handling was moved from the connection-level anonymous go-routine to the HandleConnection method. This refactor allows the reading from the connection to be looped, improving the handling of timeouts and parsing failure cases.
2023-12-22 16:08:16 +01:00
8d75b19e27
Correct typo in error.go comments
The comments for the 'ErrCertConfigEmpty' variable in error.go contained a typo. This has been corrected to more accurately reflect the error that is returned when a TLS listener is configured without setting certificate or key paths.
2023-12-22 16:08:02 +01:00
c9f7726473
Correct spelling errors in error messages
Fixed spelling errors in error messages on server.go and listener.go files. The word "initalize" has been corrected to "initialize" in both files.
2023-12-22 15:31:44 +01:00
0a3f8780c5
Add copyright notice to connection.go
A copyright notice for Winni Neessen has been added at the top of connection.go. The license specified is MIT.
2023-12-22 15:26:31 +01:00
830de14890
Update go-parsesyslog dependency and refine server connection handling
This update upgrades the go-parsesyslog dependency version to v0.2.2. It also enhances the server's connection handling. This is done by expanding the `HandleConnection` method to handle network errors and EOF scenarios more thoroughly, adjusting processing time measurements, and handling deadlines for connection processing. Furthermore, the initialization of the syslog parser has now been moved to the `NewServer` function for efficiency.
2023-12-22 15:24:58 +01:00
43b1147106
Implement network connection handling
Introduced a new Connection struct and related functions in `connection.go` to facilitate network connections. Incorporated the `go-parsesyslog` package to parse incoming network data. Implemented functions in `server.go` to accept and handle incoming network connections, bolstering the application's network interaction functionality.
2023-12-22 01:44:50 +01:00
3c304797b3
Add .env to .gitignore file
The .env file has been added to the .gitignore file to ensure it's not tracked in the git repository. This change helps to protect sensitive environment variable settings by preventing them from being inadvertently published within the project repository.
2023-12-21 20:19:17 +01:00
ca62769cd3
Relocate logranger.toml and update .gitignore
The logranger.toml file is moved to the 'etc' directory, and its pid_file location is updated. The .gitignore file is also edited to ignore local configuration files in the 'etc' directory to prevent them from being tracked. This creates a cleaner project structure and ensures local configurations are kept private.
2023-12-21 20:17:10 +01:00
c9c3bf31da
Refactor documentation and methods in server-related files
The documentation for some methods in the server-related files (config.go, server.go, and listener.go) has been updated to provide more accurate and descriptive explanations of their functionality. Additionally, the New methods for Config and Server objects have been changed to reflect that they create instances of these objects. Some method functionalities like 'setLogLevel' in server.go have been extended for more accurate operation based on the config log level.
2023-12-19 20:17:56 +01:00
c123f4b757
Add SPDX license details to go.sum.license
Introduced SPDX-FileCopyrightText and SPDX-License-Identifier: MIT to the newly created file 'go.sum.license'. This ensures the appropriate licensing information is present and accurately defines the rights as per recent license policy changes.
2023-12-15 17:41:15 +01:00
436df7b2b4
Refactor signal handling and remove SPDX licensing details
Redid signal handling in the main server code leading to simpler, more readable code. Removed the SPDX license identifiers from 'go.sum' following recent policy changes.
2023-12-15 17:35:27 +01:00
ea1ac393bc
Add SPDX license identifiers and update copyright year
All source code files as well as README.md, .gitignore, and various configuration files have been updated with an SPDX license identifier, changing license from CC0-1.0 to MIT. The copyright year has been updated to 2023, and the copyright holder's email address has been corrected from 'winni@neessen.dev' to 'wn@neessen.dev'. An MIT license text file has been additionally added.
2023-12-15 16:35:41 +01:00
cf17cc3419
Add initial server implementation with config loading and listener setup
This commit introduces the creation of the core server and its components: config loading mechanism, listener setup, and error handling. The provided configuration allows the server to run different types of listeners. Additionally, it includes robust log-level settings to facilitate debugging and operational transparency.
2023-12-14 12:09:01 +01:00
4689c24617
Add REUSE Compliance, Golang Linter workflows and funding options
This commit introduces two new workflows for Github Actions: REUSE Compliance Check and golangci-lint. It also includes the funding options for the project in a dedicated FUNDING.yml file. These changes will enhance code quality checks and offer ways to support the project financially.
2023-12-08 14:42:27 +01:00
c5d8197070
Add SonarQube configuration and update .gitignore
This commit introduces a SonarQube configuration setup, adds an .idea/.gitignore file, and expands the root .gitignore file. The SonarQube setup includes a GitHub Actions workflow and a project properties file. The .gitignore files are updated to properly ignore files for JetBrains IDEs, local testfiles, SonarQube, and others.
2023-12-08 14:37:32 +01:00
1ea59ecafb
Initial commit 2023-12-08 14:31:37 +01:00