Skip to content

Commit 9deb528

Browse files
committed
use azureInputConfig instead of authConfig
1 parent 296a37f commit 9deb528

File tree

4 files changed

+3
-37
lines changed

4 files changed

+3
-37
lines changed

docs/reference/filebeat/filebeat-input-azure-eventhub.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,10 @@ For detailed instructions on how to set up an Azure AD service principal and con
8585

8686
The `azure-eventhub` input supports the following configuration options:
8787

88-
8988
### `eventhub` [_eventhub]
9089

9190
The name of the eventhub users would like to read from, field required.
9291

93-
9492
### `consumer_group` [_consumer_group]
9593

9694
Optional, we recommend using a dedicated consumer group for the azure input. Reusing consumer groups among non-related consumers can cause unexpected behavior and possibly lost events.
@@ -118,7 +116,6 @@ This option is required if:
118116

119117
A Blob Storage account is required to store, retrieve, or update the offset or state of the Event Hub messages. This means that after stopping Filebeat it can resume from where it stopped processing messages.
120118

121-
122119
### `eventhub_namespace` [_eventhub_namespace]
123120

124121
```{applies_to}
@@ -164,27 +161,22 @@ Supported values:
164161
- `https://login.microsoftonline.us` (Azure Government)
165162
- `https://login.chinacloudapi.cn` (Azure China)
166163

167-
168164
### `storage_account` [_storage_account]
169165

170166
The name of the storage account. Required.
171167

172-
173168
### `storage_account_key` [_storage_account_key]
174169

175170
The storage account key, this key will be used to authorize access to data in your storage account, option is required.
176171

177-
178172
### `storage_account_container` [_storage_account_container]
179173

180174
Optional, the name of the storage account container you would like to store the offset information in.
181175

182-
183176
### `resource_manager_endpoint` [_resource_manager_endpoint]
184177

185178
Optional, by default we are using the azure public environment, to override, users can provide a specific resource manager endpoint in order to use a different azure environment. Ex: [https://management.chinacloudapi.cn/](https://management.chinacloudapi.cn/) for azure ChinaCloud [https://management.microsoftazure.de/](https://management.microsoftazure.de/) for azure GermanCloud [https://management.azure.com/](https://management.azure.com/) for azure PublicCloud [https://management.usgovcloudapi.net/](https://management.usgovcloudapi.net/) for azure USGovernmentCloud Users can also use this in case of a Hybrid Cloud model, where one may define their own endpoints.
186179

187-
188180
## Metrics [_metrics_3]
189181

190182
This input exposes metrics under the [HTTP monitoring endpoint](/reference/filebeat/http-endpoint.md). These metrics are exposed under the `/inputs` path. They can be used to observe the activity of the input.

x-pack/filebeat/input/azureeventhub/auth.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,6 @@ const (
2424
AuthTypeClientSecret string = "client_secret"
2525
)
2626

27-
// authConfig represents the authentication configuration.
28-
type authConfig struct {
29-
// AuthType specifies the authentication method to use.
30-
// If not specified, will be inferred from other fields:
31-
// - If connection_string is provided, defaults to connection_string
32-
// - Otherwise, defaults to client_secret
33-
AuthType string
34-
35-
// Connection string authentication
36-
ConnectionString string
37-
38-
// Client secret authentication
39-
TenantID string
40-
ClientID string
41-
ClientSecret string
42-
AuthorityHost string
43-
}
44-
4527
// createCredential creates a TokenCredential if needed based on the authentication type.
4628
// Returns nil for connection_string authentication (which doesn't use credentials).
4729
func createCredential(cfg *azureInputConfig, log *logp.Logger) (azcore.TokenCredential, error) {
@@ -50,14 +32,7 @@ func createCredential(cfg *azureInputConfig, log *logp.Logger) (azcore.TokenCred
5032
// No credential needed for connection string authentication
5133
return nil, nil
5234
case AuthTypeClientSecret:
53-
credConfig := authConfig{
54-
AuthType: cfg.AuthType,
55-
TenantID: cfg.TenantID,
56-
ClientID: cfg.ClientID,
57-
ClientSecret: cfg.ClientSecret,
58-
AuthorityHost: cfg.AuthorityHost,
59-
}
60-
credential, err := newClientSecretCredential(credConfig, log)
35+
credential, err := newClientSecretCredential(cfg, log)
6136
if err != nil {
6237
return nil, fmt.Errorf("failed to create client secret credential: %w", err)
6338
}
@@ -196,4 +171,3 @@ func CreateStorageAccountContainerClient(cfg *azureInputConfig, log *logp.Logger
196171
return nil, fmt.Errorf("invalid auth_type: %s", cfg.AuthType)
197172
}
198173
}
199-

x-pack/filebeat/input/azureeventhub/client_secret.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
// newClientSecretCredential creates a new client secret credential(Oauth2).
20-
func newClientSecretCredential(config authConfig, log *logp.Logger) (azcore.TokenCredential, error) {
20+
func newClientSecretCredential(config *azureInputConfig, log *logp.Logger) (azcore.TokenCredential, error) {
2121
log = log.Named("client_secret")
2222

2323
if config.TenantID == "" {

x-pack/filebeat/input/azureeventhub/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ func TestConnectionStringConfigValidation(t *testing.T) {
422422
return c
423423
}(),
424424
expectError: true,
425-
errorMsg: "storage_account_connection_string is required when using connection_string authentication with processor v2",
425+
errorMsg: "no storage account connection string configured (config: storage_account_connection_string)",
426426
},
427427
{
428428
name: "invalid auth_type",

0 commit comments

Comments
 (0)