|
| 1 | +--- |
| 2 | +title: Send logs to CloudPrem with the Datadog Agent |
| 3 | +description: Configure the Datadog Agent to send logs to your CloudPrem deployment |
| 4 | +private: true |
| 5 | +disable_toc: false |
| 6 | +further_reading: |
| 7 | +- link: "/cloudprem/ingest-logs/" |
| 8 | + tag: "Documentation" |
| 9 | + text: "Log Ingestion Overview" |
| 10 | +- link: "/cloudprem/ingest-logs/observability-pipelines/" |
| 11 | + tag: "Documentation" |
| 12 | + text: "Observability Pipelines Integration" |
| 13 | +- link: "/cloudprem/ingest-logs/rest-api/" |
| 14 | + tag: "Documentation" |
| 15 | + text: "REST API Integration" |
| 16 | +- link: "/getting_started/containers/datadog_operator/" |
| 17 | + tag: "Documentation" |
| 18 | + text: "Datadog Operator Guide" |
| 19 | +--- |
| 20 | + |
| 21 | +## Overview |
| 22 | + |
| 23 | +To send logs with the Datadog agent to CloudPrem, you need to set the two following environment variables: |
| 24 | +- `DD_LOGS_CONFIG_LOGS_DD_URL` to CloudPrem endpoint, usually `http://<RELEASE_NAME>-indexer.<NAMESPACE_NAME>.svc.cluster.local:7280`. |
| 25 | +- Optionally, `DD_LOGS_CONFIG_EXPECTED_TAGS_DURATION` to `100000` (~5 years). This ensure the Agent adds host-level tags that it knows about to each sent log. When sending logs to Datadog SaaS, those tags can be automatically added after ingestion. When sending logs to CloudPrem, we need to ensure those tags are added to each logs as CLoudPrem does not enrich those logs as the SaaS does. |
| 26 | + |
| 27 | +## Send Kubernetes logs to CloudPrem with the Datadog Agent deployed with the Datadog Operator |
| 28 | + |
| 29 | +Follow the [Getting Started with Datadog Operator][5] guide for installation and deployment. When you reach Step 3, use the following `datadog-agent.yaml` configuration instead of the example provided in the guide. |
| 30 | + |
| 31 | +```yaml |
| 32 | +apiVersion: datadoghq.com/v2alpha1 |
| 33 | +kind: DatadogAgent |
| 34 | +metadata: |
| 35 | + name: datadog |
| 36 | +spec: |
| 37 | + global: |
| 38 | + clusterName: <CLUSTER_NAME> |
| 39 | + site: datadoghq.com |
| 40 | + credentials: |
| 41 | + apiSecret: |
| 42 | + secretName: datadog-secret |
| 43 | + keyName: api-key |
| 44 | + env: |
| 45 | + - name: DD_LOGS_CONFIG_LOGS_DD_URL |
| 46 | + value: http://<RELEASE_NAME>-indexer.<NAMESPACE_NAME>.svc.cluster.local:7280 |
| 47 | + - name: DD_LOGS_CONFIG_EXPECTED_TAGS_DURATION |
| 48 | + value: "100000" |
| 49 | + |
| 50 | + features: |
| 51 | + logCollection: |
| 52 | + enabled: true |
| 53 | + containerCollectAll: true |
| 54 | + |
| 55 | + otlp: |
| 56 | + receiver: |
| 57 | + protocols: |
| 58 | + grpc: |
| 59 | + enabled: true |
| 60 | + endpoint: 0.0.0.0:4417 |
| 61 | + |
| 62 | + prometheusScrape: |
| 63 | + enabled: true |
| 64 | + enableServiceEndpoints: true |
| 65 | + |
| 66 | +``` |
| 67 | + |
| 68 | +## Configuration options |
| 69 | + |
| 70 | +### Endpoint configuration |
| 71 | + |
| 72 | +The Datadog Agent can be configured to send logs to CloudPrem using different endpoints: |
| 73 | + |
| 74 | +**Internal cluster endpoint** (recommended for in-cluster agents): |
| 75 | +``` |
| 76 | +DD_LOGS_CONFIG_LOGS_DD_URL=http://<RELEASE_NAME>-indexer.<NAMESPACE_NAME>.svc.cluster.local:7280 |
| 77 | +``` |
| 78 | + |
| 79 | +**Internal ingress endpoint** (for agents outside the cluster): |
| 80 | +``` |
| 81 | +DD_LOGS_CONFIG_LOGS_DD_URL=https://cloudprem-internal.your-domain.com |
| 82 | +``` |
| 83 | + |
| 84 | +### Additional Agent configuration |
| 85 | + |
| 86 | +You can also configure additional features to send cluster metadata to Datadog: |
| 87 | + |
| 88 | +**Prometheus metrics scraping**: |
| 89 | +```yaml |
| 90 | +features: |
| 91 | + prometheusScrape: |
| 92 | + enabled: true |
| 93 | + enableServiceEndpoints: true |
| 94 | +``` |
| 95 | +
|
| 96 | +**OTLP logs collection** (to send Agent logs to Datadog): |
| 97 | +```yaml |
| 98 | +features: |
| 99 | + otlp: |
| 100 | + receiver: |
| 101 | + protocols: |
| 102 | + grpc: |
| 103 | + enabled: true |
| 104 | + endpoint: 0.0.0.0:4417 |
| 105 | +``` |
| 106 | +
|
| 107 | +## Alternative deployment methods |
| 108 | +
|
| 109 | +### Helm chart deployment |
| 110 | +
|
| 111 | +If you're not using the Datadog Operator, you can deploy the Agent using Helm: |
| 112 | +
|
| 113 | +```bash |
| 114 | +helm install datadog-agent datadog/datadog \ |
| 115 | + --set datadog.apiKey=<YOUR_API_KEY> \ |
| 116 | + --set datadog.logs.enabled=true \ |
| 117 | + --set datadog.logs.containerCollectAll=true \ |
| 118 | + --set datadog.logsConfigContainerCollectAll=true \ |
| 119 | + --set agents.containers.agent.env[0].name=DD_LOGS_CONFIG_LOGS_DD_URL \ |
| 120 | + --set agents.containers.agent.env[0].value=http://<RELEASE_NAME>-indexer.<NAMESPACE_NAME>.svc.cluster.local:7280 |
| 121 | +``` |
| 122 | + |
| 123 | +### DaemonSet deployment |
| 124 | + |
| 125 | +For custom deployments, set the environment variable in your DaemonSet: |
| 126 | + |
| 127 | +```yaml |
| 128 | +apiVersion: apps/v1 |
| 129 | +kind: DaemonSet |
| 130 | +metadata: |
| 131 | + name: datadog-agent |
| 132 | +spec: |
| 133 | + template: |
| 134 | + spec: |
| 135 | + containers: |
| 136 | + - name: agent |
| 137 | + image: gcr.io/datadoghq/agent:latest |
| 138 | + env: |
| 139 | + - name: DD_API_KEY |
| 140 | + value: <YOUR_API_KEY> |
| 141 | + - name: DD_LOGS_ENABLED |
| 142 | + value: "true" |
| 143 | + - name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL |
| 144 | + value: "true" |
| 145 | + - name: DD_LOGS_CONFIG_LOGS_DD_URL |
| 146 | + value: "http://<RELEASE_NAME>-indexer.<NAMESPACE_NAME>.svc.cluster.local:7280" |
| 147 | +``` |
| 148 | +
|
| 149 | +## Verification |
| 150 | +
|
| 151 | +### Check Agent status |
| 152 | +
|
| 153 | +Verify that the Agent is sending logs to CloudPrem: |
| 154 | +
|
| 155 | +```bash |
| 156 | +# Check Agent status and logs configuration |
| 157 | +kubectl exec -it <datadog-agent-pod> -- agent status | grep -A 10 "Logs Agent" |
| 158 | + |
| 159 | +# Check Agent logs for CloudPrem connection |
| 160 | +kubectl logs <datadog-agent-pod> | grep -i cloudprem |
| 161 | +``` |
| 162 | + |
| 163 | +### Check logs are indexed in CloudPrem |
| 164 | + |
| 165 | +This command should return indexed JSON logs: |
| 166 | + |
| 167 | +```bash |
| 168 | +kubectl exec -it <RELEASE_NAME>-searcher-0 -n <NAMESPACE_NAME> -- curl 'http://localhost:7280/api/v1/datadog/search?query=' |
| 169 | +``` |
| 170 | + |
| 171 | +## Troubleshooting |
| 172 | + |
| 173 | +**Agent not sending logs**: |
| 174 | +- Verify the `DD_LOGS_CONFIG_LOGS_DD_URL` environment variable is set correctly |
| 175 | +- Check Agent pod logs: `kubectl logs <datadog-agent-pod>` |
| 176 | +- Ensure log collection is enabled: `DD_LOGS_ENABLED=true` |
| 177 | + |
| 178 | +**CloudPrem not receiving logs**: |
| 179 | +- Check CloudPrem indexer logs: `kubectl logs -n <NAMESPACE_NAME> -l app=<RELEASE_NAME>-indexer` |
| 180 | +- Verify network connectivity between Agent and CloudPrem indexer |
| 181 | +- Confirm CloudPrem service is running: `kubectl get pods -n <NAMESPACE_NAME>` |
| 182 | + |
| 183 | +## Further reading |
| 184 | + |
| 185 | +{{< partial name="whats-next/whats-next.html" >}} |
| 186 | + |
0 commit comments