Skip to content

Commit

Permalink
Add README.md for dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamloe committed Nov 6, 2024
1 parent 4711174 commit 82f26a4
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/apis/dockerhub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# DockerHub API Configuration
The `dockerhub` API type is used to fetch audit logs from DockerHub. It supports pagination and allows filtering logs based on a date range.

## Configuration
| Parameter Name | Description | Required/Optional | Default |
|--------------------|-------------------------------------------------------------------------------------------|-------------------|-------------------|
| name | Name of the API (custom name) | Optional | the defined `url` |
| dockerhub_user | DockerHub username | Required | - |
| dockerhub_token | DockerHub personal access token or password | Required | - |
| url | The request URL | Required | - |
| next_url | URL for the next page of results (used for pagination) | Optional | - |
| method | The request method (`GET` or `POST`) | Optional | `GET` |
| days_back_fetch | The amount of days to fetch back in the first request. Adds a filter on `from` parameter. | Optional | 1 |
| scrape_interval | Time interval to wait between runs (unit: `minutes`) | Optional | 1 (minute) |
| additional_fields | Additional custom fields to add to the logs before sending to logzio | Optional | - |

## Example
You can customize the endpoints to collect data from by adding extra API configurations under `apis`. DockerHub API Docs can be found [here](https://docs.docker.com/docker-hub/api/latest/).

Example configuration:

```yaml
apis:
- name: Dockerhub audit logs
type: dockerhub
dockerhub_token: <<docker_hub_password>>
dockerhub_user: <<docker_hub_username>>
url: https://hub.docker.com/v2/auditlogs/<<dockerhub_account>>
next_url: https://hub.docker.com/v2/auditlogs/logzio?from={res.logs.[0].timestamp}
method: GET
days_back_fetch: 7
scrape_interval: 1
additional_fields:
type: dockerhub-audit
eventType: auditevents

logzio:
url: https://<<LISTENER-HOST>>:8071
token: <<LOG-SHIPPING-TOKEN>>
```

0 comments on commit 82f26a4

Please sign in to comment.