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

Add support for etcd logs #7431

Merged
merged 6 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions etcd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,60 @@ The Etcd check is included in the [Datadog Agent][2] package, so you don't need

To configure this check for an Agent running on a host:

##### Metric collection

1. Edit the `etcd.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent's configuration directory][3] to start collecting your Etcd performance data. See the [sample etcd.d/conf.yaml][4] for all available configuration options.
2. [Restart the Agent][5]

##### Log collection

_Available for Agent versions >6.0_
nicholas-devlin marked this conversation as resolved.
Show resolved Hide resolved

1. Collecting logs is disabled by default in the Datadog Agent, enable it in your `datadog.yaml` file:

```yaml
logs_enabled: true
```

2. Add this configuration block to your `etcd.d/conf.yaml` file to start collecting your etcd logs:
nicholas-devlin marked this conversation as resolved.
Show resolved Hide resolved

```yaml
logs:
- type: file
path: "<LOG_FILE_PATH>"
source: etcd
service: "<SERVICE_NAME>"
```

Change the `path` and `service` parameter values based on your environment. See the [sample etcd.d/conf.yaml][4] for all available configuration options.

3. [Restart the Agent][5].

<!-- xxz tab xxx -->
<!-- xxx tab "Containerized" xxx -->

#### Containerized

For containerized environments, see the [Autodiscovery Integration Templates][6] for guidance on applying the parameters below.

##### Metric collection

| Parameter | Value |
| -------------------- | ---------------------------------------------------- |
| `<INTEGRATION_NAME>` | `etcd` |
| `<INIT_CONFIG>` | blank or `{}` |
| `<INSTANCE_CONFIG>` | `{"prometheus_url": "http://%%host%%:2379/metrics"}` |

##### Log collection

_Available for Agent versions >6.0_
nicholas-devlin marked this conversation as resolved.
Show resolved Hide resolved

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Kubernetes log collection][11].

| Parameter | Value |
| -------------- | ------------------------------------------------- |
| `<LOG_CONFIG>` | `{"source": "etcd", "service": "<SERVICE_NAME>"}` |

<!-- xxz tab xxx -->
<!-- xxz tabs xxx -->

Expand Down Expand Up @@ -88,3 +126,4 @@ To get a better idea of how (or why) to integrate Etcd with Datadog, check out o
[8]: https://github.com/DataDog/integrations-core/blob/master/etcd/metadata.csv
[9]: https://docs.datadoghq.com/help/
[10]: https://www.datadoghq.com/blog/monitor-etcd-performance
[11]: https://docs.datadoghq.com/agent/kubernetes/log/
19 changes: 19 additions & 0 deletions etcd/datadog_checks/etcd/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,22 @@ instances:
## Whether or not to persist cookies and use connection pooling for increased performance.
#
# persist_connections: false

## Log Section
##
## type - required - Type of log input source (tcp / udp / file / windows_event)
## port / path / channel_path - required - Set port if type is tcp or udp.
## Set path if type is file.
## Set channel_path if type is windows_event.
## source - required - Attribute that defines which Integration sent the logs
## service - required - The name of the service that generates the log.
## Overrides any `service` defined in the `init_config` section.
## tags - optional - Add tags to the collected logs
##
## Discover Datadog log collection: https://docs.datadoghq.com/logs/log_collection/
#
# logs:
# - type: file
# path: <LOG_FILE_PATH>
# source: etcd
# service: <SERVICE_NAME>
4 changes: 2 additions & 2 deletions etcd/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"orchestration",
"containers",
"configuration & deployment",
"orchestration",
"autodiscovery"
"autodiscovery",
"log collection"
],
"creates_events": false,
"display_name": "etcd",
Expand Down
5 changes: 4 additions & 1 deletion etcd/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

from .common import COMPOSE_FILE, LEGACY_INSTANCE, URL, V3_PREVIEW

# Needed to mount volume for logging
E2E_METADATA = {'docker_volumes': ['/var/run/docker.sock:/var/run/docker.sock:ro']}


def add_key():
if not V3_PREVIEW:
Expand All @@ -27,7 +30,7 @@ def dd_environment(instance):

# Sleep a bit so all metrics are available
with docker_run(COMPOSE_FILE, conditions=[CheckEndpoints(endpoints), add_key], sleep=3):
yield instance
yield instance, E2E_METADATA


@pytest.fixture(scope='session')
Expand Down