Hi all,
I’m trying to unmarshal config.alloy
to struct
using syntax.go
(alloy/syntax/syntax.go at main · grafana/alloy · GitHub), and may I ask 2 questions?
data, err := os.ReadFile("config_formatted.alloy")
if err != nil {
panic(err)
}
var configOut Config
err = syntax.Unmarshal(data, &configOut)
if err != nil {
panic(err)
}
-
What should be the type for block reference attribute, like forward_to (e.g.,
forward_to = [loki.process.user_logs_limit.receiver]
ormetrics = [otelcol.exporter.otlphttp.metricsotlp.input]
)?
I tried[]interface{}
but it didn’t work.(panic: 36:25: identifier "prometheus" does not exist
) -
What should be the type for attributes with
env(...)
& string value (e.g.,__path__ = env("SOME_ENV"),
and__path__ = "C:\\logpath",
)?
Thanks in advance!