cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.74.7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/checks/rule/link.md

142lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# rule/link
8
9This check allows to validate if URLs passed in alerting rule
10annotations. It will send a GET request to each link matching
11configured regexp and warn if it gets a non-200 response.
12
13## Configuration
14
15Syntax:
16
17```js
18link "$pattern" {
19 comment = "..."
20 severity = "bug|warning|info"
21 uri = "..."
22 timeout = "1m"
23 headers = { ... }
24}
25```
26
27- `$pattern` - regexp pattern to match, each rule will only check link
28 URLs that match this patter. This can be templated to reference checked
29 rule fields, see [Configuration](../../configuration.md) for details.
30- `uri` - optional URI rewrite rule, this will be used as the URI for all
31 requests if specified, regexp capture groups can be referenced here.
32- `comment` - set a custom comment that will be added to reported problems.
33- `severity` - set custom severity for reported issues, defaults to a bug.
34- `timeout` - timeout to be used for all request, defaults to 1 minute.
35- `headers` - a list of HTTP headers to set on all requests.
36
37## How to enable it
38
39This check is not enabled by default as it requires explicit configuration
40to work.
41To enable it add one or more `rule {...}` blocks and specify all rejected patterns
42there.
43
44Examples:
45
46Validate all links found in alert annotations:
47
48```js
49rule {
50 link "https?://.+" {}
51}
52```
53
54Only validate HTTPS links, ignore plain HTTP.
55
56```js
57rule {
58 link "https://.+" {}
59}
60```
61
62Only validate specific hostname.
63
64```js
65rule {
66 link "https?://runbooks.example.com/.+" {
67 comment = "Please link every alert to a run-book"
68 }
69}
70```
71
72Rewrite URI to use `http://docs.internal.example.com/foo.html` instead of
73`https://docs.example.com/foo.html`:
74
75```js
76rule {
77 link "https?://docs.example.com/(.+)" {
78 uri = "http://docs.internal.example.com/$1"
79 }
80}
81```
82
83Set `X-Auth` header for all requests.
84
85```js
86rule {
87 link "https?://runbooks.example.com/.+" {
88 headers = {
89 X-Auth = "secret key"
90 }
91 }
92}
93```
94
95## How to disable it
96
97You can disable this check globally by adding this config block:
98
99```js
100checks {
101 disabled = ["rule/link"]
102}
103```
104
105You can also disable it for all rules inside given file by adding
106a comment anywhere in that file. Example:
107
108```yaml
109# pint file/disable rule/link
110```
111
112Or you can disable it per rule by adding a comment to it. Example:
113
114```yaml
115# pint disable rule/link
116```
117
118If you want to disable only individual instances of this check
119you can add a more specific comment.
120
121```yaml
122# pint disable rule/link($pattern)
123```
124
125Example:
126
127```yaml
128# pint disable rule/link(^https?://.+$)
129```
130
131## How to snooze it
132
133You can disable this check until given time by adding a comment to it. Example:
134
135```yaml
136# pint snooze $TIMESTAMP rule/link
137```
138
139Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
140formatted or `YYYY-MM-DD`.
141Adding this comment will disable `rule/link` *until* `$TIMESTAMP`, after that
142check will be re-enabled.
143