Skip to content

Commit 28f2374

Browse files
committed
removing need for Makefile to install elasticsearch dependencies
- installing via setuptools can now handle installing elasticsearch dependencies (v1 or v6) - updating docs to reflect how to install via this method
1 parent 5876640 commit 28f2374

File tree

6 files changed

+20
-57
lines changed

6 files changed

+20
-57
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ htmlcov/
88
config.yaml
99
account-data/
1010
my_account_iam.json
11-
requirements-dev.es[0-9].txt
12-
requirements.es[0-9].txt

Makefile

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

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ python3 -m venv ./venv && source venv/bin/activate
1515
pip install git+https://github.com/duo-labs/cloudtracker.git#egg=cloudtracker
1616
```
1717

18+
Note: To install with ElasticSearch support, see the [ElasticSearch docs](docs/elasticsearch.md).
19+
1820
### Step 2: Download your IAM data
1921
Download a copy of the IAM data of an account using the AWS CLI:
2022

cloudtracker/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,16 @@ def run(args, config, start, end):
402402
account = get_account(config['accounts'], args.account)
403403

404404
if 'elasticsearch' in config:
405-
from cloudtracker.datasources.es import ElasticSearch
405+
try:
406+
from cloudtracker.datasources.es import ElasticSearch
407+
except ImportError:
408+
exit(
409+
"Elasticsearch support not installed. Install with support via "
410+
"'pip install git+https://github.com/duo-labs/cloudtracker.git#egg=cloudtracker[es1]' for "
411+
"elasticsearch 1 support, or "
412+
"'pip install git+https://github.com/duo-labs/cloudtracker.git#egg=cloudtracker[es6]' for "
413+
"elasticsearch 6 support"
414+
)
406415
datasource = ElasticSearch(config['elasticsearch'], start, end)
407416
else:
408417
logging.debug("Using Athena")

docs/elasticsearch.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Requirements
55
* CloudTrail logs must be loaded into ElasticSearch. For instructions on setting up ElasticSearch and ingesting an archive of CloudTrail logs into it see below.
66
* ElasticSearch 6.x is supported, but there are reports of ElasticSearch 1.x being used successfully.
77

8-
9-
108
Installation
119
============
1210

@@ -15,16 +13,15 @@ Install the Python libraries using one of the provided Makefile targets:
1513

1614
For elasticsearch v6.x:
1715
```
18-
make dev_elasticsearchv6
19-
source venv/bin/activate
16+
python3 -m venv ./venv && source venv/bin/activate
17+
pip install git+https://github.com/duo-labs/cloudtracker.git#egg=cloudtracker[es6]
2018
```
2119

2220
For older versions, such as elasticsearch v1.x:
2321
```
24-
make dev_elasticsearchv1
25-
source venv/bin/activate
22+
python3 -m venv ./venv && source venv/bin/activate
23+
pip install git+https://github.com/duo-labs/cloudtracker.git#egg=cloudtracker[es1]
2624
```
27-
The target will create a virtualenv in `./venv` and pip install the relevant requirements.
2825

2926
### Step 2
3027
Get the IAM data of the account
@@ -188,7 +185,7 @@ cmake -DCMAKE_BUILD_TYPE=release -DEXT_aws=off -DEXT_kafka=off -DEXT_parquet=off
188185
make
189186
make packages
190187
sudo make install
191-
# In my experience I needed to manually install files, or copy or link them, as you should have files named
188+
# In my experience I needed to manually install files, or copy or link them, as you should have files named
192189
# `rjson.so` and `ltn12.lua` at `/usr/local/lib/luasandbox/io_modules/`.
193190
```
194191

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def get_version():
3434
test_suite='tests/unit',
3535
tests_require=TESTS_REQUIRE,
3636
extras_require={
37-
'dev': TESTS_REQUIRE + ['autoflake', 'autopep8', 'pylint']
37+
'dev': TESTS_REQUIRE + ['autoflake', 'autopep8', 'pylint'],
38+
'es1': ['elasticsearch==1.9.0', 'elasticsearch_dsl==0.0.11'],
39+
'es6': ['elasticsearch==6.1.1', 'elasticsearch_dsl==6.1.0']
3840
},
3941
install_requires=[
4042
'ansicolors==1.1.8',
4143
'boto3==1.5.32',
42-
'elasticsearch==6.1.1',
43-
'elasticsearch_dsl==6.1.0',
4444
'jmespath==0.9.3',
4545
'pyyaml==3.12'
4646
],

0 commit comments

Comments
 (0)