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

Add support for indexing log_attributes in OTLPConfig #15128 #15293

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
60 changes: 60 additions & 0 deletions loki-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
auth_enabled: false

server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: debug
grpc_server_max_concurrent_streams: 1000

common:
instance_addr: 127.0.0.1
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory

query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100

schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h

pattern_ingester:
enabled: true
metric_aggregation:
loki_address: localhost:3100

ruler:
alertmanager_url: http://localhost:9093

frontend:
encoding: protobuf

# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false
40 changes: 39 additions & 1 deletion pkg/loghttp/push/otlp_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,44 @@ log_attributes:
},
},
},
{
name: "log_attributes indexing",
yamlConfig: []byte(`
log_attributes:
- action: index_label
attributes:
- user_id
- order_id`),
expectedCfg: OTLPConfig{
ResourceAttributes: ResourceAttributesConfig{
AttributesConfig: DefaultOTLPConfig(defaultGlobalOTLPConfig).ResourceAttributes.AttributesConfig,
},
LogAttributes: []AttributesConfig{
{
Action: IndexLabel,
Attributes: []string{"user_id", "order_id"},
},
},
},
},
{
name: "log_attributes with regex",
yamlConfig: []byte(`
log_attributes:
- action: index_label
regex: ^custom_.+`),
expectedCfg: OTLPConfig{
ResourceAttributes: ResourceAttributesConfig{
AttributesConfig: DefaultOTLPConfig(defaultGlobalOTLPConfig).ResourceAttributes.AttributesConfig,
},
LogAttributes: []AttributesConfig{
{
Action: IndexLabel,
Regex: relabel.MustNewRegexp("^custom_.+"),
},
},
},
},
{
name: "unsupported action should error",
yamlConfig: []byte(`
Expand Down Expand Up @@ -360,4 +398,4 @@ func TestOTLPConfig(t *testing.T) {
}
})
}
}
}