Resource attributes provide additional contextual information about the source of your logs, such as service name, host details, and process information. You can remove unwanted resource attributes either at the source (Agent/SDK) or at the OpenTelemetry Collector level.
Why remove Resource Attributes?
- Reduce Data Volume: Removing resource attributes can help reduce the volume of data stored in your log storage system.
- Cost Optimization: Reducing the amount of data stored can help optimize your storage costs.
- Improved Query Performance: Removing resource attributes can improve query performance by reducing the number of unique attribute values.
- Security/Privacy: Some attributes may contain sensitive information that shouldn't be exported.
Removing Resource Attributes at the Collector Level
The OpenTelemetry Collector provides a Resource Processor which can be used to delete specific attributes from all incoming data.
1. Add Resource Processor
In your OpenTelemetry Collector configuration file, add a resource processor with delete action to remove specific attributes.
processors:
resource/remove_attributes:
attributes:
- key: process.command_line
action: delete
In the example above, the process.command_line attribute will be removed from all logs processed by this pipeline.
Ensure you verify the key name exactly matches the attribute you wish to remove.
2. Add the processor to your pipeline
Ensure it is listed in the processors section of your logs pipeline.
service:
pipelines:
logs:
receivers: [otlp]
processors: [resource/remove_attributes, batch]
exporters: [otlp]
This configuration will ensure process.command_line is removed from all logs processed by this pipeline, regardless of the source SDK.
For more details on configuring the OpenTelemetry Collector, see the OTel Collector configuration guide.
OpenTelemetry Java (SDK & Agent)
There are two approaches to remove resource attributes in Java applications:
- Disable specific resource attribute keys - Remove individual attributes by name
- Disable resource providers - Prevent entire groups of related attributes from being generated
When to use each approach:
- Use Approach 1 (disabled keys) when you need fine-grained control over specific attributes
- Use Approach 2 (disabled providers) when you want to disable entire categories of attributes for maximum efficiency
Approach 1: Disable Specific Resource Attribute Keys
The otel.resource.disabled.keys configuration property allows you to filter out specific resource attributes. This is a general SDK configuration property that works for both the OpenTelemetry Java SDK and the OpenTelemetry Java Agent.
Using System Properties
You can pass the filter as a system property when starting your application, for example:
java -javaagent:/path/to/opentelemetry-javaagent.jar \
-Dotel.resource.disabled.keys=process.command_line \
-jar myapp.jar
This will remove the process.command_line attribute from all logs generated by your application.
Using Environment Variables
You can also use the OTEL_RESOURCE_DISABLED_KEYS environment variable:
export OTEL_RESOURCE_DISABLED_KEYS=process.command_line
java -javaagent:/path/to/opentelemetry-javaagent.jar -jar myapp.jar
This will remove the process.command_line attribute from all logs generated by your application.
To disable multiple attributes, provide a comma-separated list of attribute keys, for example:
export OTEL_RESOURCE_DISABLED_KEYS=process.command_line,process.command_args
Limitations: Certain mandatory resource attributes defined by the OpenTelemetry specification (such as telemetry.sdk.name, telemetry.sdk.version, etc.) cannot be disabled through this configuration. Removing these requires a custom agent extension.
Approach 2: Disable Resource Providers
Resource providers are components that automatically detect and add groups of related resource attributes. Disabling a resource provider prevents all attributes from that provider from being generated, which can be more efficient than filtering individual attributes.
Common Resource Providers and Their Attributes
Here are the most common resource providers and the attributes they generate:
ProcessResourceProvider - Process-related attributes:
process.command_lineprocess.command_argsprocess.pidprocess.runtime.nameprocess.runtime.versionprocess.runtime.description
HostResourceProvider - Host and OS attributes:
host.namehost.archos.descriptionos.type
ContainerResourceProvider - Container attributes:
container.idcontainer.namecontainer.image.name
Telemetry SDK Attributes: Certain core SDK attributes like telemetry.sdk.name, telemetry.sdk.version, telemetry.sdk.language, telemetry.distro.name, and telemetry.distro.version are generated by various SDK resource providers and cannot be disabled through the otel.java.disabled.resource.providers configuration. These mandatory attributes are defined by the OpenTelemetry specification. To remove these, you would need to use a custom agent extension or filter them at the Collector level.
Using System Properties
To disable specific resource providers, use the otel.java.disabled.resource.providers system property:
java -javaagent:/path/to/opentelemetry-javaagent.jar \
-Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.resources.ProcessResourceProvider \
-jar myapp.jar
Using Environment Variables
You can also use the OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS environment variable:
export OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS=io.opentelemetry.instrumentation.resources.ProcessResourceProvider
java -javaagent:/path/to/opentelemetry-javaagent.jar -jar myapp.jar
Disabling Multiple Resource Providers
To disable multiple resource providers, separate them with commas:
java -javaagent:/path/to/opentelemetry-javaagent.jar \
-Dotel.java.disabled.resource.providers=io.opentelemetry.instrumentation.resources.ProcessResourceProvider,io.opentelemetry.instrumentation.resources.HostResourceProvider \
-jar myapp.jar
Important Considerations:
- Be careful when disabling resource providers as some attributes may be useful for debugging and monitoring
- Test thoroughly to ensure you're not removing attributes that your observability setup depends on
- Disabling providers affects all telemetry signals (traces, metrics, and logs), not just logs
For more details about available resource providers and their attributes, see the OpenTelemetry Java instrumentation documentation.
Other Languages
Both OTEL_RESOURCE_DISABLED_KEYS and OTEL_JAVA_DISABLED_RESOURCE_PROVIDERS configurations are currently specific to the OpenTelemetry Java SDK and Agent. Other language SDKs do not support these configuration options. For other languages, use the Collector-level approach described above, which works universally for all SDKs.
Validate
To verify that the resource attributes have been removed:
- Generate some logs from your application.
- Go to the Logs tab in SigNoz.
- Select a log line and check the Resource Attributes section in the details pane.
- Confirm that
process.command_line(or your filtered attribute) is no longer present.
Related Guides
- Set Resource Attributes for Logs - Learn how to add resource attributes to your logs
- Drop Logs - Filter and drop unwanted logs at the Collector level
- Guide to perform PII Scrubbing - Scrub sensitive data from logs
Get Help
If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack.
If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.