Skip to content

Commit 885726e

Browse files
committed
add matrix template
1 parent 7e3ebaf commit 885726e

File tree

5 files changed

+99
-25
lines changed

5 files changed

+99
-25
lines changed

Diff for: docs/docs/ingestion/kinesis_firehose.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Amazon Cloudwatch and [many other AWS services](https://docs.aws.amazon.com/Amaz
44

55
Some of the AWS logs that can be sent to Kinesis firehose are: Amazon Cloudwatch, Amazon Virtual Private Cloud flow logs, AWS Network Firewall logs, AWS WAF logs.
66

7-
You can configure Kinesis firehose to send logs to Zinc Cloud / Zinc Observe using below details.
7+
You can configure Kinesis firehose to send logs to Zinc Cloud / ZincObserve using below details.
88

99
```yaml
1010
HTTP endpoint: https://api.zinc.dev/aws/org_name/stream_name/_kinesis_firehose

Diff for: docs/docs/user-guide/alerts/templates.md

+30-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ Variables which can be used in templates are:
2323
## Slack
2424

2525
```json
26-
{"text": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"}
26+
{
27+
"text": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"
28+
}
29+
2730
```
2831

29-
## Alert Manager
32+
## Prometheus Alert Manager
3033
```json
3134
[
3235
{
@@ -48,7 +51,12 @@ Variables which can be used in templates are:
4851
## WeCom
4952

5053
```json
51-
{"msgtype": "text", "text": {"content": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"}}
54+
{
55+
"msgtype": "text",
56+
"text": {
57+
"content": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"
58+
}
59+
}
5260
```
5361

5462
Message usage:
@@ -63,7 +71,12 @@ Webhook URL, eg:
6371
## Feishu
6472

6573
```json
66-
{"msg_type": "text", "content": {"text": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"}}
74+
{
75+
"msg_type": "text",
76+
"content": {
77+
"text": "For stream {stream_name} of organization {org_name} alert {alert_name} of type {alert_type} is active"
78+
}
79+
}
6780
```
6881

6982
Message usage:
@@ -74,3 +87,16 @@ Webhook URL, eg:
7487

7588
`POST https://open.feishu.cn/open-apis/bot/v2/hook/d91b7e97-1234-1234-1234-dfb0b9cc54d0`
7689

90+
91+
## Matrix
92+
93+
```json
94+
{
95+
"msgtype": "m.text",
96+
"format": "org.matrix.custom.html",
97+
"body": "{org_name}/{stream_name}: {alert_name}<br><a href=https://yourZincObserveURL.example.com/web/logs?org_identifier={org_name}>Recent logs</a>",
98+
"formatted_body": "{org_name}/{stream_name}: {alert_name}<br><a href=https://yourZincObserveURL.example.com/web/logs?org_identifier={org_name}>Recent logs</a>"
99+
100+
}
101+
```
102+

Diff for: docs/howto/ingest_ecs_logs_using_firelens.md

+7-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Introduction
44

5-
In order to send logs from [**`tasks`**](## "An `ECS task` is a collection of on or more containers running as a single unit in ECS. If you are from a kubernetes background then an ECS task is equivalent to a pod") running in ECS (on fargate and ec2 for linux) to ZincObserve, AWS firelens is the recommended mechanism. AWS firelens is a log router for Amazon ECS that sends log data from containers running in ECS tasks to fluentbit (or fluentd) sidecar container which can then send data to wherever fluentbit supports sending data. A sidecar container is simply an additional container running along side the main container in a task that performs some ancillary services - e.g. collecting logs, keep configuration up to date, etc. We recommend that you use fluentbit instead of fluentd due to its much lower resource requirements.
5+
In order to send logs from [**`tasks`**](## "An `ECS task` is a collection of on or more containers running as a single unit in ECS. If you are from a kubernetes background then an ECS task is equivalent to a pod") running in ECS (on fargate and ec2 for linux) to ZincObserve, AWS firelens is the recommended mechanism. AWS firelens is a log router for Amazon ECS that sends log data from containers running in ECS tasks to fluentbit (or fluentd) sidecar container which can then send data to wherever fluentbit supports sending data. A sidecar container is simply an additional container running along side the main container in a task that performs some ancillary services - e.g. collecting logs, keep configuration up to date, etc. We recommend that you use fluentbit instead of fluentd due to its much lower resource requirements.
66

77
If you have existing ECS tasks from which you need to send logs to ZincObserve, then you will need to modify their task definition to add fluentbit sidecar. Let's take a look at how to accomplish this.
88

@@ -15,7 +15,7 @@ We will run our tasks using fargate for this demonstration.
1515

1616
## Get Zinc Cloud / ZincObserve Configuration
1717

18-
Before you can start with setting up the configuration of your ECS task you will need the details of your ZincObserve where you will send the logs.
18+
Before you can start with setting up the configuration of your ECS task you will need the details of your ZincObserve where you will send the logs.
1919

2020
> You can either use a self hosted ZincObserve or [Zinc Cloud](https://observe.zinc.dev) for following this guide. You can get started with [Zinc Cloud](https://observe.zinc.dev) for free at [https://observe.zinc.dev](https://observe.zinc.dev) that has a generous free tier.
2121
@@ -36,9 +36,7 @@ Create the following file and save it as "nginx_firelens_zo_task_def.json"
3636
"executionRoleArn": "arn:aws:iam::058694856476:role/ecsTaskExecutionRole",
3737
"cpu": "512",
3838
"memory": "1024",
39-
"requiresCompatibilities": [
40-
"FARGATE"
41-
],
39+
"requiresCompatibilities": ["FARGATE"],
4240
"networkMode": "awsvpc",
4341
"containerDefinitions": [
4442
{
@@ -97,37 +95,29 @@ Create the following file and save it as "nginx_firelens_zo_task_def.json"
9795

9896
`options` section has [http output plugin](https://docs.fluentbit.io/manual/pipeline/outputs/http) configuration for fluentbit. Configure this section with the values you got from ZincObserve.
9997

100-
10198
Register the task definition using the below command:
10299

103100
```shell
104101
aws ecs register-task-definition --cli-input-json file://nginx_firelens_zo_task_def.json
105102
```
106103

107-
108104
We will also need to provide network configuration when using networkMode as `awsvpc` during service creation. Let's create a json file for that:
109105

110106
```json title="Network configuration - network_config.json" linenums="1" hl_lines="10"
111107
{
112108
"awsvpcConfiguration": {
113-
"subnets": [
114-
"subnet-12345678",
115-
"subnet-23456789"
116-
],
117-
"securityGroups": [
118-
"sg-12345678"
119-
],
109+
"subnets": ["subnet-12345678", "subnet-23456789"],
110+
"securityGroups": ["sg-12345678"],
120111
"assignPublicIp": "ENABLED"
121112
}
122113
}
123114
```
124115

125116
**Note**: `Do not` set `assignPublicIp` on line `10` as ENABLED for real world scenarios. You do not want to access tasks directly. We are doing this now only for demonstration. You should always either front the services with a load balancer or AWS `Cloud Map`.
126117

127-
128118
## Create ECS service
129119

130-
Now let's create an ECS `service` that will use this task definition.
120+
Now let's create an ECS `service` that will use this task definition.
131121

132122
Assuming the name of your cluster - `ecs1_fargate_cluster1` run below command:
133123

@@ -154,19 +144,16 @@ Now click on the task:
154144

155145
![ Task details](./images/firelens/task_details.png)
156146

157-
158147
You should see the `Public IP` for the task.
159148

160149
Click `open address`. You should see the following page:
161150

162151
![Nginx page](./images/firelens/nginx.png)
163152

164-
165153
Now head on the ZincObserve / Zinc Cloud and see the logs flowing in there.
166154

167-
![ECS logs in Zinc Observe](./images/firelens/zo_logs.png)
155+
![ECS logs in ZincObserve](./images/firelens/zo_logs.png)
168156

169157
## Conclusion
170158

171159
AWS firelens provides an easy way to send ECS container logs to ZincObserve. We configured AWS firelens in few steps to send logs to ZincObserve / Zinc cloud. to easily view and analyze logs.
172-

Diff for: openapi1/redoc.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
4+
</head>
5+
<body>
6+
<redoc spec-url="https://alpha1.gke.zinclabs.dev/api-doc/openapi.json"></redoc>
7+
</body>
8+
</html>

Diff for: openapi1/spotlightio-elements.html

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="description" content="">
8+
<meta name="author" content="">
9+
10+
<title>Elements in Twitter Bootstrap</title>
11+
12+
<!-- Elements: Web Component -->
13+
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
14+
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
15+
16+
<!-- Twitter Bootstrap -->
17+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
18+
<!-- Twitter Bootstrap: Sticky Footer Example -->
19+
<link rel="stylesheet"
20+
href="https://getbootstrap.com/docs/4.5/examples/sticky-footer-navbar/sticky-footer-navbar.css">
21+
22+
<style>
23+
body {
24+
display: flex;
25+
flex-direction: column;
26+
height: 100vh;
27+
}
28+
29+
main {
30+
flex: 1 0 0;
31+
overflow: hidden;
32+
}
33+
</style>
34+
</head>
35+
36+
<body>
37+
38+
<header>
39+
</header>
40+
41+
<!-- Begin page content -->
42+
<main role="main">
43+
<elements-api apiDescriptionUrl="https://alpha1.gke.zinclabs.dev/api-doc/openapi.json" router="hash" />
44+
</main>
45+
46+
<footer class="footer">
47+
<div class="container">
48+
<span class="text-muted">Awesome footer goes here.</span>
49+
</div>
50+
</footer>
51+
</body>
52+
53+
</html>

0 commit comments

Comments
 (0)