{"id":27998366,"url":"https://github.com/alphagov/paas-log-cache-adapter","last_synced_at":"2025-05-08T22:52:52.083Z","repository":{"id":57568210,"uuid":"136600921","full_name":"alphagov/paas-log-cache-adapter","owner":"alphagov","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-07T14:19:50.000Z","size":4181,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-08T22:52:47.486Z","etag":null,"topics":["cloud-foundry","metrics-exporter","paas","prometheus","reliability-engineering"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alphagov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-08T09:53:59.000Z","updated_at":"2022-04-07T14:17:29.000Z","dependencies_parsed_at":"2022-08-28T10:01:52.278Z","dependency_job_id":null,"html_url":"https://github.com/alphagov/paas-log-cache-adapter","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphagov%2Fpaas-log-cache-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphagov%2Fpaas-log-cache-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphagov%2Fpaas-log-cache-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alphagov%2Fpaas-log-cache-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alphagov","download_url":"https://codeload.github.com/alphagov/paas-log-cache-adapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160826,"owners_count":21863624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-foundry","metrics-exporter","paas","prometheus","reliability-engineering"],"created_at":"2025-05-08T22:52:51.317Z","updated_at":"2025-05-08T22:52:52.073Z","avatar_url":"https://github.com/alphagov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOV.UK PaaS LogCacheAdapter\n\nApplication for collecting metrics from GOV.UK PaaS via log-cache in the following formats:\n\n- Prometheus text format\n\n## How to run\n\nThis application requires the `log-cache` API URL to be provided.\nIt can be passed in as `LOG_CACHE_API` environment variable or as\n`-log-cache-api` / `-a` flag.\n\n```\nmake run\n# or\ngo run main.go handlers.go middleware.go server.go utils.go # make sure to list all files\n```\n\n### Available flags\n\n| Environment Variable | Flag | Description | Default |\n|---|---|---|---|\n| `LOG_CACHE_API` | `-log-cache-api`, `-a` | Required. The log-cache API URL. | `N/A` |\n| `PORT` | `-port`, `-p` | The port server should be running on. | `\"8080\"` |\n| `DEBUG` | `-verbose`, `-v` | Run the server in debugging mode. | `\"false\"`\n\n## Testing\n\nTo run test, simply execute the following command:\n\n```sh\nmake test\n```\n\nIf you run into problems with go test caching, set the enviornment variable\n`GOCACHE=off`.\n\n## API\n\nThe application exposes single endpoint, `/metrics` - root. It requires two\nheaders to be provided, in order for it to work as expected. These are:\n\n### `Accept` header\n\nWhich tells the application at what format would you like to receive the logs.\nCurrently only one formats is recognised:\n\n- Prometheus: `text/plain`\n\n### `Authorization` header\n\nIn format of:\n\n```\nbearer ${JWT_WEB_TOKEN}\n```\n\nWhich tells the application, what metrics should you have access to.\n\nIt can work to your advantage, if you create an user with restricted access, to\ntarget only the applications and instances you want.\n\nFor instance, you can obtain that token with the use of CLI command:\n\n```sh\ncf oauth-token\n```\n\n### Example\n\nIf you put everything together and execute the following curl command:\n\n```sh\ncurl -H \"Accept: text/plain\" -H \"Authorization: $(cf oauth-token)\" http://localhost:8080/\n```\n\nYou should retreive the Prometheus text of different metrics your user has\naccess to.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphagov%2Fpaas-log-cache-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falphagov%2Fpaas-log-cache-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falphagov%2Fpaas-log-cache-adapter/lists"}