2016-10-11 13:06:33 +00:00
|
|
|
# Logs Generator
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
Logs generator is a tool to create predictable load on the logs delivery system.
|
2019-02-11 03:38:25 +00:00
|
|
|
It generates random lines with predictable format and predictable average length.
|
2016-10-11 13:06:33 +00:00
|
|
|
Each line can be later uniquely identified to ensure logs delivery.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Tool is parametrized with the total number of number that should be generated and the duration of
|
|
|
|
the generation process. For example, if you want to create a throughput of 100 lines per second
|
|
|
|
for a minute, you set total number of lines to 6000 and duration to 1 minute.
|
|
|
|
|
2019-02-22 01:43:51 +00:00
|
|
|
Parameters are passed through environment variables. There are no defaults, you should always
|
2016-10-11 13:06:33 +00:00
|
|
|
set up container parameters. Total number of line is parametrized through env variable
|
|
|
|
`LOGS_GENERATOR_LINES_TOTAL` and duration in go format is parametrized through env variable
|
|
|
|
`LOGS_GENERATOR_DURATION`.
|
|
|
|
|
|
|
|
Inside the container all log lines are written to the stdout.
|
|
|
|
|
|
|
|
Each line is on average 100 bytes long and follows this pattern:
|
|
|
|
|
|
|
|
```
|
|
|
|
2000-12-31T12:59:59Z <id> <method> /api/v1/namespaces/<namespace>/endpoints/<random_string> <random_number>
|
|
|
|
```
|
|
|
|
|
|
|
|
Where `<id>` refers to the number from 0 to `total_lines - 1`, which is unique for each
|
|
|
|
line in a given run of the container.
|
|
|
|
|
|
|
|
## Image
|
|
|
|
|
|
|
|
Image is located in the public repository of Google Container Registry under the name
|
|
|
|
|
|
|
|
```
|
Switch to k8s.gcr.io vanity domain
This is the 2nd attempt. The previous was reverted while we figured out
the regional mirrors (oops).
New plan: k8s.gcr.io is a read-only facade that auto-detects your source
region (us, eu, or asia for now) and pulls from the closest. To publish
an image, push k8s-staging.gcr.io and it will be synced to the regionals
automatically (similar to today). For now the staging is an alias to
gcr.io/google_containers (the legacy URL).
When we move off of google-owned projects (working on it), then we just
do a one-time sync, and change the google-internal config, and nobody
outside should notice.
We can, in parallel, change the auto-sync into a manual sync - send a PR
to "promote" something from staging, and a bot activates it. Nice and
visible, easy to keep track of.
2018-01-17 19:36:53 +00:00
|
|
|
k8s.gcr.io/logs-generator:v0.1.1
|
2016-10-11 13:06:33 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run -i \
|
|
|
|
-e "LOGS_GENERATOR_LINES_TOTAL=10" \
|
|
|
|
-e "LOGS_GENERATOR_DURATION=1s" \
|
Switch to k8s.gcr.io vanity domain
This is the 2nd attempt. The previous was reverted while we figured out
the regional mirrors (oops).
New plan: k8s.gcr.io is a read-only facade that auto-detects your source
region (us, eu, or asia for now) and pulls from the closest. To publish
an image, push k8s-staging.gcr.io and it will be synced to the regionals
automatically (similar to today). For now the staging is an alias to
gcr.io/google_containers (the legacy URL).
When we move off of google-owned projects (working on it), then we just
do a one-time sync, and change the google-internal config, and nobody
outside should notice.
We can, in parallel, change the auto-sync into a manual sync - send a PR
to "promote" something from staging, and a bot activates it. Nice and
visible, easy to keep track of.
2018-01-17 19:36:53 +00:00
|
|
|
k8s.gcr.io/logs-generator:v0.1.1
|
2016-10-11 13:06:33 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
kubectl run logs-generator \
|
|
|
|
--generator=run-pod/v1 \
|
Switch to k8s.gcr.io vanity domain
This is the 2nd attempt. The previous was reverted while we figured out
the regional mirrors (oops).
New plan: k8s.gcr.io is a read-only facade that auto-detects your source
region (us, eu, or asia for now) and pulls from the closest. To publish
an image, push k8s-staging.gcr.io and it will be synced to the regionals
automatically (similar to today). For now the staging is an alias to
gcr.io/google_containers (the legacy URL).
When we move off of google-owned projects (working on it), then we just
do a one-time sync, and change the google-internal config, and nobody
outside should notice.
We can, in parallel, change the auto-sync into a manual sync - send a PR
to "promote" something from staging, and a bot activates it. Nice and
visible, easy to keep track of.
2018-01-17 19:36:53 +00:00
|
|
|
--image=k8s.gcr.io/logs-generator:v0.1.1 \
|
2016-10-11 13:06:33 +00:00
|
|
|
--restart=Never \
|
|
|
|
--env "LOGS_GENERATOR_LINES_TOTAL=1000" \
|
|
|
|
--env "LOGS_GENERATOR_DURATION=1m"
|
|
|
|
```
|
|
|
|
|
2017-01-11 23:07:04 +00:00
|
|
|
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/test/images/logs-generator/README.md?pixel)]()
|