Skip to content

Commit d3be9bf

Browse files
authored
Remove settings on ES exporter config that no longer function (#46428)
* Remove settings on ES exporter config that no longer function
1 parent 9432137 commit d3be9bf

File tree

10 files changed

+528
-67
lines changed

10 files changed

+528
-67
lines changed

NOTICE.txt

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14351,6 +14351,217 @@ See the License for the specific language governing permissions and
1435114351
limitations under the License.
1435214352

1435314353

14354+
--------------------------------------------------------------------------------
14355+
Dependency : github.com/elastic/opentelemetry-collector-components/extension/beatsauthextension
14356+
Version: v0.2.0
14357+
Licence type (autodetected): Apache-2.0
14358+
--------------------------------------------------------------------------------
14359+
14360+
Contents of probable licence file $GOMODCACHE/github.com/elastic/opentelemetry-collector-components/extension/[email protected]/LICENSE:
14361+
14362+
Apache License
14363+
Version 2.0, January 2004
14364+
http://www.apache.org/licenses/
14365+
14366+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14367+
14368+
1. Definitions.
14369+
14370+
"License" shall mean the terms and conditions for use, reproduction,
14371+
and distribution as defined by Sections 1 through 9 of this document.
14372+
14373+
"Licensor" shall mean the copyright owner or entity authorized by
14374+
the copyright owner that is granting the License.
14375+
14376+
"Legal Entity" shall mean the union of the acting entity and all
14377+
other entities that control, are controlled by, or are under common
14378+
control with that entity. For the purposes of this definition,
14379+
"control" means (i) the power, direct or indirect, to cause the
14380+
direction or management of such entity, whether by contract or
14381+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
14382+
outstanding shares, or (iii) beneficial ownership of such entity.
14383+
14384+
"You" (or "Your") shall mean an individual or Legal Entity
14385+
exercising permissions granted by this License.
14386+
14387+
"Source" form shall mean the preferred form for making modifications,
14388+
including but not limited to software source code, documentation
14389+
source, and configuration files.
14390+
14391+
"Object" form shall mean any form resulting from mechanical
14392+
transformation or translation of a Source form, including but
14393+
not limited to compiled object code, generated documentation,
14394+
and conversions to other media types.
14395+
14396+
"Work" shall mean the work of authorship, whether in Source or
14397+
Object form, made available under the License, as indicated by a
14398+
copyright notice that is included in or attached to the work
14399+
(an example is provided in the Appendix below).
14400+
14401+
"Derivative Works" shall mean any work, whether in Source or Object
14402+
form, that is based on (or derived from) the Work and for which the
14403+
editorial revisions, annotations, elaborations, or other modifications
14404+
represent, as a whole, an original work of authorship. For the purposes
14405+
of this License, Derivative Works shall not include works that remain
14406+
separable from, or merely link (or bind by name) to the interfaces of,
14407+
the Work and Derivative Works thereof.
14408+
14409+
"Contribution" shall mean any work of authorship, including
14410+
the original version of the Work and any modifications or additions
14411+
to that Work or Derivative Works thereof, that is intentionally
14412+
submitted to Licensor for inclusion in the Work by the copyright owner
14413+
or by an individual or Legal Entity authorized to submit on behalf of
14414+
the copyright owner. For the purposes of this definition, "submitted"
14415+
means any form of electronic, verbal, or written communication sent
14416+
to the Licensor or its representatives, including but not limited to
14417+
communication on electronic mailing lists, source code control systems,
14418+
and issue tracking systems that are managed by, or on behalf of, the
14419+
Licensor for the purpose of discussing and improving the Work, but
14420+
excluding communication that is conspicuously marked or otherwise
14421+
designated in writing by the copyright owner as "Not a Contribution."
14422+
14423+
"Contributor" shall mean Licensor and any individual or Legal Entity
14424+
on behalf of whom a Contribution has been received by Licensor and
14425+
subsequently incorporated within the Work.
14426+
14427+
2. Grant of Copyright License. Subject to the terms and conditions of
14428+
this License, each Contributor hereby grants to You a perpetual,
14429+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
14430+
copyright license to reproduce, prepare Derivative Works of,
14431+
publicly display, publicly perform, sublicense, and distribute the
14432+
Work and such Derivative Works in Source or Object form.
14433+
14434+
3. Grant of Patent License. Subject to the terms and conditions of
14435+
this License, each Contributor hereby grants to You a perpetual,
14436+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
14437+
(except as stated in this section) patent license to make, have made,
14438+
use, offer to sell, sell, import, and otherwise transfer the Work,
14439+
where such license applies only to those patent claims licensable
14440+
by such Contributor that are necessarily infringed by their
14441+
Contribution(s) alone or by combination of their Contribution(s)
14442+
with the Work to which such Contribution(s) was submitted. If You
14443+
institute patent litigation against any entity (including a
14444+
cross-claim or counterclaim in a lawsuit) alleging that the Work
14445+
or a Contribution incorporated within the Work constitutes direct
14446+
or contributory patent infringement, then any patent licenses
14447+
granted to You under this License for that Work shall terminate
14448+
as of the date such litigation is filed.
14449+
14450+
4. Redistribution. You may reproduce and distribute copies of the
14451+
Work or Derivative Works thereof in any medium, with or without
14452+
modifications, and in Source or Object form, provided that You
14453+
meet the following conditions:
14454+
14455+
(a) You must give any other recipients of the Work or
14456+
Derivative Works a copy of this License; and
14457+
14458+
(b) You must cause any modified files to carry prominent notices
14459+
stating that You changed the files; and
14460+
14461+
(c) You must retain, in the Source form of any Derivative Works
14462+
that You distribute, all copyright, patent, trademark, and
14463+
attribution notices from the Source form of the Work,
14464+
excluding those notices that do not pertain to any part of
14465+
the Derivative Works; and
14466+
14467+
(d) If the Work includes a "NOTICE" text file as part of its
14468+
distribution, then any Derivative Works that You distribute must
14469+
include a readable copy of the attribution notices contained
14470+
within such NOTICE file, excluding those notices that do not
14471+
pertain to any part of the Derivative Works, in at least one
14472+
of the following places: within a NOTICE text file distributed
14473+
as part of the Derivative Works; within the Source form or
14474+
documentation, if provided along with the Derivative Works; or,
14475+
within a display generated by the Derivative Works, if and
14476+
wherever such third-party notices normally appear. The contents
14477+
of the NOTICE file are for informational purposes only and
14478+
do not modify the License. You may add Your own attribution
14479+
notices within Derivative Works that You distribute, alongside
14480+
or as an addendum to the NOTICE text from the Work, provided
14481+
that such additional attribution notices cannot be construed
14482+
as modifying the License.
14483+
14484+
You may add Your own copyright statement to Your modifications and
14485+
may provide additional or different license terms and conditions
14486+
for use, reproduction, or distribution of Your modifications, or
14487+
for any such Derivative Works as a whole, provided Your use,
14488+
reproduction, and distribution of the Work otherwise complies with
14489+
the conditions stated in this License.
14490+
14491+
5. Submission of Contributions. Unless You explicitly state otherwise,
14492+
any Contribution intentionally submitted for inclusion in the Work
14493+
by You to the Licensor shall be under the terms and conditions of
14494+
this License, without any additional terms or conditions.
14495+
Notwithstanding the above, nothing herein shall supersede or modify
14496+
the terms of any separate license agreement you may have executed
14497+
with Licensor regarding such Contributions.
14498+
14499+
6. Trademarks. This License does not grant permission to use the trade
14500+
names, trademarks, service marks, or product names of the Licensor,
14501+
except as required for reasonable and customary use in describing the
14502+
origin of the Work and reproducing the content of the NOTICE file.
14503+
14504+
7. Disclaimer of Warranty. Unless required by applicable law or
14505+
agreed to in writing, Licensor provides the Work (and each
14506+
Contributor provides its Contributions) on an "AS IS" BASIS,
14507+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14508+
implied, including, without limitation, any warranties or conditions
14509+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
14510+
PARTICULAR PURPOSE. You are solely responsible for determining the
14511+
appropriateness of using or redistributing the Work and assume any
14512+
risks associated with Your exercise of permissions under this License.
14513+
14514+
8. Limitation of Liability. In no event and under no legal theory,
14515+
whether in tort (including negligence), contract, or otherwise,
14516+
unless required by applicable law (such as deliberate and grossly
14517+
negligent acts) or agreed to in writing, shall any Contributor be
14518+
liable to You for damages, including any direct, indirect, special,
14519+
incidental, or consequential damages of any character arising as a
14520+
result of this License or out of the use or inability to use the
14521+
Work (including but not limited to damages for loss of goodwill,
14522+
work stoppage, computer failure or malfunction, or any and all
14523+
other commercial damages or losses), even if such Contributor
14524+
has been advised of the possibility of such damages.
14525+
14526+
9. Accepting Warranty or Additional Liability. While redistributing
14527+
the Work or Derivative Works thereof, You may choose to offer,
14528+
and charge a fee for, acceptance of support, warranty, indemnity,
14529+
or other liability obligations and/or rights consistent with this
14530+
License. However, in accepting such obligations, You may act only
14531+
on Your own behalf and on Your sole responsibility, not on behalf
14532+
of any other Contributor, and only if You agree to indemnify,
14533+
defend, and hold each Contributor harmless for any liability
14534+
incurred by, or claims asserted against, such Contributor by reason
14535+
of your accepting any such warranty or additional liability.
14536+
14537+
END OF TERMS AND CONDITIONS
14538+
14539+
APPENDIX: How to apply the Apache License to your work.
14540+
14541+
To apply the Apache License to your work, attach the following
14542+
boilerplate notice, with the fields enclosed by brackets "[]"
14543+
replaced with your own identifying information. (Don't include
14544+
the brackets!) The text should be enclosed in the appropriate
14545+
comment syntax for the file format. We also recommend that a
14546+
file or class name and description of purpose be included on the
14547+
same "printed page" as the copyright notice for easier
14548+
identification within third-party archives.
14549+
14550+
Copyright 2018 Elasticsearch BV
14551+
14552+
Licensed under the Apache License, Version 2.0 (the "License");
14553+
you may not use this file except in compliance with the License.
14554+
You may obtain a copy of the License at
14555+
14556+
http://www.apache.org/licenses/LICENSE-2.0
14557+
14558+
Unless required by applicable law or agreed to in writing, software
14559+
distributed under the License is distributed on an "AS IS" BASIS,
14560+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14561+
See the License for the specific language governing permissions and
14562+
limitations under the License.
14563+
14564+
1435414565
--------------------------------------------------------------------------------
1435514566
Dependency : github.com/elastic/sarama
1435614567
Version: v1.19.1-0.20250603175145-7672917f26b6

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ require (
236236
require (
237237
github.com/apache/arrow-go/v18 v18.4.1
238238
github.com/cilium/ebpf v0.19.0
239+
github.com/elastic/opentelemetry-collector-components/extension/beatsauthextension v0.2.0
239240
go.opentelemetry.io/collector/client v1.41.0
240241
go.opentelemetry.io/collector/exporter v0.135.0
241242
go.opentelemetry.io/collector/exporter/exporterhelper v0.135.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ github.com/elastic/mito v1.22.0 h1:DW4RkO+PLwSbKVF5ijYzi0ug+TKzLL+DVJRzbOPbzQ0=
420420
github.com/elastic/mito v1.22.0/go.mod h1:h1V+8B62+DXsu0TstJkjsTh5ewJIDJlwzxPkP3HBM9s=
421421
github.com/elastic/mock-es v0.0.0-20250530054253-8c3b6053f9b6 h1:JVNuBrmOoqLJgp9o68YBMnOrXCzQI3mCppW+suwRSlw=
422422
github.com/elastic/mock-es v0.0.0-20250530054253-8c3b6053f9b6/go.mod h1:cXqWcLnmu5y4QveTb2hjk7rgzkHMuZsqeXtbJpNAcu0=
423+
github.com/elastic/opentelemetry-collector-components/extension/beatsauthextension v0.2.0 h1:cQ4Bu5iyJn5jk68OdwpGIifqVwAZUCoYpN3ZVbVRGBA=
424+
github.com/elastic/opentelemetry-collector-components/extension/beatsauthextension v0.2.0/go.mod h1:aG7w7AA2CydjMxGG6zUZggXCPa+jVRhVYo/92wiDx4Q=
423425
github.com/elastic/pkcs8 v1.0.0 h1:HhitlUKxhN288kcNcYkjW6/ouvuwJWd9ioxpjnD9jVA=
424426
github.com/elastic/pkcs8 v1.0.0/go.mod h1:ipsZToJfq1MxclVTwpG7U/bgeDtf+0HkUiOxebk95+0=
425427
github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6 h1:2COw7kzXkIyS4hKNUl5qw0KolrwncrY4VVNpngVNo8I=

libbeat/otelbeat/beatconverter/beatconverter.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ import (
2626
"github.com/elastic/beats/v7/libbeat/cloudid"
2727
elasticsearchtranslate "github.com/elastic/beats/v7/libbeat/otelbeat/oteltranslate/outputs/elasticsearch"
2828
logstashstranslate "github.com/elastic/beats/v7/libbeat/otelbeat/oteltranslate/outputs/logstash"
29+
"github.com/elastic/beats/v7/libbeat/outputs/elasticsearch"
2930
"github.com/elastic/elastic-agent-libs/config"
3031
"github.com/elastic/elastic-agent-libs/logp"
3132
)
3233

3334
// list of supported beatreceivers
34-
var supportedReceivers = []string{"filebeatreceiver", "metricbeatreceiver"} // Add more beat receivers to this list when we add support
35+
var (
36+
supportedReceivers = []string{"filebeatreceiver", "metricbeatreceiver"} // Add more beat receivers to this list when we add support
37+
beatsAuthName = "beatsauth"
38+
)
3539

3640
type converter struct{}
3741

@@ -123,11 +127,26 @@ func (c converter) Convert(_ context.Context, conf *confmap.Conf) error {
123127
}
124128
}
125129

130+
// get beatsauth config
131+
authConfig, err := getBeatsAuthExtensionConfig(esConfig)
132+
if err != nil {
133+
return fmt.Errorf("cannot translate http settings on beatsauth extension: %w", err)
134+
}
135+
136+
// set authenticator name on ES exporter
137+
esOTelConfig["auth"] = map[string]any{
138+
"authenticator": beatsAuthName,
139+
}
140+
126141
out = map[string]any{
127142
"service::pipelines::logs::exporters": []string{"elasticsearch"},
143+
"service::extensions": []interface{}{beatsAuthName},
128144
"exporters": map[string]any{
129145
"elasticsearch": esOTelConfig,
130146
},
147+
"extensions": map[string]any{
148+
beatsAuthName: authConfig,
149+
},
131150
}
132151
err = conf.Merge(confmap.NewFromStringMap(out))
133152
if err != nil {
@@ -230,3 +249,26 @@ func promoteOutputQueueSettings(beatReceiverConfigKey string, outputConfig *conf
230249

231250
return nil
232251
}
252+
253+
// getBeatsAuthExtensionConfig sets http transport settings on beatsauth
254+
// currently this is only supported for elasticsearch output
255+
func getBeatsAuthExtensionConfig(cfg *config.C) (map[string]any, error) {
256+
defaultTransportSettings := elasticsearch.ESDefaultTransportSettings()
257+
err := cfg.Unpack(&defaultTransportSettings)
258+
if err != nil {
259+
return nil, err
260+
}
261+
262+
newConfig, err := config.NewConfigFrom(defaultTransportSettings)
263+
if err != nil {
264+
return nil, err
265+
}
266+
267+
var newMap map[string]any
268+
err = newConfig.Unpack(&newMap)
269+
if err != nil {
270+
return nil, err
271+
}
272+
273+
return newMap, nil
274+
}

0 commit comments

Comments
 (0)