-
Notifications
You must be signed in to change notification settings - Fork 101
NGINX App Protect OTel syslog processor #1262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devbgv
wants to merge
10
commits into
nginx:main
Choose a base branch
from
devbgv:bgv/nim-nap-otel-log-parser
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d11de3d
feat: Add syslog log processor for nap
devbgv c73fb0c
fix: address review comments
devbgv 5f92180
fix: remove duplicate attributes
devbgv 09b005f
Merge branch 'main' into bgv/nim-nap-otel-log-parser
devbgv e8085c2
fix: lint, UT and Race UT
devbgv 02820ee
fix: add more UT for syslog processor increase coverage
devbgv 4237dd1
fix: address review comments
devbgv 9042087
Merge remote-tracking branch 'origin/main' into bgv/nim-nap-otel-log-…
devbgv 192457a
fix: lint issues fix
devbgv 08646a5
fix: add benchmarks for securityviolationsprocessor
devbgv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Syslog Processor | ||
|
||
Internal component of the NGINX Agent that processes syslog messages. Parses RFC3164 formatted syslog entries from log records and extracts structured attributes. Successfully parsed messages have their body replaced with the clean message content. | ||
|
||
Part of the NGINX Agent's log collection pipeline. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) F5, Inc. | ||
// | ||
// This source code is licensed under the Apache License, Version 2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
package syslogprocessor | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/processor" | ||
) | ||
|
||
const typeStr = "syslog" | ||
|
||
// NewFactory creates a factory for the syslog processor. | ||
// | ||
//nolint:ireturn // factory methods return interfaces by design | ||
func NewFactory() processor.Factory { | ||
return processor.NewFactory( | ||
component.MustNewType(typeStr), | ||
func() component.Config { return &struct{}{} }, | ||
processor.WithLogs(createSyslogProcessor, component.StabilityLevelAlpha), | ||
) | ||
} | ||
|
||
// createSyslogProcessor instantiates the logs processor. | ||
// | ||
//nolint:ireturn // required to comply with component factory interface | ||
func createSyslogProcessor( | ||
_ context.Context, | ||
settings processor.Settings, | ||
_ component.Config, | ||
next consumer.Logs, | ||
) (processor.Logs, error) { | ||
settings.Logger.Info("Creating syslog processor") | ||
|
||
return newSyslogProcessor(next, settings), nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) F5, Inc. | ||
// | ||
// This source code is licensed under the Apache License, Version 2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
package syslogprocessor | ||
|
||
// SecurityViolationEvent represents the structured NGINX App Protect security violation data | ||
type SecurityViolationEvent struct { | ||
PolicyName string `json:"policy_name"` | ||
SupportID string `json:"support_id"` | ||
Outcome string `json:"outcome"` | ||
OutcomeReason string `json:"outcome_reason"` | ||
BlockingExceptionReason string `json:"blocking_exception_reason"` | ||
Method string `json:"method"` | ||
Protocol string `json:"protocol"` | ||
XForwardedForHeaderValue string `json:"xff_header_value"` | ||
URI string `json:"uri"` | ||
Request string `json:"request"` | ||
IsTruncated string `json:"is_truncated"` | ||
RequestStatus string `json:"request_status"` | ||
ResponseCode string `json:"response_code"` | ||
ServerAddr string `json:"server_addr"` | ||
VSName string `json:"vs_name"` | ||
RemoteAddr string `json:"remote_addr"` | ||
RemotePort string `json:"destination_port"` | ||
ServerPort string `json:"server_port"` | ||
Violations string `json:"violations"` | ||
SubViolations string `json:"sub_violations"` | ||
ViolationRating string `json:"violation_rating"` | ||
SigSetNames string `json:"sig_set_names"` | ||
SigCVEs string `json:"sig_cves"` | ||
ClientClass string `json:"client_class"` | ||
ClientApplication string `json:"client_application"` | ||
ClientApplicationVersion string `json:"client_application_version"` | ||
Severity string `json:"severity"` | ||
ThreatCampaignNames string `json:"threat_campaign_names"` | ||
BotAnomalies string `json:"bot_anomalies"` | ||
BotCategory string `json:"bot_category"` | ||
EnforcedBotAnomalies string `json:"enforced_bot_anomalies"` | ||
BotSignatureName string `json:"bot_signature_name"` | ||
SystemID string `json:"system_id"` | ||
InstanceTags string `json:"instance_tags"` | ||
InstanceGroup string `json:"instance_group"` | ||
ParentHostname string `json:"parent_hostname"` | ||
DisplayName string `json:"display_name"` | ||
ViolationsData []ViolationData `json:"violations_data"` | ||
} | ||
|
||
type ViolationData struct { | ||
Name string `json:"violation_data_name"` | ||
Context string `json:"violation_data_context"` | ||
ContextData ContextData `json:"violation_data_context_data"` | ||
Signatures []SignatureData `json:"violation_data_signatures"` | ||
} | ||
|
||
// SignatureData represents signature data contained within each violation | ||
type SignatureData struct { | ||
ID string `json:"sig_data_id"` | ||
BlockingMask string `json:"sig_data_blocking_mask"` | ||
Buffer string `json:"sig_data_buffer"` | ||
Offset string `json:"sig_data_offset"` | ||
Length string `json:"sig_data_length"` | ||
} | ||
|
||
// ContextData represents the context data of the violation | ||
type ContextData struct { | ||
Name string `json:"parameter_data_name"` | ||
Value string `json:"parameter_data_value"` | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.