Skip to content
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

Support CLI flag shortcuts for Cloud configuration #4959

Closed
2 tasks
tsg opened this issue Aug 21, 2017 · 3 comments
Closed
2 tasks

Support CLI flag shortcuts for Cloud configuration #4959

tsg opened this issue Aug 21, 2017 · 3 comments
Labels
discuss Issue needs further discussion. meta needs_docs v6.0.0-beta2

Comments

@tsg
Copy link
Contributor

tsg commented Aug 21, 2017

To simplify the usage of Beats with Elastic Cloud, this proposes the addition of two new CLI flags:

   -E cloud.id=<cloud-id>
   -E cloud.auth"<user:pass>

These options are CLI only, but they overwrite settings in the configuration file.

Starting with cloud.auth because it's simpler, the username and password are used to overwrite output.elasticsearch.username and output.elasticsearch.password. Using the new flag is equivalent with doing -E output.elasticsearch.username=<user> -E output.elasticsearch.password=<pass>, but shorter.

The cloud-id, to be passed to the cloud.id setting, looks something like this:

staging:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRjZWM2ZjI2MWE3NGJmMjRjZTMzYmI4ODExYjg0Mjk0ZiRjNmMyY2E2ZDA0MjI0OWFmMGNjN2Q3YTllOTYyNTc0Mw==

This can be decomposed using the following algorithm:

  1. Everything up to the first : is ignored. This is an optional user friendly token that can be used to more easily identify the cloud ID. If no : is present, then the IS is passed as is to the next step.

  2. The rest of the ID is base64 decoded:

    us-east-1.aws.found.io$cec6f261a74bf24ce33bb8811b84294f$c6c2ca6d042249af0cc7d7a9e9625743

  3. There are three parts, separated by $, in order:

    host: us-east-1.aws.found.io
    es-id: cec6f261a74bf24ce33bb8811b84294f
    kibana-id: c6c2ca6d042249af0cc7d7a9e9625743

  4. The es-id and kibana-id are parsed as URLs, and host is appended to their host parts. The https scheme and port 443 are added:

    es-url: https://cec6f261a74bf24ce33bb8811b84294f.us-east-1.aws.found.io:443
    kibana-url: https://c6c2ca6d042249af0cc7d7a9e9625743.us-east-1.aws.found.io:443

The resulting es-url and kibana-url are used to overwrite the settings output.elasticsearch.hosts and setup.kibana.hosts.

TODOs:

@suyograo
Copy link

@tsg is it cloud-auth or cloud.auth? Why not make it consistent?

@suyograo
Copy link

I see beats uses dots in long options, ignore my comment :)

@tsg
Copy link
Contributor Author

tsg commented Aug 22, 2017

A small change of plans, after discussing things in our team meeting, we decided to have a way to specify the cloud.id/cloud.auth in the CLI but also in the config file. Otherwise, there's no reasonable transition from "trying things out" to "this is my configuration and want to run it as a service".

Playing with possible implementations, most reasonable is to have cloud.id and cloud.auth as config settings that can be overwritten from the CLI. So the CLI command looks like something like this:

./metricbeat -e -E cloud.id="cloudidtest:dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyQyNDlmM2FmMWY0ZWVlMjRhODRlM2I0MDFlNjhhMWIyYSRkNGFjNzU1OWQ0Njc0YjdjOTFhYmUxMDg1NmQ4NDMwNA==" -E 'cloud.auth=elastic:t5piSpmqYRTIGKQhPrJkvGyx'

tsg pushed a commit to tsg/beats that referenced this issue Aug 22, 2017
This adds two new configuration settings: `cloud.id` and `cloud.auth`.
They can be used in the configuration file, or from the CLI like this:

```
./metricbeat -e -E cloud.id=<cloud-id> -E cloud.auth=<cloud-auth>
```

The ES/KB settings are changed via overwritting, but we display an INFO
level message that the settings are changed by the cloud-id.

Closes elastic#4959.
@tsg tsg added the needs_docs label Aug 22, 2017
urso pushed a commit that referenced this issue Aug 23, 2017
* Added cloud.id and cloud.auth config settings

This adds two new configuration settings: `cloud.id` and `cloud.auth`.
They can be used in the configuration file, or from the CLI like this:

```
./metricbeat -e -E cloud.id=<cloud-id> -E cloud.auth=<cloud-auth>
```

The ES/KB settings are changed via overwritting, but we display an INFO
level message that the settings are changed by the cloud-id.

Closes #4959.

* goimports fix

* aded more tests

* added basic docs

* changelog

* addressed comments

* Check that we're not enabling a second output

* remove unused var

* Addressed comments
tsg added a commit to tsg/beats that referenced this issue Aug 23, 2017
* Added cloud.id and cloud.auth config settings

This adds two new configuration settings: `cloud.id` and `cloud.auth`.
They can be used in the configuration file, or from the CLI like this:

```
./metricbeat -e -E cloud.id=<cloud-id> -E cloud.auth=<cloud-auth>
```

The ES/KB settings are changed via overwritting, but we display an INFO
level message that the settings are changed by the cloud-id.

Closes elastic#4959.

* goimports fix

* aded more tests

* added basic docs

* changelog

* addressed comments

* Check that we're not enabling a second output

* remove unused var

* Addressed comments

(cherry picked from commit bd6981d)
ruflin pushed a commit that referenced this issue Aug 24, 2017
This adds two new configuration settings: `cloud.id` and `cloud.auth`.
They can be used in the configuration file, or from the CLI like this:

```
./metricbeat -e -E cloud.id=<cloud-id> -E cloud.auth=<cloud-auth>
```

The ES/KB settings are changed via overwritting, but we display an INFO
level message that the settings are changed by the cloud-id.

Closes #4959.

* goimports fix

* aded more tests

* added basic docs

* changelog

* addressed comments

* Check that we're not enabling a second output

* remove unused var

* Addressed comments

(cherry picked from commit bd6981d)
leweafan pushed a commit to leweafan/beats that referenced this issue Apr 28, 2023
…#4976)

This adds two new configuration settings: `cloud.id` and `cloud.auth`.
They can be used in the configuration file, or from the CLI like this:

```
./metricbeat -e -E cloud.id=<cloud-id> -E cloud.auth=<cloud-auth>
```

The ES/KB settings are changed via overwritting, but we display an INFO
level message that the settings are changed by the cloud-id.

Closes elastic#4959.

* goimports fix

* aded more tests

* added basic docs

* changelog

* addressed comments

* Check that we're not enabling a second output

* remove unused var

* Addressed comments

(cherry picked from commit 3d32342)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issue needs further discussion. meta needs_docs v6.0.0-beta2
Projects
None yet
Development

No branches or pull requests

2 participants