Skip to content

Commit 878ee49

Browse files
authored
Add Block logs to Grafana Alloy (#21)
1 parent 8b7bedf commit 878ee49

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Grafana/Alloy/Config/config.alloy

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,71 @@ loki.source.file "ApiGateway" {
9696
forward_to = [loki.process.ApiGateway.receiver]
9797
}
9898

99+
local.file_match "ExecutionService" {
100+
path_targets = [{
101+
__address__ = "localhost",
102+
__path__ = "C:/ProgramData/Cortex/Execution Service/Logs/**/*.json",
103+
job = "ExecutionService",
104+
}]
105+
}
106+
107+
loki.process "ExecutionService" {
108+
forward_to = [loki.write.default.receiver]
109+
110+
stage.json {
111+
expressions = {
112+
level = "\"@l\"",
113+
timestamp = "\"@t\"",
114+
}
115+
}
116+
117+
stage.timestamp {
118+
source = "timestamp"
119+
format = "RFC3339Nano"
120+
}
121+
122+
stage.match {
123+
selector = "{job=\"ExecutionService\"}|~ \"\\\"SourceContext\\\":.?\\\"Cortex[.]ServiceFabric[.]Service[.]Execution[.]ExecutionService\\\"\""
124+
125+
stage.json {
126+
expressions = {
127+
BlockName = "Event.Tags.Cortex.\"Block.Name\" || 'Unknown'",
128+
BlockResult = "Event.Tags.Cortex.\"Block.Result.Status\" || 'Unknown'",
129+
ExceptionCategory = "Event.Tags.Cortex.\"Exception.Category\" || 'N/A'",
130+
ExceptionErrorCode = "Event.Tags.Cortex.\"Exception.ErrorCode\" || 'N/A'",
131+
ExceptionType = "Event.Tags.Cortex.\"Exception.Type\" || 'N/A'",
132+
FlowName = "Event.Tags.Cortex.\"Flow.Name\" || 'Unknown'",
133+
Node = "Event.Platform.Node.Name || 'Unknown'",
134+
PackageName = "Event.Tags.Cortex.\"Package.Name\" || 'Unknown'",
135+
System = "Event.Tags.Cortex.\"System.Name\" || 'Unknown'",
136+
Tenant = "Event.Tags.Cortex.\"Tenant.Name\" || 'Unknown'",
137+
Type = "Event.LogType || 'Cortex'",
138+
}
139+
}
140+
141+
stage.labels {
142+
values = {
143+
BlockName = null,
144+
BlockResult = null,
145+
ExceptionCategory = null,
146+
ExceptionErrorCode = null,
147+
ExceptionType = null,
148+
FlowName = null,
149+
Node = null,
150+
PackageName = null,
151+
System = null,
152+
Tenant = null,
153+
Type = null,
154+
}
155+
}
156+
}
157+
}
158+
159+
loki.source.file "ExecutionService" {
160+
targets = local.file_match.ExecutionService.targets
161+
forward_to = [loki.process.ExecutionService.receiver]
162+
}
163+
99164
loki.write "default" {
100165
endpoint {
101166
url = "https://<loki host address>:<loki reverse proxy port>/loki/api/v1/push"

0 commit comments

Comments
 (0)