Docs » Get started with the Splunk Distribution of the OpenTelemetry Collector » Collector components » Collector components: Extensions » Basicauth extension

Basicauth extension 🔗

The basicauth extension implements both configauth.ServerAuthenticator and configauth.ClientAuthenticator to authenticate clients and servers using basic authentication. The authenticator type has to be set to basicauth.

When used to authenticate servers, if the authentication is successful, client.Info.Auth exposes the following attributes:

  • username: The username of the authenticated user.

  • raw: Raw base64 encoded credentials.

Caution

You can either authenticate servers or clients with the extension. If you configure both options, the extension throws an error. See more in Settings.

Get started 🔗

Follow these steps to configure and activate the component:

  1. Deploy the Splunk Distribution of OpenTelemetry Collector to your host or container platform:

  1. Configure the basicauth extension as described in the next section.

  2. Restart the Collector.

Sample configurations 🔗

To activate the resource processor, add basicauth to the extensions section of your configuration file, as shown in the following example:

extensions:
  basicauth/server:
    htpasswd:
      file: .htpasswd
      inline: |
        ${env:BASIC_AUTH_USERNAME}:${env:BASIC_AUTH_PASSWORD}

  basicauth/client:
    client_auth:
      username: username
      password: password

receivers:
  otlp:
    protocols:
      http:
        auth:
          authenticator: basicauth/server

processors:

exporters:
  otlp:
    auth:
      authenticator: basicauth/client

To complete the configuration, include the extension in any pipeline of the service section of your configuration file. For example:

service:
  extensions: [basicauth/server, basicauth/client]
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [otlp]

Configuration example: Simple Prometheus receiver 🔗

The following example illustrates how to configure the basicauth extension for the Simple Prometheus receiver:

receivers:
  lightprometheus/myjob:
    auth:
      authenticator: basicauth
    collection_interval: 1s
    endpoint: "http://localhost:8000/metrics"

exporters:
  otlp:
    endpoint: "${OTLP_ENDPOINT}"
    tls:
      insecure: true

extensions:
  basicauth:
    client_auth:
      username: foo
      password: bar

service:
  extensions: [ basicauth ]
  pipelines:
    metrics:
      receivers: [ lightprometheus/myjob ]
      exporters: [ otlp ]

Settings 🔗

The following table shows the configuration options for the basicauth extension:

Authenticate servers or clients 🔗

You can either authenticate servers or clients with the extension. If you configure both options, the extension throws an error.

  • To configure the extension as a server authenticator, set either htpasswd.file or htpasswd.inline. If you configure both, htpasswd.inline credentials takes precedence.

  • To configure the extension as a client authenticator, set client_auth.

Troubleshooting 🔗

If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.

Available to Splunk Observability Cloud customers

Available to prospective customers and free trial users

  • Ask a question and get answers through community support at Splunk Answers .

  • Join the Splunk #observability user group Slack channel to communicate with customers, partners, and Splunk employees worldwide. To join, see Chat groups in the Get Started with Splunk Community manual.

This page was last updated on Dec 12, 2024.