Skip to content

Commit c40dbd0

Browse files
Add alloy config files
1 parent e980b56 commit c40dbd0

File tree

3 files changed

+190
-0
lines changed

3 files changed

+190
-0
lines changed

docs/sources/tutorials/scenarios/monitor-syslog-messages.md

+29
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,32 @@ docker compose down
5959
```
6060

6161
## Understand the {{% param "PRODUCT_NAME" %}} configuration
62+
63+
```alloy
64+
65+
66+
livedebugging {
67+
enabled = true
68+
}
69+
70+
loki.source.syslog "local" {
71+
listener {
72+
address = "0.0.0.0:51893"
73+
labels = { component = "loki.source.syslog", protocol = "tcp" }
74+
}
75+
76+
listener {
77+
address = "0.0.0.0:51898"
78+
protocol = "udp"
79+
labels = { component = "loki.source.syslog", protocol = "udp"}
80+
}
81+
82+
forward_to = [loki.write.local.receiver]
83+
}
84+
85+
loki.write "local" {
86+
endpoint {
87+
url = "http://loki:3100/loki/api/v1/push"
88+
}
89+
}
90+
```

docs/sources/tutorials/scenarios/monitor-windows.md

+91
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,94 @@ You will now be able to view the Windows Performance Metrics and Event Logs in G
101101

102102
* Open your browser and go to [http://localhost:3000/a/grafana-lokiexplore-app](http://localhost:3000/a/grafana-lokiexplore-app).
103103
This will take you to the Loki explorer in Grafana.
104+
105+
106+
```alloy
107+
// ####################################
108+
// Windows Server Metrics Configuration
109+
// ####################################
110+
111+
prometheus.exporter.windows "default" {
112+
enabled_collectors = ["cpu","cs","logical_disk","net","os","service","system", "memory", "scheduled_task", "tcp"]
113+
}
114+
115+
// Configure a prometheus.scrape component to collect windows metrics.
116+
prometheus.scrape "example" {
117+
targets = prometheus.exporter.windows.default.targets
118+
forward_to = [prometheus.remote_write.demo.receiver]
119+
}
120+
121+
prometheus.remote_write "demo" {
122+
endpoint {
123+
url = "http://localhost:9090/api/v1/write"
124+
}
125+
}
126+
127+
// ####################################
128+
// Windows Server Logs Configuration
129+
// ####################################
130+
131+
loki.source.windowsevent "application" {
132+
eventlog_name = "Application"
133+
use_incoming_timestamp = true
134+
forward_to = [loki.process.endpoint.receiver]
135+
}
136+
137+
loki.source.windowsevent "System" {
138+
eventlog_name = "System"
139+
use_incoming_timestamp = true
140+
forward_to = [loki.process.endpoint.receiver]
141+
}
142+
143+
loki.process "endpoint" {
144+
forward_to = [loki.write.endpoint.receiver]
145+
stage.json {
146+
expressions = {
147+
message = "",
148+
Overwritten = "",
149+
source = "",
150+
computer = "",
151+
eventRecordID = "",
152+
channel = "",
153+
component_id = "",
154+
execution_processId = "",
155+
execution_processName = "",
156+
}
157+
}
158+
159+
stage.structured_metadata {
160+
values = {
161+
"eventRecordID" = "",
162+
"channel" = "",
163+
"component_id" = "",
164+
"execution_processId" = "",
165+
"execution_processName" = "",
166+
}
167+
}
168+
169+
stage.eventlogmessage {
170+
source = "message"
171+
overwrite_existing = true
172+
}
173+
174+
stage.labels {
175+
values = {
176+
"service_name" = "source",
177+
}
178+
}
179+
180+
stage.output {
181+
source = "message"
182+
}
183+
184+
}
185+
186+
187+
loki.write "endpoint" {
188+
endpoint {
189+
url ="http://localhost:3100/loki/api/v1/push"
190+
}
191+
}
192+
193+
livedebugging{}
194+
```

docs/sources/tutorials/scenarios/parse-structured-logs.md

+70
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,73 @@ docker compose down
6565
```
6666

6767
## Understand the {{% param "PRODUCT_NAME" %}} configuration
68+
69+
```alloy
70+
71+
72+
livedebugging {
73+
enabled = true
74+
}
75+
76+
loki.source.api "loki_push_api" {
77+
http {
78+
listen_address = "0.0.0.0"
79+
listen_port = 9999
80+
}
81+
forward_to = [
82+
loki.process.lables.receiver,
83+
]
84+
}
85+
86+
loki.process "lables" {
87+
stage.json {
88+
expressions = {
89+
"timestamp" = "",
90+
"state" = "",
91+
"package_size" = "",
92+
"package_status" = "",
93+
"package_id" = "",
94+
}
95+
}
96+
97+
stage.timestamp {
98+
source = "timestamp"
99+
format = "RFC3339"
100+
}
101+
102+
stage.labels {
103+
values = {
104+
"state" = "",
105+
"package_size" = "",
106+
}
107+
}
108+
109+
stage.structured_metadata {
110+
values = {
111+
"package_status" = "",
112+
"package_id" = "",
113+
}
114+
}
115+
116+
stage.static_labels {
117+
values = {
118+
"service_name" = "Delivery World",
119+
}
120+
}
121+
122+
stage.output {
123+
source = "message"
124+
}
125+
126+
127+
128+
forward_to = [loki.write.local.receiver]
129+
130+
}
131+
132+
loki.write "local" {
133+
endpoint {
134+
url = "http://loki:3100/loki/api/v1/push"
135+
}
136+
}
137+
```

0 commit comments

Comments
 (0)