Skip to content

Commit

Permalink
oracle log analytics plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
adiforluls committed Oct 4, 2023
1 parent da22f5e commit e9bf651
Show file tree
Hide file tree
Showing 8 changed files with 958 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apis/fluentbit/v1alpha2/clusteroutput_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ type OutputSpec struct {
S3 *output.S3 `json:"s3,omitempty"`
// Gelf defines GELF Output configuration.
Gelf *output.Gelf `json:"gelf,omitempty"`

// OracleLogAnalytics defines OracleLogAnalytics Output configuration
OracleLogAnalytics *output.OracleLogAnalytics `json:"oracleLogAnalytics,omitempty"`
// CustomPlugin defines Custom Output configuration.
CustomPlugin *custom.CustomPlugin `json:"customPlugin,omitempty"`
}
Expand Down
92 changes: 92 additions & 0 deletions apis/fluentbit/v1alpha2/plugins/output/oracle_log_analytics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package output

import (
"fmt"
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins"
"github.com/fluent/fluent-operator/v2/apis/fluentbit/v1alpha2/plugins/params"
)

// +kubebuilder:object:generate:=true

type OracleLogAnalytics struct {
Auth *AuthConfig `json:"auth,omitempty"`
OCIConfigInRecord bool `json:"ociConfigInRecord,omitempty"`
ObjectStorageNamespace *string `json:"objectStorageNamespace,omitempty"`
ProfileName *string `json:"profileName,omitempty"`
LogGroupId *string `json:"logGroupId,omitempty"`
LogSourceName *string `json:"logSourceName,omitempty"`
LogEntityId *string `json:"logEntityId,omitempty"`
LogEntityType *string `json:"logEntityType,omitempty"`
LogPath *string `json:"logPath,omitempty"`
LogSet *string `json:"logSetId,omitempty"`
GlobalMetadata map[string]string `json:"globalMetadata,omitempty"`
LogEventMetadata map[string]string `json:"logEventMetadata,omitempty"`
Workers *int32 `json:"Workers,omitempty"`
*plugins.TLS `json:"tls,omitempty"`
}

// +kubebuilder:object:generate:=true

type AuthConfig struct {
ConfigFileLocation *string `json:"configFileLocation,omitempty"`
ProfileName *string `json:"profileName,omitempty"`
}

func (_ *OracleLogAnalytics) Name() string {
return "oracle_log_analytics"
}

func (o *OracleLogAnalytics) Params(sl plugins.SecretLoader) (*params.KVs, error) {
kvs := params.NewKVs()
if o.Auth.ConfigFileLocation != nil {
kvs.Insert("config_file_location", *o.Auth.ConfigFileLocation)
}
if o.Auth.ProfileName != nil {
kvs.Insert("profile_name", *o.Auth.ProfileName)
}
if o.ObjectStorageNamespace != nil {
kvs.Insert("namespace", *o.ObjectStorageNamespace)
}
if o.OCIConfigInRecord {
kvs.Insert("oci_config_in_record", "true")
}
if o.LogGroupId != nil {
kvs.Insert("oci_la_log_group_id", *o.LogGroupId)
}
if o.LogSourceName != nil {
kvs.Insert("oci_la_log_source_name", *o.LogSourceName)
}
if o.LogEntityId != nil {
kvs.Insert("oci_la_log_entity_id", *o.LogEntityId)
}
if o.LogEntityType != nil {
kvs.Insert("oci_la_log_entity_type", *o.LogEntityType)
}
if o.LogPath != nil {
kvs.Insert("oci_la_log_path", *o.LogPath)
}
if o.LogSet != nil {
kvs.Insert("oci_la_log_set_id", *o.LogSet)
}
if o.GlobalMetadata != nil {
for k, v := range o.GlobalMetadata {
kvs.Insert("oci_la_global_metadata", fmt.Sprintf("%s %s", k, v))
}
}
if o.LogEventMetadata != nil {
for k, v := range o.LogEventMetadata {
kvs.Insert("oci_la_metadata", fmt.Sprintf("%s %s", k, v))
}
}
if o.Workers != nil {
kvs.Insert("Workers", fmt.Sprint(*o.Workers))
}
if o.TLS != nil {
tls, err := o.TLS.Params(sl)
if err != nil {
return nil, err
}
kvs.Merge(tls)
}
return kvs, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,114 @@ spec:
server listening for traces, e.g: /v1/traces'
type: string
type: object
oracleLogAnalytics:
description: OracleLogAnalytics defines OracleLogAnalytics Output
configuration
properties:
Workers:
format: int32
type: integer
auth:
properties:
configFileLocation:
type: string
profileName:
type: string
type: object
globalMetadata:
additionalProperties:
type: string
type: object
logEntityId:
type: string
logEntityType:
type: string
logEventMetadata:
additionalProperties:
type: string
type: object
logGroupId:
type: string
logPath:
type: string
logSetId:
type: string
logSourceName:
type: string
objectStorageNamespace:
type: string
ociConfigInRecord:
type: boolean
profileName:
type: string
tls:
description: Fluent Bit provides integrated support for Transport
Layer Security (TLS) and it predecessor Secure Sockets Layer
(SSL) respectively.
properties:
caFile:
description: Absolute path to CA certificate file
type: string
caPath:
description: Absolute path to scan for certificate files
type: string
crtFile:
description: Absolute path to Certificate file
type: string
debug:
description: 'Set TLS debug verbosity level. It accept the
following values: 0 (No debug), 1 (Error), 2 (State change),
3 (Informational) and 4 Verbose'
enum:
- 0
- 1
- 2
- 3
- 4
format: int32
type: integer
keyFile:
description: Absolute path to private Key file
type: string
keyPassword:
description: Optional password for tls.key_file file
properties:
valueFrom:
description: ValueSource defines how to find a value's
key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
verify:
description: Force certificate validation
type: boolean
vhost:
description: Hostname to be used for TLS SNI extension
type: string
type: object
type: object
prometheusExporter:
description: PrometheusExporter_types defines Prometheus exporter
configuration to expose metrics from Fluent Bit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,114 @@ spec:
server listening for traces, e.g: /v1/traces'
type: string
type: object
oracleLogAnalytics:
description: OracleLogAnalytics defines OracleLogAnalytics Output
configuration
properties:
Workers:
format: int32
type: integer
auth:
properties:
configFileLocation:
type: string
profileName:
type: string
type: object
globalMetadata:
additionalProperties:
type: string
type: object
logEntityId:
type: string
logEntityType:
type: string
logEventMetadata:
additionalProperties:
type: string
type: object
logGroupId:
type: string
logPath:
type: string
logSetId:
type: string
logSourceName:
type: string
objectStorageNamespace:
type: string
ociConfigInRecord:
type: boolean
profileName:
type: string
tls:
description: Fluent Bit provides integrated support for Transport
Layer Security (TLS) and it predecessor Secure Sockets Layer
(SSL) respectively.
properties:
caFile:
description: Absolute path to CA certificate file
type: string
caPath:
description: Absolute path to scan for certificate files
type: string
crtFile:
description: Absolute path to Certificate file
type: string
debug:
description: 'Set TLS debug verbosity level. It accept the
following values: 0 (No debug), 1 (Error), 2 (State change),
3 (Informational) and 4 Verbose'
enum:
- 0
- 1
- 2
- 3
- 4
format: int32
type: integer
keyFile:
description: Absolute path to private Key file
type: string
keyPassword:
description: Optional password for tls.key_file file
properties:
valueFrom:
description: ValueSource defines how to find a value's
key.
properties:
secretKeyRef:
description: Selects a key of a secret in the pod's
namespace
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its
key must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
type: object
verify:
description: Force certificate validation
type: boolean
vhost:
description: Hostname to be used for TLS SNI extension
type: string
type: object
type: object
prometheusExporter:
description: PrometheusExporter_types defines Prometheus exporter
configuration to expose metrics from Fluent Bit.
Expand Down
Loading

0 comments on commit e9bf651

Please sign in to comment.