Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
olivielpeau committed Jan 10, 2018
2 parents 34cd461 + 5cccafa commit 380c822
Show file tree
Hide file tree
Showing 602 changed files with 1,905 additions and 2,048 deletions.
3 changes: 2 additions & 1 deletion .circleci/images/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ RUN gem install bundler --version "$BUNDLER_VERSION"
RUN apt-get update && apt-get install -y python-pip \
&& pip install invoke \
&& pip install docker \
&& pip install reno
&& pip install reno \
&& pip install requests

# install things globally, for great justice
# and don't create ".bundle" in all our apps
Expand Down
55 changes: 55 additions & 0 deletions Dockerfiles/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,58 @@ You'll need to download one of the `datadog-agent*_amd64.deb` package in this di
You can then build the image using `docker build -t datadog/agent:master .`

To build the jmx variant, add `--build-arg WITH_JMX=true` to the build command

## How to activate log collection

The Datadog Agent can collect logs from containers starting at the version 6. Two installations are possible:

- on the host: where the agent is external to the Docker environment
- or by deploying its containerized version in the Docker environment

### Setup

First let’s create two directories on the host that we will later mount on the containerized agent:

- `/opt/datadog-agent/run`: to make sure we do not lose any logs from containers during restarts or network issues we store on the host the last line that was collected for each container in this directory
- ` /opt/datadog-agent/conf.d`: this is where you will provide your integration instructions. Any configuration file added there will automatically be picked up by the containerized agent when restarted. For more information about this check [here](https://github.com/DataDog/docker-dd-agent#enabling-integrations).

To run a Docker container which embeds the Datadog Agent to monitor your host use the following command:

```
docker run -d --name dd-agent -h `hostname` -e DD_API_KEY=<YOUR_API_KEY> -e DD_LOG_ENABLED=true -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /opt/datadog-agent/run:/opt/datadog-agent/run:rw -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -v /opt/datadog-agent/conf.d:/conf.d:ro datadog/agent:latest
```

*Important notes*:

- The Docker integration is enabled by default, as well as [autodiscovery](https://docs.datadoghq.com/guides/servicediscovery/) in auto config mode ((remove the `listeners: -docker` section in `datadog.yaml` to disable it).

- You can find [here](https://hub.docker.com/r/datadog/agent/tags/) the list of available images for agent 6 and we encourage you to always pick the latest version.

The parameters specific to log collection are the following:

- `-e DD_LOG_ENABLED=true`: this parameter enables the log collection when set to true. The agent now looks for log instructions in configuration files.
- `-v /opt/datadog-agent/run:/opt/datadog-agent/run:rw` : mount the directory we created to store pointer on each container logs to make sure we do not lose any.
- `-v /opt/datadog-agent/conf.d:/conf.d:ro` : mount the configuration directory we previously created to the container

### Configuration file example

Now that the agent is ready to collect logs, you need to define which containers you want to follow.
To start collecting logs for a given container filtered by image or label, you need to update the log section in an integration or custom .yaml file.
Add a new yaml file in the conf.d directory with the following parameters:

```
init_config:
instances:
[{}]
#Log section
logs:
- type: docker
image: my_image_name #or label: mylabel
service: my_application_name
source: java #tells Datadog what integration it is
sourcecategory: sourcecode
```
For more examples of configuration files or agent capabilities (such as filtering, redacting, multiline, …) read [this documentation](https://docs.datadoghq.com/logs/#filter-logs).
2 changes: 1 addition & 1 deletion Dockerfiles/agent/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2017 Datadog, Inc.
# Copyright 2018 Datadog, Inc.


##### Core config #####
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/cluster-agent/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2017 Datadog, Inc.
# Copyright 2018 Datadog, Inc.


##### Core config #####
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/dogstatsd/alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2017 Datadog, Inc.
# Copyright 2018 Datadog, Inc.

##### Core config #####

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017 Datadog, Inc.
Copyright 2018 Datadog, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Datadog datadog-agent
Copyright 2017 Datadog, Inc.
Copyright 2018 Datadog, Inc.

This product includes software developed at Datadog (https://www.datadoghq.com/).
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
[![Build status](https://ci.appveyor.com/api/projects/status/kcwhmlsc0oq3m49p/branch/master?svg=true)](https://ci.appveyor.com/project/Datadog/datadog-agent/branch/master)
[![GoDoc](https://godoc.org/github.com/DataDog/datadog-agent?status.svg)](https://godoc.org/github.com/DataDog/datadog-agent)

The Datadog Agent faithfully collects events and metrics and brings them to
[Datadog](https://app.datadoghq.com) on your behalf so that you can do something
useful with your monitoring and performance data.

The present repository contains the source code of the Datadog Agent version 6,
currently in Beta. The source code of the stable Datadog Agent 5 is located in the
**currently in beta**. Please refer to the [beta docs](docs/beta.md) for more
informations about the status of the project, the limitations and how to install
the latest version of the Agent.

**Note:** the source code of the **stable** Datadog Agent 5 is located in the
[dd-agent](https://github.com/DataDog/dd-agent) repository.

## Getting started
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/agent.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BEGIN
VALUE "FileDescription", "Datadog Metrics Agent"
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", "Agent6"
VALUE "LegalCopyright", "Copyright (C) 2017"
VALUE "LegalCopyright", "Copyright (C) 2018"
VALUE "OriginalFilename", "agent.exe"
VALUE "ProductName", "Datadog Agent"
VALUE "ProductVersion", FILE_VERSION_STRING
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/agent/agent.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

// Package agent implements the api endpoints for the `/agent` prefix.
// This group of endpoints is meant to provide high-level functionalities
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/agent/agent_jmx.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

// Package agent implements the api endpoints for the `/agent` prefix.
// This group of endpoints is meant to provide high-level functionalities
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/agent/agent_nojmx.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

// Package agent implements the api endpoints for the `/agent` prefix.
// This group of endpoints is meant to provide high-level functionalities
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/check/check.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

// Package check implements the api endpoints for the `/check` prefix.
// This group of endpoints is meant to provide specific functionalities
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/listener.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package api

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/api/server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

/*
Package api implements the agent IPC api. Using HTTP
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/app.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

/*
Package app implements the Agent main loop, orchestrating
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/check.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/control_service_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/dependent_services.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/dependent_services_nix.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.
// +build !windows

package app
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/dependent_services_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.
// +build windows

package app
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/diagnose.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/flare.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/hostname.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/import.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/install_service_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/launchgui.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/listchecks.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/regimport_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/reloadcheck.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/remove_service_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
17 changes: 16 additions & 1 deletion cmd/agent/app/start.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand All @@ -25,6 +25,7 @@ import (
"github.com/DataDog/datadog-agent/pkg/config"
"github.com/DataDog/datadog-agent/pkg/dogstatsd"
"github.com/DataDog/datadog-agent/pkg/forwarder"
"github.com/DataDog/datadog-agent/pkg/logs"
"github.com/DataDog/datadog-agent/pkg/metadata"
"github.com/DataDog/datadog-agent/pkg/pidfile"
"github.com/DataDog/datadog-agent/pkg/serializer"
Expand Down Expand Up @@ -203,6 +204,20 @@ func StartAgent() error {
}
log.Debugf("statsd started")

// start logs-agent
if config.Datadog.GetBool("log_enabled") {
// logs-agent does not provide any Stop method yet
// data loss may happen when stopping the agent
err := logs.Start()
if err != nil {
log.Error("Could not start logs-agent: ", err)
} else {
log.Info("Starting logs-agent")
}
} else {
log.Info("logs-agent disabled")
}

// create and setup the Autoconfig instance
common.SetupAutoConfig(config.Datadog.GetString("confd_path"))
// start the autoconfig, this will immediately run any configured check
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/status.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

package app

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/stop.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2017 Datadog, Inc.
// Copyright 2018 Datadog, Inc.

// +build !windows

Expand Down
Loading

0 comments on commit 380c822

Please sign in to comment.