Skip to content

Commit d637ccd

Browse files
authored
Merge pull request #14 from axoflow/feat/host-attribution
feat: add deviceid for host attribution
2 parents d5965e2 + bdeaaff commit d637ccd

File tree

8 files changed

+157
-63
lines changed

8 files changed

+157
-63
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ You can find guides per connector:
2828
| `AXOROUTER_TLS_MAX_VERSION` | No | - | Maximum TLS version to use |
2929
| `AXOROUTER_TLS_INCLUDE_SYSTEM_CA_CERTS_POOL` | No | `false` | Whether to include system CA certificates |
3030
| `AXOROUTER_TLS_INSECURE_SKIP_VERIFY` | No | `false` | Whether to skip TLS certificate verification |
31+
| `AXOCLOUDCONNECTOR_DEVICE_ID` | Yes | - | A service id that will be used to identify the cloud connector in Axoflow |
3132

3233
### Azure Provider
3334

3435
| Variable | Required | Default | Description |
3536
|----------|----------|---------|-------------|
36-
| `AZURE_EVENT_HUBS_CONNECTION_STRING` | Yes | - | Azure Event Hub connection string |
37+
| `AZURE_EVENT_HUBS_CONNECTION_STRING` | Yes | - | Azure Event Hubs connection string |
3738

3839
### AWS Provider
3940

connectors/aws/README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,50 @@ There are many ways you can authenticate and use the CloudWatch service:
1111
### Using AWS Profile with a config file
1212

1313
```bash
14+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
15+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
16+
1417
docker run --rm \
18+
-v "${STORAGE_DIRECTORY}":"${STORAGE_DIRECTORY}" \
1519
-e AWS_PROFILE="${AWS_PROFILE}" \
1620
-e AWS_REGION="${AWS_REGION}" \
1721
-e AWS_SDK_LOAD_CONFIG=1 \
1822
-e AXOROUTER_ENDPOINT="${AXOROUTER_ENDPOINT}" \
1923
-e STORAGE_DIRECTORY="${STORAGE_DIRECTORY}" \
24+
-e AXOCLOUDCONNECTOR_DEVICE_ID="${AXOCLOUDCONNECTOR_DEVICE_ID}" \
2025
-v "${HOME}/.aws:/cloudconnectors/.aws:ro" \
2126
ghcr.io/axoflow/axocloudconnectors:latest
2227
```
2328

2429
### Direct AWS credentials
2530

2631
```bash
32+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
33+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
34+
2735
docker run --rm \
36+
-v "${STORAGE_DIRECTORY}":"${STORAGE_DIRECTORY}" \
2837
-e AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
2938
-e AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
3039
-e AWS_REGION="${AWS_REGION}" \
3140
-e AXOROUTER_ENDPOINT="${AXOROUTER_ENDPOINT}" \
3241
-e STORAGE_DIRECTORY="${STORAGE_DIRECTORY}" \
42+
-e AXOCLOUDCONNECTOR_DEVICE_ID="${AXOCLOUDCONNECTOR_DEVICE_ID}" \
3343
ghcr.io/axoflow/axocloudconnectors:latest
3444
```
3545

3646
### Using EC2 instance profile
3747

3848
```bash
49+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
50+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
51+
3952
docker run --rm \
53+
-v "${STORAGE_DIRECTORY}":"${STORAGE_DIRECTORY}" \
4054
-e AWS_REGION="${AWS_REGION}" \
4155
-e AXOROUTER_ENDPOINT="${AXOROUTER_ENDPOINT}" \
4256
-e STORAGE_DIRECTORY="${STORAGE_DIRECTORY}" \
57+
-e AXOCLOUDCONNECTOR_DEVICE_ID="${AXOCLOUDCONNECTOR_DEVICE_ID}" \
4358
ghcr.io/axoflow/axocloudconnectors:latest
4459
```
4560

@@ -75,17 +90,22 @@ kubectl create secret generic aws-credentials \
7590
--namespace cloudconnectors \
7691
--dry-run=client -o yaml | kubectl apply -f -
7792

93+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
94+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
95+
7896
helm upgrade --install --wait --namespace cloudconnectors cloudconnectors ./charts/cloudconnectors \
7997
--set image.repository="axocloudconnectors" \
8098
--set image.tag="dev" \
8199
--set 'env[0].name=AXOROUTER_ENDPOINT' \
82100
--set 'env[0].value=axorouter.axoflow-local.svc.cluster.local:4317' \
83-
--set 'env[1].name=AWS_REGION' \
84-
--set 'env[1].value=<YOUR-AWS-REGION>' \
85-
--set 'env[2].name=AWS_ACCESS_KEY_ID' \
86-
--set 'env[2].valueFrom.secretKeyRef.name=aws-credentials' \
87-
--set 'env[2].valueFrom.secretKeyRef.key=access-key-id' \
88-
--set 'env[3].name=AWS_SECRET_ACCESS_KEY' \
101+
--set 'env[1].name=AXOCLOUDCONNECTOR_DEVICE_ID' \
102+
--set "env[1].value=${AXOCLOUDCONNECTOR_DEVICE_ID}" \
103+
--set 'env[2].name=AWS_REGION' \
104+
--set 'env[2].value=<YOUR-AWS-REGION>' \
105+
--set 'env[3].name=AWS_ACCESS_KEY_ID' \
89106
--set 'env[3].valueFrom.secretKeyRef.name=aws-credentials' \
90-
--set 'env[3].valueFrom.secretKeyRef.key=secret-access-key'
107+
--set 'env[3].valueFrom.secretKeyRef.key=access-key-id' \
108+
--set 'env[4].name=AWS_SECRET_ACCESS_KEY' \
109+
--set 'env[4].valueFrom.secretKeyRef.name=aws-credentials' \
110+
--set 'env[4].valueFrom.secretKeyRef.key=secret-access-key'
91111
```

connectors/aws/config.yaml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,70 @@
1-
receivers:
1+
exporters:
2+
otlp/axorouter:
3+
endpoint: ${env:AXOROUTER_ENDPOINT}
4+
retry_on_failure:
5+
enabled: true
6+
max_elapsed_time: 0
7+
sending_queue:
8+
enabled: true
9+
storage: file_storage
10+
tls:
11+
insecure: ${env:AXOROUTER_TLS_INSECURE:-false}
12+
ca_file: ${env:AXOROUTER_TLS_CA_FILE}
13+
ca_pem: ${env:AXOROUTER_TLS_CA_PEM}
14+
cert_file: ${env:AXOROUTER_TLS_CERT_FILE}
15+
cert_pem: ${env:AXOROUTER_TLS_CERT_PEM}
16+
key_file: ${env:AXOROUTER_TLS_KEY_FILE}
17+
key_pem: ${env:AXOROUTER_TLS_KEY_PEM}
18+
min_version: ${env:AXOROUTER_TLS_MIN_VERSION:-1.2}
19+
max_version: ${env:AXOROUTER_TLS_MAX_VERSION}
20+
include_system_ca_certs_pool: ${env:AXOROUTER_TLS_INCLUDE_SYSTEM_CA_CERTS_POOL:-false}
21+
insecure_skip_verify: ${env:AXOROUTER_TLS_INSECURE_SKIP_VERIFY:-false}
22+
23+
processors:
24+
resource/axoflow_device_id:
25+
attributes:
26+
- key: "com.axoflow.device_id"
27+
action: insert
28+
value: "${env:AXOCLOUDCONNECTOR_DEVICE_ID}"
29+
30+
resourcedetection/system:
31+
detectors: ["system", "env"]
32+
system:
33+
hostname_sources: ["dns", "os", "cname", "lookup"]
34+
resource_attributes:
35+
host.name:
36+
enabled: true
37+
host.ip:
38+
enabled: true
39+
host.id:
40+
enabled: true
41+
42+
resource/axoflow: # Provider specific!
43+
attributes:
44+
- key: "com.axoflow.product"
45+
action: insert
46+
value: "aws-cloudwatch"
47+
48+
receivers: # Provider specific!
249
awscloudwatch:
350
region: ${env:AWS_REGION}
451
profile: ${env:AWS_PROFILE}
552
logs:
653
poll_interval: 10s
754
storage: file_storage
855

9-
processors:
10-
resource/axoflow:
11-
attributes:
12-
- key: "com.axoflow.product"
13-
action: insert
14-
value: "aws-cloudwatch"
56+
57+
extensions:
58+
health_check:
59+
endpoint: ${env:POD_IP}:13133
60+
file_storage:
61+
directory: ${env:STORAGE_DIRECTORY}
62+
create_directory: true
1563

1664
service:
65+
extensions: [health_check, file_storage]
1766
pipelines:
1867
logs:
1968
receivers: [awscloudwatch]
20-
processors: [resource/axoflow]
69+
processors: [resource/axoflow_device_id, resourcedetection/system, resource/axoflow]
70+
exporters: [otlp/axorouter]

connectors/azure/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ This directory contains the Axoflow Azure Event Hubs connector which helps colle
77
Make sure the required environment variables are set before running the connector.
88

99
```bash
10+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
11+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
12+
1013
docker run \
1114
--rm \
1215
-v "${STORAGE_DIRECTORY}":"${STORAGE_DIRECTORY}" \
1316
-e AZURE_EVENT_HUBS_CONNECTION_STRING="${AZURE_EVENT_HUBS_CONNECTION_STRING}" \
1417
-e AXOROUTER_ENDPOINT="${AXOROUTER_ENDPOINT}" \
1518
-e STORAGE_DIRECTORY="${STORAGE_DIRECTORY}" \
19+
-e AXOCLOUDCONNECTOR_DEVICE_ID="${AXOCLOUDCONNECTOR_DEVICE_ID}" \
1620
ghcr.io/axoflow/axocloudconnectors:latest
1721
```
1822

@@ -33,12 +37,17 @@ kubectl create secret generic azure-event-hubs \
3337
--namespace cloudconnectors \
3438
--dry-run=client -o yaml | kubectl apply -f -
3539

40+
UUID_FULL=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
41+
AXOCLOUDCONNECTOR_DEVICE_ID=$(echo "$UUID_FULL" | cut -d'-' -f1)
42+
3643
helm upgrade --install --wait --namespace cloudconnectors cloudconnectors ./charts/cloudconnectors \
3744
--set image.repository="axocloudconnectors" \
3845
--set image.tag="dev" \
3946
--set 'env[0].name=AXOROUTER_ENDPOINT' \
4047
--set 'env[0].value=axorouter.axoflow-local.svc.cluster.local:4317' \
41-
--set 'env[1].name=AZURE_EVENT_HUBS_CONNECTION_STRING' \
42-
--set 'env[1].valueFrom.secretKeyRef.name=azure-event-hubs' \
43-
--set 'env[1].valueFrom.secretKeyRef.key=connection-string'
48+
--set 'env[1].name=AXOCLOUDCONNECTOR_DEVICE_ID' \
49+
--set "env[1].value=${AXOCLOUDCONNECTOR_DEVICE_ID}" \
50+
--set 'env[2].name=AZURE_EVENT_HUBS_CONNECTION_STRING' \
51+
--set 'env[2].valueFrom.secretKeyRef.name=azure-event-hubs' \
52+
--set 'env[2].valueFrom.secretKeyRef.key=connection-string'
4453
```

connectors/azure/config.yaml

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,68 @@
1-
receivers:
2-
azureeventhub:
3-
connection: ${env:AZURE_EVENT_HUBS_CONNECTION_STRING}
4-
format: azure
5-
apply_semantic_conventions: true
6-
storage: file_storage
1+
exporters:
2+
otlp/axorouter:
3+
endpoint: ${env:AXOROUTER_ENDPOINT}
4+
retry_on_failure:
5+
enabled: true
6+
max_elapsed_time: 0
7+
sending_queue:
8+
enabled: true
9+
storage: file_storage
10+
tls:
11+
insecure: ${env:AXOROUTER_TLS_INSECURE:-false}
12+
ca_file: ${env:AXOROUTER_TLS_CA_FILE}
13+
ca_pem: ${env:AXOROUTER_TLS_CA_PEM}
14+
cert_file: ${env:AXOROUTER_TLS_CERT_FILE}
15+
cert_pem: ${env:AXOROUTER_TLS_CERT_PEM}
16+
key_file: ${env:AXOROUTER_TLS_KEY_FILE}
17+
key_pem: ${env:AXOROUTER_TLS_KEY_PEM}
18+
min_version: ${env:AXOROUTER_TLS_MIN_VERSION:-1.2}
19+
max_version: ${env:AXOROUTER_TLS_MAX_VERSION}
20+
include_system_ca_certs_pool: ${env:AXOROUTER_TLS_INCLUDE_SYSTEM_CA_CERTS_POOL:-false}
21+
insecure_skip_verify: ${env:AXOROUTER_TLS_INSECURE_SKIP_VERIFY:-false}
722

823
processors:
9-
resource/axoflow:
24+
resource/axoflow_device_id:
25+
attributes:
26+
- key: "com.axoflow.device_id"
27+
action: insert
28+
value: "${env:AXOCLOUDCONNECTOR_DEVICE_ID}"
29+
30+
resourcedetection/system:
31+
detectors: ["system", "env"]
32+
system:
33+
hostname_sources: ["dns", "os", "cname", "lookup"]
34+
resource_attributes:
35+
host.name:
36+
enabled: true
37+
host.ip:
38+
enabled: true
39+
host.id:
40+
enabled: true
41+
42+
resource/axoflow: # Provider specific!
1043
attributes:
1144
- key: "com.axoflow.product"
1245
action: insert
1346
value: "azure-event-hubs"
1447

48+
receivers: # Provider specific!
49+
azureeventhub:
50+
connection: ${env:AZURE_EVENT_HUBS_CONNECTION_STRING}
51+
format: azure
52+
apply_semantic_conventions: true
53+
storage: file_storage
54+
55+
extensions:
56+
health_check:
57+
endpoint: ${env:POD_IP}:13133
58+
file_storage:
59+
directory: ${env:STORAGE_DIRECTORY}
60+
create_directory: true
61+
1562
service:
63+
extensions: [health_check, file_storage]
1664
pipelines:
1765
logs:
1866
receivers: [azureeventhub]
19-
processors: [resource/axoflow]
67+
processors: [resource/axoflow_device_id, resourcedetection/system, resource/axoflow]
68+
exporters: [otlp/axorouter]

connectors/common-config.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ detect_provider() {
2323

2424
if PROVIDER=$(detect_provider); then
2525
echo "Detected ${PROVIDER} configuration"
26-
exec ./axoflow-otel-collector --config "/etc/axoflow-otel-collector/connectors/common-config.yaml" --config "/etc/axoflow-otel-collector/connectors/${PROVIDER}/config.yaml"
26+
exec ./axoflow-otel-collector --config "/etc/axoflow-otel-collector/connectors/${PROVIDER}/config.yaml"
2727
fi
2828

2929
echo "No cloud provider configuration detected. Please set environment variables for one of:"

makefile.d/20-tools.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ bin/actionlint-$(ACTIONLINT_VERSION): | $(BIN_DIR)
1313
| bash -s -- "$(ACTIONLINT_VERSION)" "$(BIN_DIR)"
1414
@mv bin/actionlint $@
1515

16-
1716
####
1817
## MiniKube
1918
####

0 commit comments

Comments
 (0)