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

Network interface configuration #3421

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Use `SPLUNK_LISTEN_INTERFACE` and associated installer option to configure the network interface used by the collector for default configurations ([#3421](https://github.com/signalfx/splunk-otel-collector/pull/3421))

### 🛑 Breaking changes 🛑

Expand Down
30 changes: 17 additions & 13 deletions cmd/otelcol/config/collector/agent_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
# - SPLUNK_HEC_TOKEN: The Splunk HEC authentication token
# - SPLUNK_HEC_URL: The Splunk HEC endpoint URL, e.g. https://ingest.us0.signalfx.com/v1/log
# - SPLUNK_INGEST_URL: The Splunk ingest URL, e.g. https://ingest.us0.signalfx.com
# - SPLUNK_LISTEN_INTERFACE: The network interface the agent receivers listen on.
# - SPLUNK_TRACE_URL: The Splunk trace endpoint URL, e.g. https://ingest.us0.signalfx.com/v2/trace

extensions:
health_check:
endpoint: 0.0.0.0:13133
endpoint: "${SPLUNK_LISTEN_INTERFACE}:13133"
http_forwarder:
ingress:
endpoint: 0.0.0.0:6060
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6060"
egress:
endpoint: "${SPLUNK_API_URL}"
# Use instead when sending to gateway
Expand All @@ -26,7 +27,7 @@ extensions:
collectd:
configDir: "${SPLUNK_COLLECTD_DIR}"
zpages:
#endpoint: 0.0.0.0:55679
#endpoint: "${SPLUNK_LISTEN_INTERFACE}:55679"
memory_ballast:
# In general, the ballast should be set to 1/3 of the collector's memory, the limit
# should be 90% of the collector's memory.
Expand Down Expand Up @@ -55,19 +56,19 @@ receivers:
jaeger:
protocols:
grpc:
endpoint: 0.0.0.0:14250
endpoint: "${SPLUNK_LISTEN_INTERFACE}:14250"
thrift_binary:
endpoint: 0.0.0.0:6832
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6832"
thrift_compact:
endpoint: 0.0.0.0:6831
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6831"
thrift_http:
endpoint: 0.0.0.0:14268
endpoint: "${SPLUNK_LISTEN_INTERFACE}:14268"
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
endpoint: "${SPLUNK_LISTEN_INTERFACE}:4317"
http:
endpoint: 0.0.0.0:4318
endpoint: "${SPLUNK_LISTEN_INTERFACE}:4318"
# This section is used to collect the OpenTelemetry Collector metrics
# Even if just a Splunk APM customer, these metrics are included
prometheus/internal:
Expand All @@ -76,23 +77,23 @@ receivers:
- job_name: 'otel-collector'
scrape_interval: 10s
static_configs:
- targets: ['0.0.0.0:8888']
- targets: ["${SPLUNK_LISTEN_INTERFACE}:8888"]
rmfitzpatrick marked this conversation as resolved.
Show resolved Hide resolved
metric_relabel_configs:
- source_labels: [ __name__ ]
regex: '.*grpc_io.*'
action: drop
smartagent/signalfx-forwarder:
type: signalfx-forwarder
listenAddress: 0.0.0.0:9080
listenAddress: "${SPLUNK_LISTEN_INTERFACE}:9080"
smartagent/processlist:
type: processlist
signalfx:
endpoint: 0.0.0.0:9943
endpoint: "${SPLUNK_LISTEN_INTERFACE}:9943"
# Whether to preserve incoming access token and use instead of exporter token
# default = false
#access_token_passthrough: true
zipkin:
endpoint: 0.0.0.0:9411
endpoint: "${SPLUNK_LISTEN_INTERFACE}:9411"

processors:
batch:
Expand Down Expand Up @@ -160,6 +161,9 @@ exporters:
verbosity: detailed

service:
telemetry:
metrics:
address: "${SPLUNK_LISTEN_INTERFACE}:8888"
extensions: [health_check, http_forwarder, zpages, memory_ballast, smartagent]
pipelines:
traces:
Expand Down
27 changes: 15 additions & 12 deletions cmd/otelcol/config/collector/gateway_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

extensions:
health_check:
endpoint: 0.0.0.0:13133
endpoint: "${SPLUNK_LISTEN_INTERFACE}:13133"
http_forwarder:
ingress:
endpoint: 0.0.0.0:6060
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6060"
egress:
endpoint: "https://api.${SPLUNK_REALM}.signalfx.com"
zpages:
endpoint: 0.0.0.0:55679
endpoint: "${SPLUNK_LISTEN_INTERFACE}:55679"
memory_ballast:
# In general, the ballast should be set to 1/3 of the collector's memory, the limit
# should be 90% of the collector's memory.
Expand All @@ -21,19 +21,19 @@ receivers:
jaeger:
protocols:
grpc:
endpoint: 0.0.0.0:14250
endpoint: "${SPLUNK_LISTEN_INTERFACE}:14250"
thrift_binary:
endpoint: 0.0.0.0:6832
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6832"
thrift_compact:
endpoint: 0.0.0.0:6831
endpoint: "${SPLUNK_LISTEN_INTERFACE}:6831"
thrift_http:
endpoint: 0.0.0.0:14268
endpoint: "${SPLUNK_LISTEN_INTERFACE}:14268"
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
endpoint: "${SPLUNK_LISTEN_INTERFACE}:4317"
http:
endpoint: 0.0.0.0:4318
endpoint: "${SPLUNK_LISTEN_INTERFACE}:4318"
# This section is used to collect the OpenTelemetry Collector metrics
# Even if just a Splunk APM customer, these metrics are included
prometheus/internal:
Expand All @@ -48,17 +48,17 @@ receivers:
regex: '.*grpc_io.*'
action: drop
sapm:
endpoint: 0.0.0.0:7276
endpoint: "${SPLUNK_LISTEN_INTERFACE}:7276"
# Whether to preserve incoming access token and use instead of exporter token
# default = false
#access_token_passthrough: true
signalfx:
endpoint: 0.0.0.0:9943
endpoint: "${SPLUNK_LISTEN_INTERFACE}:9943"
# Whether to preserve incoming access token and use instead of exporter token
# default = false
#access_token_passthrough: true
zipkin:
endpoint: 0.0.0.0:9411
endpoint: "${SPLUNK_LISTEN_INTERFACE}:9411"

processors:
batch:
Expand Down Expand Up @@ -121,6 +121,9 @@ exporters:
log_data_enabled: false

service:
telemetry:
metrics:
address: "${SPLUNK_LISTEN_INTERFACE}:8888"
extensions: [health_check, http_forwarder, zpages, memory_ballast]
pipelines:
traces:
Expand Down
1 change: 1 addition & 0 deletions deployments/ansible/molecule/custom_vars/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
splunk_service_group: custom-group
splunk_memory_total_mib: 256
splunk_ballast_size_mib: 100
splunk_listen_interface: 127.0.0.1
splunk_fluentd_config: /etc/otel/collector/fluentd/custom_fluentd.conf
splunk_fluentd_config_source: ./custom_fluentd_config.conf
install_fluentd: yes
Expand Down
7 changes: 7 additions & 0 deletions deployments/ansible/molecule/custom_vars/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
state: present
check_mode: yes

- name: Assert SPLUNK_LISTEN_INTERFACE env var is set
ansible.builtin.lineinfile:
line: SPLUNK_LISTEN_INTERFACE=127.0.0.1
dest: /etc/otel/collector/splunk-otel-collector.conf
state: present
check_mode: yes

- name: Look for ballast config in collector service output
ansible.builtin.shell:
cmd: 'journalctl -u splunk-otel-collector | grep "Set ballast to 100 MiB"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
splunk_memory_total_mib: 256
splunk_ballast_size_mib: 100
install_fluentd: yes
splunk_listen_interface: 127.0.0.1
splunk_fluentd_config: '{{ansible_env.ProgramFiles}}\Splunk\OpenTelemetry Collector\fluentd\custom_config.conf'
splunk_fluentd_config_source: ./custom_fluentd_config.conf
splunk_otel_collector_additional_env_vars:
Expand Down
3 changes: 3 additions & 0 deletions deployments/ansible/roles/collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ $> ansible-playbook playbook.yaml -e start_service=false
- `splunk_ballast_size_mib`: Memory ballast size in MiB that will be set to the Splunk
OTel Collector. (**default:** 1/3 of `splunk_memory_total_mib`)

- `splunk_listen_interface`: The network interface the collector receivers will listen on.
(**default** `0.0.0.0`).

- `splunk_skip_repo` (Linux only): If installing the collector from a custom or self-hosted
apt/yum repo, set to `true` to skip the installation of the default repo
(**default:** `false`)
Expand Down
1 change: 1 addition & 0 deletions deployments/ansible/roles/collector/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ splunk_memory_total_mib: 512
# 1/3 of memory_mib by default
splunk_ballast_size_mib: ""

splunk_listen_interface: "0.0.0.0"
install_fluentd: false
# Whether to start the services installed by the role (splunk-otel-collector and td-agent).
start_service: true
Expand Down
8 changes: 8 additions & 0 deletions deployments/ansible/roles/collector/tasks/otel_win_reg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
data: "{{splunk_ballast_size_mib}}"
type: string

- name: Set registry values
ansible.windows.win_regedit:
path: "{{registry_key}}"
state: present
name: SPLUNK_LISTEN_INTERFACE
data: "{{splunk_listen_interface}}"
type: string

- name: Set registry values
ansible.windows.win_regedit:
path: "{{registry_key}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SPLUNK_HEC_URL={{ "https://ingest." + splunk_realm + ".signalfx.com/v1/log" }}
SPLUNK_HEC_TOKEN={{ splunk_access_token }}
SPLUNK_MEMORY_TOTAL_MIB={{ splunk_memory_total_mib }}
SPLUNK_BALLAST_SIZE_MIB={{ splunk_ballast_size_mib }}
SPLUNK_LISTEN_INTERFACE={{ splunk_listen_interface }}
SPLUNK_BUNDLE_DIR={{ splunk_bundle_dir }}
SPLUNK_COLLECTD_DIR={{ splunk_collectd_dir }}
{% if splunk_otel_collector_additional_env_vars is not none %}
Expand Down
3 changes: 3 additions & 0 deletions deployments/chef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ required `splunk_access_token` attribute and some optional attributes:
`SPLUNK_BALLAST_SIZE_MIB` environment variable will be set with this value
for the Collector service. (**default:** `''`)

- `splunk_listen_interface`: The network interface the collector receivers
will listen on (**default** `0.0.0.0`).

- `splunk_service_user` and `splunk_service_group` (Linux only): Set the
user/group ownership for the Collector service. The user/group will be
created if they do not exist. (**default:** `splunk-otel-collector`)
Expand Down
1 change: 1 addition & 0 deletions deployments/chef/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
default['splunk_otel_collector']['splunk_hec_token'] = "#{node['splunk_otel_collector']['splunk_access_token']}"
default['splunk_otel_collector']['splunk_memory_total_mib'] = '512'
default['splunk_otel_collector']['splunk_ballast_size_mib'] = ''
default['splunk_otel_collector']['splunk_listen_interface'] = '0.0.0.0'

default['splunk_otel_collector']['collector_config'] = {}

Expand Down
1 change: 1 addition & 0 deletions deployments/chef/recipes/collector_win_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{ name: 'SPLUNK_HEC_TOKEN', type: :string, data: node['splunk_otel_collector']['splunk_hec_token'].to_s },
{ name: 'SPLUNK_MEMORY_TOTAL_MIB', type: :string, data: node['splunk_otel_collector']['splunk_memory_total_mib'].to_s },
{ name: 'SPLUNK_BALLAST_SIZE_MIB', type: :string, data: node['splunk_otel_collector']['splunk_ballast_size_mib'].to_s },
{ name: 'SPLUNK_LISTEN_INTERFACE', type: :string, data: node['splunk_otel_collector']['splunk_listen_interface'].to_s },
{ name: 'SPLUNK_BUNDLE_DIR', type: :string, data: node['splunk_otel_collector']['splunk_bundle_dir'].to_s },
{ name: 'SPLUNK_COLLECTD_DIR', type: :string, data: node['splunk_otel_collector']['splunk_collectd_dir'].to_s },
]
Expand Down
3 changes: 3 additions & 0 deletions deployments/chef/templates/splunk-otel-collector.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ SPLUNK_HEC_TOKEN=<%= node['splunk_otel_collector']['splunk_hec_token'] %>
# the value calculated by `SPLUNK_MEMORY_TOTAL_MIB`.
SPLUNK_MEMORY_TOTAL_MIB=<%= node['splunk_otel_collector']['splunk_memory_total_mib'] %>

# The network interface the collector receivers will listen on.
SPLUNK_LISTEN_INTERFACE=<%= node['splunk_otel_collector']['splunk_listen_interface'] %>

# How much memory to allocate to the ballast. This should be set to 1/3 to 1/2 of configured memory.
SPLUNK_BALLAST_SIZE_MIB=<%= node['splunk_otel_collector']['splunk_ballast_size_mib'] %>

Expand Down
1 change: 1 addition & 0 deletions deployments/puppet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ This class accepts the following parameters:
| `splunk_collectd_dir` | The path to the collectd config directory for the Smart Agent bundle. The default path is provided by the collector package. If the specified path is changed from the default value, the path should be an existing directory on the node. The `SPLUNK_COLLECTD_DIR` environment variable will be set to this value for the collector service. | Linux: `${splunk_bundle_dir}/run/collectd`<br>Windows: `${splunk_bundle_dir}\run\collectd` |
| `splunk_memory_total_mib` | Total memory in MIB to allocate to the collector; automatically calculates the ballast size. The `SPLUNK_MEMORY_TOTAL_MIB` environment variable will be set with this value for the collector service. | `512` |
| `splunk_ballast_size_mib` | Set the ballast size for the collector explicitly instead of the value calculated from the `$splunk_memory_total_mib` parameter. This should be set to 1/3 to 1/2 of configured memory. The `SPLUNK_BALLAST_SIZE_MIB` environment variable will be set with this value for the collector service. | None |
| `splunk_listen_interface` | Set the network interface the collector receivers will listen on. | `0.0.0.0` |
| `collector_config_source` | Source path to the collector config YAML file. This file will be copied to the `$collector_config_dest` path on the node. See the [source attribute](https://puppet.com/docs/puppet/latest/types/file.html#file-attribute-source) of the `file` resource for supported value types. The default source file is provided by the collector package. | Linux: `/etc/otel/collector/agent_config.yaml`<br>Windows: `%PROGRAMFILES\Splunk\OpenTelemetry Collector\agent_config.yaml` |
| `collector_config_dest` | Destination path of the collector config file on the node. The `SPLUNK_CONFIG` environment variable will be set with this value for the collector service. | Linux: `/etc/otel/collector/agent_config.yaml`<br>Windows: `%PROGRAMDATA%\Splunk\OpenTelemetry Collector\agent_config.yaml` |
| `service_user` and `$service_group` | **Linux only**: Set the user/group ownership for the collector service. The user/group will be created if they do not exist. | `splunk-otel-collector` |
Expand Down
7 changes: 7 additions & 0 deletions deployments/puppet/manifests/collector_win_registry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
require => Registry_key[$registry_key],
}

registry_value { "${registry_key}\\SPLUNK_LISTEN_INTERFACE":
ensure => 'present',
type => 'string',
data => $splunk_otel_collector::splunk_listen_interface,
require => Registry_key[$registry_key],
}

registry_value { "${registry_key}\\SPLUNK_BUNDLE_DIR":
ensure => 'present',
type => 'string',
Expand Down
1 change: 1 addition & 0 deletions deployments/puppet/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$splunk_collectd_dir = $splunk_otel_collector::params::splunk_collectd_dir,
$splunk_memory_total_mib = '512',
$splunk_ballast_size_mib = '',
$splunk_listen_interface = '0.0.0.0',
$collector_version = $splunk_otel_collector::params::collector_version,
$collector_config_source = $splunk_otel_collector::params::collector_config_source,
$collector_config_dest = $splunk_otel_collector::params::collector_config_dest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SPLUNK_HEC_TOKEN=<%= @splunk_hec_token %>
SPLUNK_HEC_URL=<%= @splunk_hec_url %>
SPLUNK_INGEST_URL=<%= @splunk_ingest_url %>
SPLUNK_MEMORY_TOTAL_MIB=<%= @splunk_memory_total_mib %>
SPLUNK_LISTEN_INTERFACE=<%= @splunk_listen_interface %>
SPLUNK_REALM=<%= @splunk_realm %>
SPLUNK_TRACE_URL=<%= @splunk_trace_url %>

Expand Down
3 changes: 3 additions & 0 deletions deployments/salt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ splunk-otel-collector:
- `splunk_ballast_size_mib`: Memory ballast size in MiB that will be set to the Splunk
OTel Collector. (**default:** 1/3 of `splunk_memory_total_mib`)

- `splunk_listen_interface`: The network interface the collector receivers will listen
on. (**default:** `0.0.0.0`)

- `collector_additional_env_vars`: Dictionary of additional environment
variables from the collector configuration file for the collector service
(**default:** `{}`). For example, if the collector configuration file
Expand Down
3 changes: 3 additions & 0 deletions deployments/salt/splunk-otel-collector/collector_config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

{% set splunk_ballast_size_mib = salt['pillar.get']('splunk-otel-collector:splunk_ballast_size_mib', '') %}

{% set splunk_listen_interface = salt['pillar.get']('splunk-otel-collector:splunk_listen_interface', '0.0.0.0') %}

{% set collector_additional_env_vars = salt['pillar.get']('splunk-otel-collector:collector_additional_env_vars', {}) %}

/etc/otel/collector/splunk-otel-collector.conf:
Expand All @@ -41,6 +43,7 @@
SPLUNK_HEC_TOKEN={{ splunk_hec_token }}
SPLUNK_MEMORY_TOTAL_MIB={{ splunk_memory_total_mib }}
SPLUNK_BALLAST_SIZE_MIB={{ splunk_ballast_size_mib }}
SPLUNK_LISTEN_INTERFACE={{ splunk_listen_interface }}
SPLUNK_BUNDLE_DIR={{ splunk_bundle_dir }}
SPLUNK_COLLECTD_DIR={{ splunk_collectd_dir }}
{% for key, value in collector_additional_env_vars.items() %}
Expand Down
Loading
Loading