Skip to content

support for multiple files + modified argparse options#1

Open
0rovan wants to merge 1 commit intosyedaali:masterfrom
0rovan:master
Open

support for multiple files + modified argparse options#1
0rovan wants to merge 1 commit intosyedaali:masterfrom
0rovan:master

Conversation

@0rovan
Copy link
Copy Markdown

@0rovan 0rovan commented Sep 5, 2015

I have added support for input from multiple log files to your script and I'd be happy if you want to pull from me. However you may not like changes to argument parser based mainly on my personal preferences .

Comment thread apacher.py
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readlines() will read the entire file in memory, you can easily overwhelm the memory of a system by doing this. I was using 'for line in file' which reads one line at a time. Thoughts?

@0rovan
Copy link
Copy Markdown
Author

0rovan commented Nov 10, 2015

In practice apache logs are relatively small - https://httpd.apache.org/docs/2.2/logs.html#rotation
If someone wants to do something stupid all it takes then is to craft file with one line long enough to overwhelm memory when readline() function is used.
So, imho, the real solution here would be to read by character with read(1) or check for file size before the file read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants