Merge pull request #7545 from hashicorp/update-audit-examples
update audit examples to an endpoint that is audited
This commit is contained in:
commit
709fb75e73
|
@ -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{"*"},
|
||||
},
|
||||
|
|
2
command/agent/testdata/basic.hcl
vendored
2
command/agent/testdata/basic.hcl
vendored
|
@ -157,7 +157,7 @@ audit {
|
|||
|
||||
filter "default" {
|
||||
type = "HTTPEvent"
|
||||
endpoints = ["/ui/", "/v1/agent/health"]
|
||||
endpoints = ["/v1/metrics"]
|
||||
stages = ["*"]
|
||||
operations = ["*"]
|
||||
}
|
||||
|
|
2
command/agent/testdata/basic.json
vendored
2
command/agent/testdata/basic.json
vendored
|
@ -26,7 +26,7 @@
|
|||
{
|
||||
"default": [
|
||||
{
|
||||
"endpoints": ["/ui/", "/v1/agent/health"],
|
||||
"endpoints": ["/v1/metrics"],
|
||||
"operations": ["*"],
|
||||
"stages": ["*"],
|
||||
"type": "HTTPEvent"
|
||||
|
|
2
command/agent/testdata/sample0.json
vendored
2
command/agent/testdata/sample0.json
vendored
|
@ -24,7 +24,7 @@
|
|||
{
|
||||
"default": [
|
||||
{
|
||||
"endpoints": ["/ui/", "/v1/agent/health"],
|
||||
"endpoints": ["/v1/metrics"],
|
||||
"operations": ["*"],
|
||||
"stages": ["*"],
|
||||
"type": "HTTPEvent"
|
||||
|
|
2
command/agent/testdata/sample1/sample2.hcl
vendored
2
command/agent/testdata/sample1/sample2.hcl
vendored
|
@ -33,7 +33,7 @@ audit {
|
|||
|
||||
filter "default" {
|
||||
type = "HTTPEvent"
|
||||
endpoints = ["/ui/", "/v1/agent/health"]
|
||||
endpoints = ["/v1/metrics"]
|
||||
stages = ["*"]
|
||||
operations = ["*"]
|
||||
}
|
||||
|
|
|
@ -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"},
|
||||
},
|
||||
|
|
|
@ -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 = ["*"]
|
||||
|
|
Loading…
Reference in a new issue