Skip to content

Commit b658ec8

Browse files
Merge pull request #405 from splunk/develop
Release 7.1.1
2 parents 2d4adf7 + ab11743 commit b658ec8

107 files changed

Lines changed: 7942 additions & 3619 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,30 @@ version: 2
66
jobs:
77
test_eventgen:
88
machine:
9-
image: circleci/classic:latest
9+
image: circleci/classic:201808-01
1010
steps:
1111
- checkout
1212
- run:
13-
name: Install Dependencies
13+
name: Enable Py3
1414
command: |
15-
pip install --upgrade pip && pip install -r requirements.txt
15+
pyenv global 3.7.0
16+
- run:
17+
name: Run Flake8 Code Lint
18+
command: |
19+
set -e
20+
pip install "flake8>=3.7.7"
21+
make lint-all
22+
- run:
23+
name: Check Code Format
24+
command: |
25+
set -e
26+
pip install "black==19.10b0" "isort>=4.3.15"
27+
make format-check
1628
- run:
1729
name: Run Tests
1830
command: |
31+
pip3 install --upgrade pip
32+
pip3 install poetry
1933
set -e
2034
make test
2135
no_output_timeout: 30m
@@ -31,4 +45,3 @@ workflows:
3145
run_tests:
3246
jobs:
3347
- test_eventgen
34-

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
exclude = .git,.tox,__pycache__,env,venv,build
3+
max-line-length = 120
4+
extend-ignore = E203,E121,E123,E126,E226,E24,E704,W503,W504,E722,E731,W605
5+
# Includes default ignores, E722 (bare excepts), E731 (lambda usage), and W605 (escape sequences)

.yapfignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

Makefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ LARGE ?= 'tests/large'
1212
XLARGE ?= 'tests/xlarge'
1313
NEWLY_ADDED_PY_FILES = $(shell git ls-files -o --exclude-standard | grep -E '\.py$$')
1414
CHANGED_ADDED_PY_FILES = $(shell git ls-files -mo --exclude-standard | grep -E '\.py$$')
15+
ALL_PY_FILES = $(shell git ls-files tests splunk_eventgen | grep -E '\.py$$')
1516

1617
.PHONY: tests, lint, format, docs
1718

1819
all: egg
1920

2021
egg: clean
21-
python setup.py sdist
22+
poetry build
2223

2324
image: setup_eventgen egg
2425
rm splunk_eventgen/default/eventgen_engine.conf || true
@@ -41,15 +42,15 @@ test_helper:
4142
@echo 'Verifying contents of pip.conf'
4243
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "cd $(shell pwd); pip3 install dist/splunk_eventgen*.tar.gz"
4344

44-
@echo 'Installing test requirements'
45-
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "pip3 install --upgrade pip;pip3 install -r $(shell pwd)/requirements.txt;pip3 install git+https://github.com/esnme/ultrajson.git"
45+
@echo 'Installing test dependencies'
46+
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "pip3 install poetry;poetry config virtualenvs.create false;poetry install --no-root"
4647

4748
@echo 'Make simulated app dir and sample for modular input test'
4849
docker exec -i ${EVENTGEN_TEST_IMAGE} /bin/sh -c "cd $(shell pwd); cd ../..; mkdir -p modinput_test_app/samples/"
4950
docker cp tests/large/sample/film.json ${EVENTGEN_TEST_IMAGE}:$(shell pwd)/../../modinput_test_app/samples
5051

5152
@echo 'Installing docker-compose'
52-
bash install_docker_compose.sh
53+
bash tests/large/provision/install_docker_compose.sh
5354

5455
@echo 'Build a docker image'
5556
docker build -t provision_splunk:latest -f tests/large/provision/Dockerfile tests/large/provision
@@ -123,14 +124,15 @@ run_standalone:
123124
docker run --name eg_standalone -d -p 9500:9500 eventgen:latest standalone
124125

125126
run_local_standalone:
126-
python -m splunk_eventgen service -r standalone
127+
python3 -m splunk_eventgen service -r standalone
127128

128129
docs:
129130
cd docs/; bundle install; bundle exec jekyll serve
130131

131132
build_spl: clean
132133
python3 -m splunk_eventgen build --destination ./
133134

135+
134136
lint:
135137
ifeq ($(NEWLY_ADDED_PY_FILES), )
136138
@echo 'No newly added python files. Skip...'
@@ -148,12 +150,18 @@ endif
148150
ifeq ($(NEWLY_ADDED_PY_FILES), )
149151
@echo 'No newly added python files. Skip...'
150152
else
151-
@yapf -i $(NEWLY_ADDED_PY_FILES)
153+
@black -t py37 $(NEWLY_ADDED_PY_FILES)
152154
endif
153155

154156
lint-all:
155-
@flake8 .
157+
@echo "lint all py files"
158+
@flake8 $(ALL_PY_FILES)
159+
160+
format-check:
161+
@echo 'Checking all py files code format'
162+
@black --check -t py37 .
156163

157164
format-all:
158-
@isort -rc .
159-
@yapf -r -i .
165+
@echo "format all py files"
166+
@isort -rc $(ALL_PY_FILES)
167+
@black -t py37 $(ALL_PY_FILES)

dockerfiles/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ RUN apk --no-cache upgrade && \
2828
mkdir -p /root/.ssh && \
2929
chmod 0700 /root/.ssh && \
3030
passwd -u root && \
31-
# install dependencies of conduct2 used by perf
32-
pip2 install filelock twisted requests queuelib ujson psutil crochet msgpack-python unidecode attrdict service_identity && \
33-
pip2 install git+https://github.com/esnme/ultrajson.git
31+
# install dependencies of conductor2 used by perf
32+
pip2 install filelock twisted requests queuelib psutil crochet msgpack-python unidecode attrdict service_identity && \
33+
pip2 install git+https://github.com/esnme/ultrajson.git@v1.35
3434

3535
COPY dockerfiles/sshd_config /etc/ssh/sshd_config
3636
COPY dockerfiles/entrypoint.sh /sbin/entrypoint.sh
37-
COPY dist/* /root/splunk_eventgen.tgz
37+
COPY dist/splunk_eventgen*.tar.gz /root/splunk_eventgen.tgz
3838
RUN pip3 install /root/splunk_eventgen.tgz && \
3939
rm /root/splunk_eventgen.tgz
40+
COPY pyproject.toml /usr/lib/python3.7/site-packages/splunk_eventgen/pyproject.toml
41+
COPY poetry.lock /usr/lib/python3.7/site-packages/splunk_eventgen/poetry.lock
4042

4143
EXPOSE 2222 6379 9500
4244
RUN chmod a+x /sbin/entrypoint.sh

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**7.1.1**:
2+
3+
- Check the release note and download the package/source from [Here](https://github.com/splunk/eventgen/releases/tag/7.1.1)
4+
15
**7.1.0**:
26

37
- Check the release note and download the package/source from [Here](https://github.com/splunk/eventgen/releases/tag/7.1.0)

docs/CONFIGURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ specifically be supported by all plugins. Plugins that write to files like spool
374374

375375
source = <source>
376376
* Valid with outputMode=modinput (default) & outputMode=splunkstream & outputMode=httpevent
377-
* Set event source in Splunk to <source>. Defaults to 'eventgen' if none specified.
377+
* Set event source in Splunk to <source>. Defaults to sample file name if none specified.
378378

379379
sourcetype = <sourcetype>
380380
* Valid with outputMode=modinput (default) & outputMode=splunkstream & outputMode=httpevent

docs/REFERENCE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ fileBackupFiles = 5
4444
splunkPort = 8089
4545
splunkMethod = https
4646
index = main
47-
source = eventgen
4847
sourcetype = eventgen
4948
host = 127.0.0.1
5049
outputWorkers = 1
@@ -265,7 +264,7 @@ extendIndexes = <index_prefix>:<weight>,<index2>,<index3>
265264
source = <source>
266265
* Valid with the following outputMode:
267266
outputMode=modinput (default) & outputMode=splunkstream & outputMode=httpevent
268-
* Set event source in Splunk to <source>. Defaults to 'eventgen' if none specified.
267+
* Set event source in Splunk to <source>. Defaults to sample file name if none specified.
269268
270269
sourcetype = <sourcetype>
271270
* Valid with the following outputMode:

docs/SETUP.md

Lines changed: 74 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,64 @@
11
## Install
22

3+
For upgrading eventgen, please refer to [this doc](UPGRADE.md).
4+
35
There are multiple ways to use Eventgen, and you should choose the method that best fits your use case.
46
Below are the two major ways to use Eventgen - as a PyPI module and as a Splunk App. Follow the instructions below depending on your ideal use:
57

6-
* Install / Use Eventgen as a [Splunk App](#splunk-app-installation)
8+
1. Install / Use Eventgen as a [Splunk App](#splunk-app-installation)
9+
10+
> :heavy_exclamation_mark: Starting from 7.0.0 release, Eventgen only supports python3, which means SA-eventgen can only work with Splunk enterprise 8.x and later release.
711
812
Benefits:
9-
* Easy To Install
10-
* Works with TA's downloaded direclty from SplunkBase
11-
* Uses a modular input for controlling the main Eventgen process
12-
* Reads configurations out of Splunk Rest
13-
* Supports apps default / local directories
14-
15-
Draw Backs:
16-
* Limited to a single process
17-
* Can't scale to large datasets
18-
* Easily can fall behind on processing large quantities of eventgen.conf files
19-
* Doesn't install the jinja templating system automatically
20-
* No support for python multi-threading / processing
21-
22-
* Install / Use Eventgen as a [Python (PyPI) package](#pypi-installation)
23-
24-
Benefits:
25-
* Support for threading / multiprocessing
26-
* Support for a centralized service that can controll and run multiple threading workers
27-
* Able to run a larger amount of datavolume with less overhead
28-
* Allows an Eventgen object to be embeded and controlled using python code
29-
* Exposes more of the plugin system
30-
* Includes/installs the Jinja2 templating engine
31-
32-
Drawbacks:
33-
* More complex installation
34-
* You have to run the `build` command to produce a Splunk app
35-
* Harder to troubleshoot (especially in multiprocess mode)
13+
* Easy To Install
14+
* Works with TA's downloaded direclty from SplunkBase
15+
* Uses a modular input for controlling the main Eventgen process
16+
* Reads configurations out of Splunk Rest
17+
* Supports apps default / local directories
18+
19+
Draw Backs:
20+
* Limited to a single process
21+
* Can't scale to large datasets
22+
* Easily can fall behind on processing large quantities of eventgen.conf files
23+
* Doesn't install the jinja templating system automatically
24+
* No support for python multi-threading / processing
25+
26+
27+
1. Install / Use Eventgen as a [Python (PyPI) package](#pypi-installation)
28+
29+
Benefits:
30+
* Support for threading / multiprocessing
31+
* Support for a centralized service that can controll and run multiple threading workers
32+
* Able to run a larger amount of datavolume with less overhead
33+
* Allows an Eventgen object to be embeded and controlled using python code
34+
* Exposes more of the plugin system
35+
* Includes/installs the Jinja2 templating engine
36+
37+
Drawbacks:
38+
* More complex installation
39+
* You have to run the `build` command to produce a Splunk app
40+
* Harder to troubleshoot (especially in multiprocess mode)
3641

3742
---
3843

3944
<a id="pypi-installation"></a>
40-
## PyPI Installation / First Run
45+
### PyPI Installation / First Run
46+
47+
> :heavy_exclamation_mark: Starting from 7.0.0 release, Eventgen only supports python3.
48+
49+
To use Eventgen as a PyPI module, you need to either download/clone the source code or install direct from github.
50+
51+
#### Prerequisite
52+
53+
1. Install git.
54+
1. Install python3 before building Eventgen>=7.0.0.
55+
1. Install python2 before building Eventgen<7.0.0.
4156

42-
To use Eventgen as a PyPI module, you need to either download/clone the source code or install direct from github.
57+
>:information_source: You can download the python3 installation package [here](https://www.python.org/downloads/).
4358
44-
###### Download Sourcecode
59+
#### PiPI Installation
60+
61+
##### Download Eventgen Sourcecode
4562
```
4663
$ git clone https://www.github.com/splunk/eventgen
4764
```
@@ -54,37 +71,48 @@ $ git branch -a
5471
remotes/origin/HEAD -> origin/develop
5572
remotes/origin/develop
5673
remotes/origin/master
57-
74+
5875
$ git checkout remotes/origin/master
5976
Note: checking out 'remotes/origin/master'.
6077
6178
$ git pull
6279
```
80+
Eventgen uses [Poetry](https://github.com/python-poetry/poetry) to manage and build. Install `Poetry` first:
81+
```
82+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
83+
84+
```
85+
Or you can use `pip` to install `poetry`(this is not recommended which might cause conflicts):
86+
```
87+
pip install --user poetry
88+
```
6389

6490
Then run below commands inside Eventgen directory:
6591
```
66-
$ python setup.py sdist
92+
$ poetry build
6793
6894
# you should see a tar file inside of dist directory
95+
# the <version> is a token to represent current version of Eventgen, for example, 7.1.0
6996
$ ls dist
70-
splunk_eventgen-6.x.x.tar.gz
97+
splunk_eventgen-<version>.tar.gz
7198
72-
$ pip install splunk_eventgen-6.x.x.tar.gz
99+
$ pip install splunk_eventgen-<version>.tar.gz
73100
74101
```
75-
###### Install Direct From GitHub
102+
##### Install Direct From GitHub
76103
To install Eventgen direct from github, use the following pip syntax:
77104

78105
```
79106
$ pip install git+https://www.github.com/splunk/eventgen.git
80107
```
81108

82-
###### Verify Installation
109+
##### Verify Installation
83110

84111
After completing either of the above install methods, you can verify seccussful installation by checking the packaged Eventgen version.
85112
```
113+
# the <version> is a token to represent current version of Eventgen, for example, 7.1.0
86114
$ splunk_eventgen --version
87-
Eventgen 6.x.x
115+
Eventgen <version>
88116
```
89117
Now you are ready to use Eventgen as a pip module.
90118

@@ -115,13 +143,13 @@ Please follow these instructions to run an Eventgen cluster on your Docker envir
115143
---
116144

117145
<a id="splunk-app-installation"></a>
118-
## Splunk App Installation / First Run
146+
### Splunk App Installation / First Run
119147

120148
To use Eventgen as a Splunk app, you need a SPL file. This SPL file can be obtained in one of two ways:
121149
1. Through running the `build` process of the splunk_eventgen pypi module
122150
2. Downloading the SPL direct from [splunkbase](https://splunkbase.splunk.com/app/1924/)
123151

124-
###### Gerating the SPL file
152+
#### Gerating the SPL file
125153
In order to generate the SPL file, install Eventgen through PyPI with the instruction above.
126154
Once you have Eventgen installed, run:
127155

@@ -130,14 +158,17 @@ Once you have Eventgen installed, run:
130158
$ splunk_eventgen build --destination <DESIRED_PATH_TO_OUTPUT_SPL_FILE>
131159
```
132160

133-
###### Finishing the Install
161+
#### Finishing the Install
162+
163+
>:warning: For upgrading SA-eventgen from 6.x to 7.x, please refer to [this guide](UPGRADE.md#sa-app-upgrade-to-7).
164+
134165
With the generated / downloaded SPL file, follow these steps to install:
135166
1. Log in to Splunk Web and navigate to Apps > Manage Apps.
136167
2. Click "Install app from file".
137168
3. Navigate to the path where your local SPL file is and select.
138169
4. Restart Splunk after you have been notified of a successful installation.
139170

140-
Before you start Eventgen, confirm that you have successfully installed SA-Eventgen:
171+
Before you start Eventgen, confirm that you have successfully installed SA-Eventgen:
141172

142173
You should see SA-Eventgen App in SplunkWeb.
143174
![Local Image](./images/splunk_web_sa_eventgen.png)
@@ -150,7 +181,7 @@ Additionally, you'll see SA-Eventgen in your Splunk apps installation directory:
150181
$ cd ${SPLUNK_HOME}/etc/apps
151182
```
152183

153-
### First Run
184+
#### First Run
154185
If SA-Eventgen App is correctly installed, there is no additional configuration required. SA-Eventgen app will automatically identify with any apps with eventgen.conf.
155186

156187
To start generating data, simply enable the SA-Eventgen modinput by going to Settings > Data Inputs > SA-Eventgen and by clicking "enable" on the default modular input stanza.

0 commit comments

Comments
 (0)