Skip to content

Commit d2f73a0

Browse files
discosturmarcofranssen
authored andcommitted
add more parameters to opensearch output plugin
Signed-off-by: Kilian Ries <mail@kilian-ries.de>
1 parent 5da05c6 commit d2f73a0

File tree

9 files changed

+2205
-2
lines changed

9 files changed

+2205
-2
lines changed

apis/fluentd/v1alpha1/plugins/output/opensearch.go

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,95 @@ type Opensearch struct {
2828
Password *plugins.Secret `json:"password,omitempty"`
2929
// Optional, Force certificate validation
3030
SslVerify *bool `json:"sslVerify,omitempty"`
31+
// Optional, Absolute path to CA certificate file
32+
CAFile *string `json:"caFile,omitempty"`
33+
// Optional, Absolute path to client Certificate file
34+
ClientCert *string `json:"clientCert,omitempty"`
35+
// Optional, Absolute path to client private Key file
36+
ClientKey *string `json:"clientKey,omitempty"`
37+
// Optional, password for ClientKey file
38+
ClientKeyPassword *plugins.Secret `json:"clientKeyPassword,omitempty"`
39+
// Optional, You can specify SSL/TLS version (default: TLSv1_2)
40+
SslVersion *string `json:"sslVersion,omitempty"`
41+
// Optional, Minimum SSL/TLS version
42+
SslMinVersion *string `json:"sslMinVersion,omitempty"`
43+
// Optional, Maximum SSL/TLS version
44+
SslMaxVersion *string `json:"sslMaxVersion,omitempty"`
45+
// Optional, Enable logging of 400 reason without enabling debug log level (default: false)
46+
LogOs400Reason *bool `json:"logOs400Reason,omitempty"`
47+
// Optional, HTTP request timeout in seconds (default: 5s)
48+
// +kubebuilder:validation:Pattern:="^\\d+(s|m|h|d)$"
49+
RequestTimeout *string `json:"requestTimeout,omitempty"`
50+
// Optional, Indicates that the plugin should reset connection on any error (reconnect on next send) (default: false)
51+
ReconnectOnError *bool `json:"reconnectOnError,omitempty"`
52+
// Optional, Automatically reload connection after 10000 documents (default: true)
53+
ReloadConnections *bool `json:"reloadConnections,omitempty"`
54+
// Optional, When ReloadConnections true, this is the integer number of operations after which the plugin will reload the connections (default: 10000)
55+
ReloadAfter *uint32 `json:"reloadAfter,omitempty"`
56+
// Optional, Indicates that the opensearch-transport will try to reload the nodes addresses if there is a failure while making the request (default: false)
57+
ReloadOnFailure *bool `json:"reloadOnFailure,omitempty"`
58+
// Optional, You can specify times of retry obtaining OpenSearch version (default: 15)
59+
MaxRetryGetOsVersion *uint32 `json:"maxRetryGetOsVersion,omitempty"`
60+
// Optional, Indicates whether to fail when max_retry_get_os_version is exceeded (default: true)
61+
FailOnDetectingOsVersionRetryExceed *bool `json:"failOnDetectingOsVersionRetryExceed,omitempty"`
62+
// Optional, Default OpenSearch version (default: 1)
63+
DefaultOpensearchVersion *uint32 `json:"defaultOpensearchVersion,omitempty"`
64+
// Optional, Validate OpenSearch version at startup (default: true)
65+
VerifyOsVersionAtStartup *bool `json:"verifyOsVersionAtStartup,omitempty"`
66+
// Optional, Always update the template, even if it already exists (default: false)
67+
TemplateOverwrite *bool `json:"templateOverwrite,omitempty"`
68+
// Optional, You can specify times of retry putting template (default: 10)
69+
MaxRetryPuttingTemplate *uint32 `json:"maxRetryPuttingTemplate,omitempty"`
70+
// Optional, Indicates whether to fail when max_retry_putting_template is exceeded (default: true)
71+
FailOnPuttingTemplateRetryExceed *bool `json:"failOnPuttingTemplateRetryExceed,omitempty"`
72+
// Optional, Provide a different sniffer class name
73+
SnifferClassName *string `json:"snifferClassName,omitempty"`
74+
// Optional, Provide a selector class name
75+
SelectorClassName *string `json:"selectorClassName,omitempty"`
76+
// Optional, You can specify HTTP backend (default: excon). Options: excon, typhoeus
77+
HttpBackend *string `json:"httpBackend,omitempty"`
78+
// Optional, With http_backend_excon_nonblock false, plugin uses excon with nonblock=false (default: true)
79+
HttpBackendExconNonblock *bool `json:"httpBackendExconNonblock,omitempty"`
80+
// Optional, You can specify the compression level (default: no_compression). Options: no_compression, best_compression, best_speed, default_compression
81+
CompressionLevel *string `json:"compressionLevel,omitempty"`
82+
// Optional, With default behavior, plugin uses Yajl as JSON encoder/decoder. Set to true to use Oj (default: false)
83+
PreferOjSerializer *bool `json:"preferOjSerializer,omitempty"`
84+
// Optional, Suppress '[types removal]' warnings on OpenSearch 2.x (default: true for OS2+)
85+
SuppressTypeName *bool `json:"suppressTypeName,omitempty"`
86+
// Optional, With content_type application/x-ndjson, plugin adds application/x-ndjson as Content-Type (default: application/json)
87+
ContentType *string `json:"contentType,omitempty"`
88+
// Optional, Include tag key in record (default: false)
89+
IncludeTagKey *bool `json:"includeTagKey,omitempty"`
90+
// Optional, Tag key name when include_tag_key is true (default: tag)
91+
TagKey *string `json:"tagKey,omitempty"`
92+
// Optional, Record accessor syntax to specify the field to use as _id in OpenSearch
93+
IdKey *string `json:"idKey,omitempty"`
94+
// Optional, Remove specified keys from the event record
95+
RemoveKeys *string `json:"removeKeys,omitempty"`
96+
// Optional, Remove keys when record is being updated
97+
RemoveKeysOnUpdate *string `json:"removeKeysOnUpdate,omitempty"`
98+
// Optional, The write operation (default: index). Options: index, create, update, upsert
99+
WriteOperation *string `json:"writeOperation,omitempty"`
100+
// Optional, When write_operation is not index, setting this true will cause plugin to emit_error_event of records which do not include _id field (default: false)
101+
EmitErrorForMissingId *bool `json:"emitErrorForMissingId,omitempty"`
102+
// Optional, Custom headers in Hash format
103+
CustomHeaders *string `json:"customHeaders,omitempty"`
104+
// Optional, Pipeline name
105+
Pipeline *string `json:"pipeline,omitempty"`
106+
// Optional, UTC index (default: false for local time)
107+
UtcIndex *bool `json:"utcIndex,omitempty"`
108+
// Optional, Suppress doc_wrap (default: false)
109+
SuppressDocWrap *bool `json:"suppressDocWrap,omitempty"`
110+
// Optional, List of exception classes to ignore
111+
IgnoreExceptions *string `json:"ignoreExceptions,omitempty"`
112+
// Optional, Backup chunk when ignore exception occurs (default: true)
113+
ExceptionBackup *bool `json:"exceptionBackup,omitempty"`
114+
// Optional, Configure bulk_message request splitting threshold size (default: -1 unlimited)
115+
BulkMessageRequestThreshold *int32 `json:"bulkMessageRequestThreshold,omitempty"`
116+
// Optional, Specify the application name for the rollover index to be created (default: default)
117+
ApplicationName *string `json:"applicationName,omitempty"`
118+
// Optional, Specify the index date pattern for creating a rollover index (default: now/d)
119+
IndexDatePattern *string `json:"indexDatePattern,omitempty"`
120+
// Optional, Use legacy template or not (default: false for composable templates)
121+
UseLegacyTemplate *bool `json:"useLegacyTemplate,omitempty"`
31122
}

apis/fluentd/v1alpha1/plugins/output/types.go

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,190 @@ func (o *Output) opensearchPlugin(parent *params.PluginStore, loader plugins.Sec
510510
parent.InsertPairs("ssl_verify", fmt.Sprint(*o.Opensearch.SslVerify))
511511
}
512512

513+
if o.Opensearch.CAFile != nil {
514+
parent.InsertPairs("ca_file", fmt.Sprint(*o.Opensearch.CAFile))
515+
}
516+
517+
if o.Opensearch.ClientCert != nil {
518+
parent.InsertPairs("client_cert", fmt.Sprint(*o.Opensearch.ClientCert))
519+
}
520+
521+
if o.Opensearch.ClientKey != nil {
522+
parent.InsertPairs("client_key", fmt.Sprint(*o.Opensearch.ClientKey))
523+
}
524+
525+
if o.Opensearch.ClientKeyPassword != nil {
526+
pwd, err := loader.LoadSecret(*o.Opensearch.ClientKeyPassword)
527+
if err != nil {
528+
return nil, err
529+
}
530+
parent.InsertPairs("client_key_pass", pwd)
531+
}
532+
533+
if o.Opensearch.SslVersion != nil {
534+
parent.InsertPairs("ssl_version", fmt.Sprint(*o.Opensearch.SslVersion))
535+
}
536+
537+
if o.Opensearch.SslMinVersion != nil {
538+
parent.InsertPairs("ssl_min_version", fmt.Sprint(*o.Opensearch.SslMinVersion))
539+
}
540+
541+
if o.Opensearch.SslMaxVersion != nil {
542+
parent.InsertPairs("ssl_max_version", fmt.Sprint(*o.Opensearch.SslMaxVersion))
543+
}
544+
545+
if o.Opensearch.LogOs400Reason != nil {
546+
parent.InsertPairs("log_os_400_reason", fmt.Sprint(*o.Opensearch.LogOs400Reason))
547+
}
548+
549+
if o.Opensearch.RequestTimeout != nil {
550+
parent.InsertPairs("request_timeout", fmt.Sprint(*o.Opensearch.RequestTimeout))
551+
}
552+
553+
if o.Opensearch.ReconnectOnError != nil {
554+
parent.InsertPairs("reconnect_on_error", fmt.Sprint(*o.Opensearch.ReconnectOnError))
555+
}
556+
557+
if o.Opensearch.ReloadConnections != nil {
558+
parent.InsertPairs("reload_connections", fmt.Sprint(*o.Opensearch.ReloadConnections))
559+
}
560+
561+
if o.Opensearch.ReloadAfter != nil {
562+
parent.InsertPairs("reload_after", fmt.Sprint(*o.Opensearch.ReloadAfter))
563+
}
564+
565+
if o.Opensearch.ReloadOnFailure != nil {
566+
parent.InsertPairs("reload_on_failure", fmt.Sprint(*o.Opensearch.ReloadOnFailure))
567+
}
568+
569+
if o.Opensearch.MaxRetryGetOsVersion != nil {
570+
parent.InsertPairs("max_retry_get_os_version", fmt.Sprint(*o.Opensearch.MaxRetryGetOsVersion))
571+
}
572+
573+
if o.Opensearch.FailOnDetectingOsVersionRetryExceed != nil {
574+
parent.InsertPairs("fail_on_detecting_os_version_retry_exceed", fmt.Sprint(*o.Opensearch.FailOnDetectingOsVersionRetryExceed))
575+
}
576+
577+
if o.Opensearch.DefaultOpensearchVersion != nil {
578+
parent.InsertPairs("default_opensearch_version", fmt.Sprint(*o.Opensearch.DefaultOpensearchVersion))
579+
}
580+
581+
if o.Opensearch.VerifyOsVersionAtStartup != nil {
582+
parent.InsertPairs("verify_os_version_at_startup", fmt.Sprint(*o.Opensearch.VerifyOsVersionAtStartup))
583+
}
584+
585+
if o.Opensearch.TemplateOverwrite != nil {
586+
parent.InsertPairs("template_overwrite", fmt.Sprint(*o.Opensearch.TemplateOverwrite))
587+
}
588+
589+
if o.Opensearch.MaxRetryPuttingTemplate != nil {
590+
parent.InsertPairs("max_retry_putting_template", fmt.Sprint(*o.Opensearch.MaxRetryPuttingTemplate))
591+
}
592+
593+
if o.Opensearch.FailOnPuttingTemplateRetryExceed != nil {
594+
parent.InsertPairs("fail_on_putting_template_retry_exceed", fmt.Sprint(*o.Opensearch.FailOnPuttingTemplateRetryExceed))
595+
}
596+
597+
if o.Opensearch.SnifferClassName != nil {
598+
parent.InsertPairs("sniffer_class_name", fmt.Sprint(*o.Opensearch.SnifferClassName))
599+
}
600+
601+
if o.Opensearch.SelectorClassName != nil {
602+
parent.InsertPairs("selector_class_name", fmt.Sprint(*o.Opensearch.SelectorClassName))
603+
}
604+
605+
if o.Opensearch.HttpBackend != nil {
606+
parent.InsertPairs("http_backend", fmt.Sprint(*o.Opensearch.HttpBackend))
607+
}
608+
609+
if o.Opensearch.HttpBackendExconNonblock != nil {
610+
parent.InsertPairs("http_backend_excon_nonblock", fmt.Sprint(*o.Opensearch.HttpBackendExconNonblock))
611+
}
612+
613+
if o.Opensearch.CompressionLevel != nil {
614+
parent.InsertPairs("compression_level", fmt.Sprint(*o.Opensearch.CompressionLevel))
615+
}
616+
617+
if o.Opensearch.PreferOjSerializer != nil {
618+
parent.InsertPairs("prefer_oj_serializer", fmt.Sprint(*o.Opensearch.PreferOjSerializer))
619+
}
620+
621+
if o.Opensearch.SuppressTypeName != nil {
622+
parent.InsertPairs("suppress_type_name", fmt.Sprint(*o.Opensearch.SuppressTypeName))
623+
}
624+
625+
if o.Opensearch.ContentType != nil {
626+
parent.InsertPairs("content_type", fmt.Sprint(*o.Opensearch.ContentType))
627+
}
628+
629+
if o.Opensearch.IncludeTagKey != nil {
630+
parent.InsertPairs("include_tag_key", fmt.Sprint(*o.Opensearch.IncludeTagKey))
631+
}
632+
633+
if o.Opensearch.TagKey != nil {
634+
parent.InsertPairs("tag_key", fmt.Sprint(*o.Opensearch.TagKey))
635+
}
636+
637+
if o.Opensearch.IdKey != nil {
638+
parent.InsertPairs("id_key", fmt.Sprint(*o.Opensearch.IdKey))
639+
}
640+
641+
if o.Opensearch.RemoveKeys != nil {
642+
parent.InsertPairs("remove_keys", fmt.Sprint(*o.Opensearch.RemoveKeys))
643+
}
644+
645+
if o.Opensearch.RemoveKeysOnUpdate != nil {
646+
parent.InsertPairs("remove_keys_on_update", fmt.Sprint(*o.Opensearch.RemoveKeysOnUpdate))
647+
}
648+
649+
if o.Opensearch.WriteOperation != nil {
650+
parent.InsertPairs("write_operation", fmt.Sprint(*o.Opensearch.WriteOperation))
651+
}
652+
653+
if o.Opensearch.EmitErrorForMissingId != nil {
654+
parent.InsertPairs("emit_error_for_missing_id", fmt.Sprint(*o.Opensearch.EmitErrorForMissingId))
655+
}
656+
657+
if o.Opensearch.CustomHeaders != nil {
658+
parent.InsertPairs("custom_headers", fmt.Sprint(*o.Opensearch.CustomHeaders))
659+
}
660+
661+
if o.Opensearch.Pipeline != nil {
662+
parent.InsertPairs("pipeline", fmt.Sprint(*o.Opensearch.Pipeline))
663+
}
664+
665+
if o.Opensearch.UtcIndex != nil {
666+
parent.InsertPairs("utc_index", fmt.Sprint(*o.Opensearch.UtcIndex))
667+
}
668+
669+
if o.Opensearch.SuppressDocWrap != nil {
670+
parent.InsertPairs("suppress_doc_wrap", fmt.Sprint(*o.Opensearch.SuppressDocWrap))
671+
}
672+
673+
if o.Opensearch.IgnoreExceptions != nil {
674+
parent.InsertPairs("ignore_exceptions", fmt.Sprint(*o.Opensearch.IgnoreExceptions))
675+
}
676+
677+
if o.Opensearch.ExceptionBackup != nil {
678+
parent.InsertPairs("exception_backup", fmt.Sprint(*o.Opensearch.ExceptionBackup))
679+
}
680+
681+
if o.Opensearch.BulkMessageRequestThreshold != nil {
682+
parent.InsertPairs("bulk_message_request_threshold", fmt.Sprint(*o.Opensearch.BulkMessageRequestThreshold))
683+
}
684+
685+
if o.Opensearch.ApplicationName != nil {
686+
parent.InsertPairs("application_name", fmt.Sprint(*o.Opensearch.ApplicationName))
687+
}
688+
689+
if o.Opensearch.IndexDatePattern != nil {
690+
parent.InsertPairs("index_date_pattern", fmt.Sprint(*o.Opensearch.IndexDatePattern))
691+
}
692+
693+
if o.Opensearch.UseLegacyTemplate != nil {
694+
parent.InsertPairs("use_legacy_template", fmt.Sprint(*o.Opensearch.UseLegacyTemplate))
695+
}
696+
513697
return parent, nil
514698
}
515699

0 commit comments

Comments
 (0)