- Drop logs that match a specific filter to remove unnecessary or low-value data.
- Drop fields from logs that match specified conditions, which helps reduce the size of individual logs. If a log contains no data after fields are dropped, you can choose to drop the entire log.
- Sample logs to retain a certain percentage of matching logs and drop the remainder, which can significantly reduce volume and maintain visibility.
- Emit metric converts log data to metric data. Use this control rule when you want to reduce the volume of logs, retain data for a longer period, and increase the speed of querying and filtering for metrics instead of logs.
- Replace field identifies a specified field in your log data and uses a regular expression to replace any matches based on the selected replacement mode. Use this control rule to truncate long fields and preserve your log structure.
View control rules
Select from one of the following methods to view control rules.- Web
- Chronoctl
- Terraform
- API
To view control rules:
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest. All defined control rules display in the Control rules section.
- To view only control rules, from the View dropdown, select Control rules.
- To view the code definition for all configured control rules, click the Code config tab. The Logs control rules section includes all defined control rules.
Create control rules
Use control rules to drop certain logs at ingestion, or fields that you don’t want to persist. For example, dropping log data from a specific cluster, test data in a development environment, or unnecessary individual fields across your logs. Use one of the following methods to create control rules for log data:- Web
- Chronoctl
- Terraform
- API
Define control rules in Observability Platform, and then
use the Code Config tool to apply the rule definition.
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
- In the Control rules section, click Create.
- In the Create control rule page, enter a name for the control rule.
-
From the Action menu, select the type of rule to create:
- Drop logs: Completely drop logs that match the specified filter.
- Drop fields: Remove specific fields from logs that match the specified filter.
- Sample logs: Retain a certain percentage of matching logs and drop the remainder.
- Emit metric: Convert log data to metric data.
- Replace field: Replace context within a log field using a regular expression.
-
Enter a filter to return log data for the control rule, and then press
Ctrl+Enter(Command+Returnon macOS) to submit the filter. This rule applies only to logs that match this filter at the time the log data was ingested. -
Review the returned data from the preview filter and make changes as necessary.
Control rules are applied during ingestion, so the preview filter results might differ from a filter submitted in Logs Explorer after ingestion. By default, including a dot (
.) in a filter indicates nesting within a field.In some instances, fields with a key that uses dot notation within the name, such asresource.type, must be surrounded by double quotes and brackets in the control rule filter.If a warning message displays indicating thatThis filter is applied at ingestionand the filter returns no results, wrap the key in double quotes (") and brackets ([]). For example, the following filter contains theresource.typekey, which requires surrounding the field in double quotes and brackets for this particular service: -
Enter additional information for the specified action:
- Drop logs
- Drop fields
- Sample logs
- Emit metric
- Replace fields
Review the filter and make changes as needed. - Click Save to save the control rule definition.
- Click the Code config tab and use the Code Config tool to apply the definition.
Chronoctl example
The following example defines a control rules file for Chronoctl, and contains the following rules:- The first rule samples 10% of logs that match the defined filter.
- The second rule drops all logs for the
nginxservice of severityINFOwhere thehttp.Request.statusequals200. - The third rule drops all
kubernetesfields that match the defined filter. The regular expression indicates that any fields matchingkubernetes.[FIELD]are dropped from all logs. - The fourth rule uses a mapped value to search for the
error_codefield, and replaces values based on the provided key/value pairs. If the rule matches onINTERNAL_SERVER_ERROR, it replaces that value with500. If the rule matches onNOT_FOUND, it replaces the value with401.
Terraform example
The following example defines a control rules resource for Terraform, and contains the following rules:- The first rule samples 10% of logs that match the defined filter.
- The second rule drops all logs for the
nginxservice of severityINFOwhere thehttp.Request.statusequals200. - The third rule drops all
kubernetesfields that match the defined filter. The regular expression indicates that any fields matchingkubernetes.[FIELD]are dropped from all logs. - The fourth rule uses a mapped value to search for the
error_codefield, and replaces values based on the provided key/value pairs. If the rule matches onINTERNAL_SERVER_ERROR, it replaces that value with500. If the rule matches onNOT_FOUND, it replaces the value with401.
Edit control rules
When creating or editing control rules, you can use the Code Config tool to view code representations of the rules. The displayed code also responds to changes you make in the Visual editor tab. Select from the following methods to edit control rules.- Web
- Chronoctl
- Terraform
- API
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
- In the row of the control rule you want to edit, click the three vertical dots icon and then click Edit control rule.
- In the Edit control rule drawer, make changes to your control rule, and then click Save.
- Click the Code config tab and use the Code Config tool to apply the definition.
Reorder control rules
Control rules are applied in descending order. To change the order control rules are applied, reorder rules. Disabled rules are skipped.- Web
- Chronoctl
- Terraform
- API
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
- In the Control rules section, click Re-order rules.
- In the Edit control rules drawer, in the row of the control rule you want to move, click the drag indicator icon and move the control rule to a different order position.
- Click Save.
- Click the Code config tab and use the Code Config tool to apply the definition.
Enable or disable control rules
Each rule has a mode, which can be enabled or disabled. By default, any created rule is enabled. Any rule that’s enabled is applied. Disabled rules are skipped.- Web
- Chronoctl
- Terraform
- API
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
- In the row of the control rule you want to enable or disable, click the toggle in the Enabled column.
- Click Save.
- Click the Code config tab and use the Code Config tool to apply the definition.
Delete control rules
Select from the following methods to delete control rules.- Web
- Chronoctl
- Terraform
- API
- In the navigation menu, click Go to Admin and then select Control > Logs Ingest.
- In the row of the control rule you want to delete, click the three vertical dots icon and then click Delete control rule.
- Click the Code config tab and use the Code Config tool to apply the definition.

