Skip to content

Commit

Permalink
feat: add support for auth digest in http_loader and added cloudflare…
Browse files Browse the repository at this point in the history
… schema (#110)
  • Loading branch information
nicolasparada authored Oct 10, 2024
1 parent e62c106 commit 278ad25
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 9 deletions.
76 changes: 67 additions & 9 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s Schema) findSections(kind SectionKind) ([]SchemaSection, bool) {

func (s *Schema) InjectLTSPlugins() {
s.Inputs = append(s.Inputs, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-s3-replay
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/go-s3-replay-plugin
Type: "input",
Name: "go-s3-replay-plugin",
Description: "Calyptia LTS advanced plugin providing logs replay from s3",
Expand Down Expand Up @@ -147,12 +147,12 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-dummy
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/dummy
Type: "input",
Name: "gdummy",
Description: "dummy GO!",
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-gsuite-reporter
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/gsuite-reporter
Type: "input",
Name: "gsuite-reporter",
Description: "A Calyptia LTS advanced plugin providing activity streams from Gsuite",
Expand Down Expand Up @@ -204,7 +204,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-plugin-http-loader
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/http_loader
Type: "input",
Name: "http_loader",
Description: "HTTP Loader plugin provides a way to load/dump data from a paginated HTTP endpoint.",
Expand Down Expand Up @@ -290,6 +290,16 @@ func (s *Schema) InjectLTSPlugins() {
Type: "string",
Description: "Cookie based authentication request body.",
},
{
Name: "auth_digest_username",
Type: "string",
Description: "Username for HTTP Digest authentication.",
},
{
Name: "auth_digest_password",
Type: "string",
Description: "Password for HTTP Digest authentication.",
},
{
Name: "wait",
Type: "string",
Expand Down Expand Up @@ -387,7 +397,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-azure-event-grid
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/azeventgrid
Type: "input",
Name: "azeventgrid",
Description: "A Calyptia Core fluent-bit plugin providing input from Azure Event Grid.",
Expand Down Expand Up @@ -416,7 +426,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-aws-kinesis-stream-input
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/aws_kinesis_stream
Type: "input",
Name: "aws_kinesis_stream",
Description: "AWS Kinesis stream input plugin.",
Expand Down Expand Up @@ -486,7 +496,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-plugin-input-s3-sqs
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/s3_sqs
Type: "input",
Name: "s3_sqs",
Description: "Calyptia LTS advanced plugin providing logs replay from sqs events",
Expand Down Expand Up @@ -598,7 +608,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-plugin-datagen
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/datagen
Type: "input",
Name: "datagen",
Description: "Datagen input plugin generates fake logs at a given interval",
Expand All @@ -618,7 +628,7 @@ func (s *Schema) InjectLTSPlugins() {
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit-plugin-sqldb
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/sqldb
Type: "input",
Name: "sqldb",
Description: "SQL Database input",
Expand Down Expand Up @@ -676,5 +686,53 @@ func (s *Schema) InjectLTSPlugins() {
},
},
},
}, SchemaSection{
// See https://github.com/chronosphereio/calyptia-core-fluent-bit/tree/main/goplugins/cloudflare
Type: "input",
Name: "cloudflare",
Description: "HTTP server input for cloudflare with chunked transfer encoding support",
Properties: SchemaProperties{
Options: []SchemaOptions{
{
Name: "addr",
Type: "string",
Description: "Address to listen on.",
Default: ":9880",
},
{
Name: "resp_headers",
Type: "string",
Description: "Response headers to set, separated by new line. Supports templating.",
Default: "Content-Type: application/json",
},
{
Name: "resp_status_code",
Type: "string",
Description: "Response status code to set. Supports templating. Should evaluate to an integer.",
Default: "200",
},
{
Name: "resp_body",
Type: "string",
Description: "Response body to set. Supports templating.",
Default: "{\"status\": \"ok\"}",
},
{
Name: "time_from",
Type: "string",
Description: "Optional time to set. Supports templating with record access. Should evaluate to a RFC3339 formatted string. Defaults to current time.",
},
{
Name: "cert_file",
Type: "string",
Description: "Path to the certificate file to enable TLS.",
},
{
Name: "key_file",
Type: "string",
Description: "Path to the key file to enable TLS.",
},
},
},
})
}
1 change: 1 addition & 0 deletions service_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var servicePortDefaultsByPlugin = map[string]servicePortDefaults{
"syslog": {Port: 5140, Protocol: networking.ProtocolUDP}, // only if `mode` is not `unix_udp` (default) or `unix_tcp`
"tcp": {Port: 5170, Protocol: networking.ProtocolTCP},
"udp": {Port: 5170, Protocol: networking.ProtocolUDP},
"cloudflare": {Port: 9880, Protocol: networking.ProtocolTCP},

// Outputs.
"prometheus_exporter": {Port: 2021, Protocol: networking.ProtocolTCP},
Expand Down
3 changes: 3 additions & 0 deletions service_port_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func TestConfig_ServicePorts(t *testing.T) {
name tcp
[INPUT]
name udp
[INPUT]
name cloudflare
[OUTPUT]
name prometheus_exporter
`, FormatClassic)
Expand All @@ -50,6 +52,7 @@ func TestConfig_ServicePorts(t *testing.T) {
{Port: 5140, Protocol: networking.ProtocolUDP, Kind: SectionKindInput, Plugin: &Plugin{ID: "syslog.7", Name: "syslog"}},
{Port: 5170, Protocol: networking.ProtocolTCP, Kind: SectionKindInput, Plugin: &Plugin{ID: "tcp.8", Name: "tcp"}},
{Port: 5170, Protocol: networking.ProtocolUDP, Kind: SectionKindInput, Plugin: &Plugin{ID: "udp.9", Name: "udp"}},
{Port: 9880, Protocol: networking.ProtocolTCP, Kind: SectionKindInput, Plugin: &Plugin{ID: "cloudflare.10", Name: "cloudflare"}},
{Port: 2021, Protocol: networking.ProtocolTCP, Kind: SectionKindOutput, Plugin: &Plugin{ID: "prometheus_exporter.0", Name: "prometheus_exporter"}},
}, config.ServicePorts())
})
Expand Down

0 comments on commit 278ad25

Please sign in to comment.