Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3.7 as buildenv

ADD apache-fake-log-gen.py /apache-fake-log-gen.py

RUN apk add --update --no-cache python py-numpy py-tz py-pip && \
pip install fake-factory==0.7.2 && \
pip install Faker==0.7.3 && \
pip install tzlocal==1.3.0 && \
apk del py-pip && \
chmod 0755 /apache-fake-log-gen.py

USER nobody

ENV NUM_LINES=0 DELAY_SECONDS=1.0

CMD ["/bin/sh","-c","/apache-fake-log-gen.py --num ${NUM_LINES} --sleep ${DELAY_SECONDS}"]
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $ python apache-fake-log-gen.py

Generate 100 log lines into a .log file
```
$ python apache-fake-log-gen.py -n 100 -o LOG
$ python apache-fake-log-gen.py -n 100 -o LOG
```

Generate 100 log lines into a .gz file at intervals of 10 seconds
Expand All @@ -27,10 +27,10 @@ $ python apache-fake-log-gen.py -n 100 -o GZ -s 10

Infinite log file generation (useful for testing File Tail Readers)
```
$ python apache-fake-log-gen.py -n 0 -o LOG
$ python apache-fake-log-gen.py -n 0 -o LOG
```

Prefix the output filename
Prefix the output filename
```
$ python apache-fake-log-gen.py -n 100 -o LOG -p WEB1
```
Expand Down Expand Up @@ -62,5 +62,16 @@ optional arguments:
* Python 2.7
* ```pip install -r requirements.txt```

## Docker Usage

```
docker run -it kununu/Fake-Apache-Log-Generator
```

Environment variables:

* NUM_LINES number of lines to print before terminate (default: 0 - infinite)
* DELAY_SECONDS delay between lines (default: 1.0 seconds)

## License
This script is released under the [Apache version 2](LICENSE) license.