Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cloudflare] Add health check to mock service #11313

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cloudflare/_dev/deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ services:
- ./logpull-mock-service:/app
ports:
- "3000:3000"
healthcheck:
test: "wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1"
interval: 10s
timeout: 5s
command: ["go", "run", "main.go"]
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
// Ref: https://developers.cloudflare.com/logs/logpull/requesting-logs/
func main() {
router := mux.NewRouter()
router.Path("/health").HandlerFunc(healthHandler).Methods("GET").Schemes("http")
router.Path("/client/v4/zones/aaabbbccc/logs/received").HandlerFunc(logpullHandler).Methods("GET").Schemes("http")

port := 3000
Expand All @@ -41,6 +42,10 @@ func main() {
http.ListenAndServe(fmt.Sprintf(":%d", port), h)
}

func healthHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "OK")
}

func logpullHandler(w http.ResponseWriter, r *http.Request) {
// Set response headers to indicate rolling response
w.Header().Set("Content-Type", "text/event-stream")
Expand Down
5 changes: 5 additions & 0 deletions packages/cloudflare/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "2.28.1"
chrisberkhout marked this conversation as resolved.
Show resolved Hide resolved
changes:
- description: "Add health check to mock service."
type: bugfix
link: https://github.com/elastic/integrations/pull/11313
- version: "2.28.0"
changes:
- description: "Allow @custom pipeline access to event.original without setting preserve_original_event."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vars:
enable_request_tracer: true
data_stream:
vars:
interval: 1h
interval: 2m
preserve_original_event: true
auth_email: [email protected]
auth_key: xxxxxxxxxx
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cloudflare
title: Cloudflare
version: "2.28.0"
version: "2.28.1"
description: Collect logs from Cloudflare with Elastic Agent.
type: integration
format_version: "3.0.2"
Expand Down