-
Notifications
You must be signed in to change notification settings - Fork 231
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
Adding Splunk output-types for fluentbit #417
Conversation
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
ff63d94
to
91ae38d
Compare
// +kubebuilder:validation:Maximum:=65535 | ||
Port *int32 `json:"port,omitempty"` | ||
// Specify the Authentication Token for the HTTP Event Collector interface. | ||
SplunkToken string `json:"splunk_token,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe splunkToken
is better
HTTPPasswd *plugins.Secret `json:"httpPassword,omitempty"` | ||
// If the HTTP server response code is 400 (bad request) and this flag is enabled, it will print the full HTTP request | ||
// and response to the stdout interface. This feature is available for debugging purposes. | ||
HTTPDebugBadRequest bool `json:"httpDebugBadRequest,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTPDebugBadRequest bool `json:"httpDebugBadRequest,omitempty"` | ||
// When enabled, the record keys and values are set in the top level of the map instead of under the event key. Refer to | ||
// the Sending Raw Events section from the docs for more details to make this option work properly. | ||
SplunkSendRaw bool `json:"splunkSendRaw,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*bool
kvs.Insert("HTTP_Passwd", pwd) | ||
} | ||
if o.Compress != "" { | ||
kvs.Insert("Index", o.Compress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index?
kvs.Insert("Index", o.Compress) | ||
} | ||
if o.Channel != "" { | ||
kvs.Insert("Type", o.Channel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type
is wrong.
@wanjunlei would you help to review this? |
These two commands should be executed after the changes are made.
|
if o.SplunkToken != "" { | ||
kvs.Insert("Splunk_Token", o.SplunkToken) | ||
} | ||
if o.BufferSize != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be http_buffer_size
func (o *Splunk) Params(sl plugins.SecretLoader) (*params.KVs, error) { | ||
kvs := params.NewKVs() | ||
if o.Host != "" { | ||
kvs.Insert("Host", o.Host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uppercase is not recommended for code consistency.
kvs.Insert("Host", o.Host) => kvs.Insert("host", o.Host)
Others also need to be modified.
if o.HTTPDebugBadRequest { | ||
kvs.Insert("HTTP_Debug_Bad_Request", "On") | ||
} else { | ||
kvs.Insert("HTTP_Debug_Bad_Request", "Off") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is redundant, the default is Off
.
if o.SplunkSendRaw { | ||
kvs.Insert("Splunk_Send_Raw", "On") | ||
} else { | ||
kvs.Insert("Splunk_Send_Raw", "Off") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
f4e91e3
to
0284128
Compare
I hopefully fixed all findings n ow :) Thanks for looking into this so quickly |
kvs.Insert("splunk_token", o.SplunkToken) | ||
} | ||
if o.BufferSize != "" { | ||
kvs.Insert("buffer_size", o.BufferSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SplunkToken string `json:"splunkToken,omitempty"` | ||
//Buffer size used to receive Splunk HTTP responses: Default `2M` | ||
// +kubebuilder:validation:Pattern:="^\\d+(k|K|KB|kb|m|M|MB|mb|g|G|GB|gb)?$" | ||
BufferSize string `json:"bufferSize,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bufferSize -> httpBufferSize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok that's what you meant, will fix that :)
Compress string `json:"compress,omitempty"` | ||
// Specify X-Splunk-Request-Channel Header for the HTTP Event Collector interface. | ||
Channel string `json:"channel,omitempty"` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for a blank line here.
Signed-off-by: Michael J. Wieneke <m.wieneke@sap.com>
What this PR does / why we need it:
This PR adds the ability to fluent-operator to configure Splunk as an output for fluentbit. Fluentbit already supports Splunk as output but so far fluent-operator simply can not configure a fluentbit-pod to actually make use of that. This PR intends to change that.
In other words it enables users of the fluent-operator to use more of the features fluentbit already has.
I am not an experienced go-developer and have simply used similar PRs (e.g.: PRs that add the opensearch-output types) and fluentbits' documentation for Splunk (here) as base for my work.
Please review and test carefully.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: