Merge pull request #7545 from hashicorp/update-audit-examples

update audit examples to an endpoint that is audited
This commit is contained in:
Drew Bailey 2020-03-30 10:42:24 -04:00 committed by GitHub
commit 709fb75e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 13 deletions

View file

@ -153,7 +153,7 @@ var basicConfig = &Config{
{
Name: "default",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"*"},
Operations: []string{"*"},
},
@ -623,7 +623,7 @@ var sample0 = &Config{
{
Name: "default",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"*"},
Operations: []string{"*"},
},
@ -711,7 +711,7 @@ var sample1 = &Config{
{
Name: "default",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"*"},
Operations: []string{"*"},
},

View file

@ -157,7 +157,7 @@ audit {
filter "default" {
type = "HTTPEvent"
endpoints = ["/ui/", "/v1/agent/health"]
endpoints = ["/v1/metrics"]
stages = ["*"]
operations = ["*"]
}

View file

@ -26,7 +26,7 @@
{
"default": [
{
"endpoints": ["/ui/", "/v1/agent/health"],
"endpoints": ["/v1/metrics"],
"operations": ["*"],
"stages": ["*"],
"type": "HTTPEvent"

View file

@ -24,7 +24,7 @@
{
"default": [
{
"endpoints": ["/ui/", "/v1/agent/health"],
"endpoints": ["/v1/metrics"],
"operations": ["*"],
"stages": ["*"],
"type": "HTTPEvent"

View file

@ -33,7 +33,7 @@ audit {
filter "default" {
type = "HTTPEvent"
endpoints = ["/ui/", "/v1/agent/health"]
endpoints = ["/v1/metrics"]
stages = ["*"]
operations = ["*"]
}

View file

@ -28,7 +28,7 @@ func TestAuditConfig_Merge(t *testing.T) {
{
Name: "one",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"*"},
Operations: []string{"*"},
},
@ -53,7 +53,7 @@ func TestAuditConfig_Merge(t *testing.T) {
{
Name: "one",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"OperationReceived"},
Operations: []string{"GET"},
},
@ -86,7 +86,7 @@ func TestAuditConfig_Merge(t *testing.T) {
{
Name: "one",
Type: "HTTPEvent",
Endpoints: []string{"/ui/", "/v1/agent/health"},
Endpoints: []string{"/v1/metrics"},
Stages: []string{"OperationReceived"},
Operations: []string{"GET"},
},

View file

@ -121,15 +121,23 @@ logging as well as reducing the amount of events generated.
`endpoints`, `stages`, and `operations` support [globbed pattern](https://github.com/ryanuber/go-glob/blob/master/README.md#example) matching.
```hcl
# Filter all requests and all stages for /v1/agent/health
# Filter out all requests and all stages for /v1/metrics
filter "default" {
type = "HTTPEvent"
endpoints = ["/v1/agent/health"]
endpoints = ["/v1/metrics"]
stages = ["*"]
operations = ["*"]
}
# Filter OperationReceived GET requests for all endpoints
# Filter out requests where endpoint matches globbed pattern
filter "globbed example" {
type = "HTTPEvent"
endpoints = ["/v1/evaluation/*/allocations"]
stages = ["*"]
operations = ["*"]
}
# Filter out OperationReceived GET requests for all endpoints
filter "OperationReceived GETs" {
type = "HTTPEvent"
endpoints = ["*"]