A Caddy v2 plugin to track requests in Pirsch analytics

Go

caddy-pirsch-plugin

A Caddy v2 plugin to track requests in Pirsch Analytics.

Usage

pirsch [<matcher>] {
    client_id <pirsch-client-id>
    client_secret <pirsch-client-secret>
    host_name <pirsch-host-name>
    base_url <alternative-api-url>
}

You can obtain these parameters from the Settings section of your Pirsch dashboard.

Because this directive does not come standard with Caddy, you need to put the directive in order. The correct place is up to you, but usually putting it near the end works if no other terminal directives match the same requests. It's common to pair a Pirsch handler with a file_server, so ordering it just before is often a good choice:

{
	order pirsch before file_server
}

Alternatively, you may use route to order it the way you want. For example:

localhost
root * /srv
route {
	pirsch * {
		[...]
	}
	file_server
}

Example

Track all requests to HTML pages in Pirsch. You might want to extend the matcher regexp to also include / or, alternatively, match everything but assets (like .css, .js, ...) since usually you wouldn't want to track those.

{
    order pirsch before file_server
}

http://localhost:8080 {
    @html path_regexp .*\.html$

    pirsch @html {
        client_id cCfoZttXzRH5AyOpiu97wqXH3j5lYXcg
        client_secret olshVxS73jWQFhXJE86DdoR4McPBh02OendvyLtajX2EA3aasfywb3q3uZio9tDL
        host_name mysite.example.org
    }

    file_server
}

License

Apache 2.0

Owner
Ferdinand Mütsch
💪 Never stop learning!
Ferdinand Mütsch
Similar Resources

Traefik plugin to proxy requests to owasp/modsecurity-crs:apache container

Traefik plugin to proxy requests to owasp/modsecurity-crs:apache container

Traefik Modsecurity Plugin Traefik plugin to proxy requests to owasp/modsecurity-crs:apache Traefik Modsecurity Plugin Demo Full Configuration with do

Dec 27, 2022

Get related domains / subdomains by looking at Google Analytics IDs

Get related domains / subdomains by looking at Google Analytics IDs

AnalyticsRelationships This script try to get related domains / subdomains by looking at Google Analytics IDs from a URL. First search for ID of Googl

Jan 2, 2023

A minimal analytics package to start collecting traffic data without client dependencies.

go-web-analytics A minimal analytics package to start collecting traffic data without client dependencies. Logging incoming requests import "github.co

Nov 23, 2021

This project provides fully automated one-click experience to create Cloud and Kubernetes environment to run Data Analytics workload like Apache Spark.

This project provides fully automated one-click experience to create Cloud and Kubernetes environment to run Data Analytics workload like Apache Spark.

Introduction This project provides a fully automated one-click tool to create Data Analytics platform in Cloud and Kubernetes environment: Single scri

Nov 25, 2022

The plugin serves as a starting point for writing a Mattermost plugin

Plugin Starter Template This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

Dec 10, 2021

Kobiton-execute-test-buildkite-plugin - A Buildkite Plugin to (synchronously) execute an automated test script on Kobiton service

Kobiton Execute Test Buildkite Plugin A Buildkite Plugin to (synchronously) exec

Feb 10, 2022

Cf-cli-find-app-plugin - CF CLI plugin to find applications containing a search string

Overview This cf cli plugin allows users to search for application names that co

Jan 3, 2022

Twitter-plugin - Falco Plugin for Twitter Stream

Twitter Plugin This repository contains the twittter plugin for Falco, which fol

Mar 17, 2022

Spyware that keeps track of your girlfriend/wife or boyfriend/husband activities

Linda-bibi-Spyware Spyware that keeps track of your girlfriend/wife or boyfriend/husband activities.

Aug 3, 2021
Comments
  • Fatal error - concurrent map read and write

    Fatal error - concurrent map read and write

    There currently is a critical error that gets Caddy to crash with the following error:

    Oct 05 01:11:04 localhost caddy[31157]: fatal error: concurrent map read and map write
    Oct 05 01:11:04 localhost caddy[31157]: goroutine 9422 [running]:
    Oct 05 01:11:04 localhost caddy[31157]: runtime.throw(0x19679fa, 0x21)
    Oct 05 01:11:04 localhost caddy[31157]:         runtime/panic.go:1117 +0x72 fp=0xc0004e0538 sp=0xc0004e0508 pc=0x438592
    Oct 05 01:11:04 localhost caddy[31157]: runtime.mapaccess1_faststr(0x17db0a0, 0xc000384f00, 0xc000566ad8, 0x3, 0x25f9300)
    Oct 05 01:11:04 localhost caddy[31157]:         runtime/map_faststr.go:21 +0x465 fp=0xc0004e05a8 sp=0xc0004e0538 pc=0x414045
    Oct 05 01:11:04 localhost caddy[31157]: net/textproto.MIMEHeader.Get(0xc000384f00, 0x18f022c, 0x3, 0xc000896048, 0x20)
    Oct 05 01:11:04 localhost caddy[31157]:         net/textproto/header.go:34 +0x5f fp=0xc0004e05e0 sp=0xc0004e05a8 pc=0x689a5f
    Oct 05 01:11:04 localhost caddy[31157]: net/http.Header.Get(...)
    Oct 05 01:11:04 localhost caddy[31157]:         net/http/header.go:46
    Oct 05 01:11:04 localhost caddy[31157]: github.com/pirsch-analytics/pirsch-go-sdk.(*Client).HitWithOptions(0xc0000ef8c0, 0xc000ab0900, 0x0, 0xc000ab0600, 0xc000030000)
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/pirsch-analytics/[email protected]/client.go:115 +0x59 fp=0xc0004e06c8 sp=0xc0004e05e0 pc=0x1591299
    Oct 05 01:11:04 localhost caddy[31157]: github.com/pirsch-analytics/pirsch-go-sdk.(*Client).Hit(...)
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/pirsch-analytics/[email protected]/client.go:110
    Oct 05 01:11:04 localhost caddy[31157]: github.com/muety/caddy-pirsch-plugin.(*PirschPlugin).ServeHTTP.func1(0xc000ed29b0, 0xc000ab0900)
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/muety/[email protected]/plugin.go:46 +0x5a fp=0xc0004e07d0 sp=0xc0004e06c8 pc=0x1599eda
    Oct 05 01:11:04 localhost caddy[31157]: runtime.goexit()
    Oct 05 01:11:04 localhost caddy[31157]:         runtime/asm_amd64.s:1371 +0x1 fp=0xc0004e07d8 sp=0xc0004e07d0 pc=0x472681
    Oct 05 01:11:04 localhost caddy[31157]: created by github.com/muety/caddy-pirsch-plugin.(*PirschPlugin).ServeHTTP
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/muety/[email protected]/plugin.go:45 +0x4d
    Oct 05 01:11:04 localhost caddy[31157]: goroutine 1 [select (no cases), 47 minutes]:
    Oct 05 01:11:04 localhost caddy[31157]: github.com/caddyserver/caddy/v2/cmd.cmdRun(0xc0000783c0, 0x0, 0x0, 0x0)
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/caddyserver/caddy/[email protected]/cmd/commandfuncs.go:275 +0x1395
    Oct 05 01:11:04 localhost caddy[31157]: github.com/caddyserver/caddy/v2/cmd.Main()
    Oct 05 01:11:04 localhost caddy[31157]:         github.com/caddyserver/caddy/[email protected]/cmd/main.go:85 +0x25b
    Oct 05 01:11:04 localhost caddy[31157]: main.main()
    Oct 05 01:11:04 localhost caddy[31157]:         caddy/main.go:14 +0x25
    

    Looks like a race condition, I'll fix this as soon as possible.

Enable requests served by caddy for distributed tracing via The OpenTracing Project.

caddy-opentracing Enable requests served by caddy for distributed tracing via The OpenTracing Project. Dependencies The Go OpenTracing Library Jaeger,

Sep 30, 2022
A Caddy v2 extension to apply rate-limiting for HTTP requests

ratelimit A Caddy v2 extension to apply rate-limiting for HTTP requests. Installation $ xcaddy build --with github.com/owlwang/caddy-ratelimit Caddyfi

Jan 28, 2022
A server that proxies requests and uses fhttp & my fork of CycleTLS to modify your clienthello and prevent your requests from being fingerprinted.

TLS-Fingerprint-API A server that proxies requests and uses my fork of CycleTLS & fhttp (fork of net/http) to prevent your requests from being fingerp

Jan 7, 2023
HTTP rate limiting module for Caddy 2

This module implements both internal and distributed HTTP rate limiting. Requests can be rejected after a specified rate limit is hit.

Jan 3, 2023
IONOS DNS module for caddy

This package contains a DNS provider module for Caddy. It is used to manage DNS records with the IONOS DNS API using libdns-ionos..

Nov 9, 2022
Service Management App for Caddy v2

caddy-systemd Service Management App for Caddy v2. Please ask questions either here or via LinkedIn. I am happy to help you! @greenpau Please see othe

Sep 1, 2022
Watch for interesting patterns in Caddy logs and send a Telegram notification.

Watch for interesting patterns in Caddy logs and send a Telegram notification.

Jul 21, 2022
Access ftp through caddy

Access ftp through caddy

Dec 14, 2022
Caddy log filter module with a log field filter to extract the user from a basic Authorization HTTP-Header

caddy-basic-auth-filter This packages contains a log field filter to extract the user from a basic Authorization HTTP-Header. Installation xcaddy buil

May 10, 2022
netcup DNS module for caddy: dns.providers.netcup

netcup DNS module for Caddy This package contains a DNS provider module for Caddy. It can be used to manage DNS records with the netcup DNS API using

Nov 9, 2022