https://github.com/cca/egress-estimate
https://github.com/cca/egress-estimate
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/cca/egress-estimate
- Owner: cca
- License: other
- Created: 2023-07-14T21:05:12.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-14T21:05:47.000Z (about 3 years ago)
- Last Synced: 2025-02-03T12:35:18.724Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Apache Egress Estimate
Compile the "sent bytes" data from Apache logs to estimate the amount of egress from a locally hosted application.
Note that sent bytes does not include HTTP headers so these figures will undercount by at least that much. Headers are trivial relative to most file sizes but web apps involve _a lot_ of requests with little to no content (think: non-2XX responses, like 302 redirects) where the headers become a factor.
## Usage
Requires `pipenv` and a modern python. Download apache logs into the data dir. You will probably need to `tar czf` the logs and do some permissions changes. Look for the `LogFormat` directive in Apache configuration and make sure the `LogParser` call at the top of the script matches it so we know where to pull the date and bytes sent figures from. The script accepts any number of logs as positional arguments.
```sh
# setup project & run
pipenv install
pipenv run ./egress.py data/*
```
## Notes
CLI progress bar
https://pypi.org/project/progress/
Parallel processing
https://docs.python.org/3/library/multiprocessing.html
See sections on Manager and Pool.
Apace `LogFormat` directive:
https://httpd.apache.org/docs/2.4/logs.html
## LICENSE
[ECL Version 2.0](https://opensource.org/licenses/ECL-2.0)