diff --git a/iwla.py b/iwla.py index befe36d..7a43ceb 100755 --- a/iwla.py +++ b/iwla.py @@ -124,6 +124,7 @@ class IWLA(object): self.http_request_extracted = re.compile(r'(?P\S+) (?P\S+) (?P\S+)') self.log_re = re.compile(self.log_format_extracted) self.uri_re = re.compile(r'(?P[^\?]+)(\?(?P.+))?') + self.domain_name_re = re.compile(r'.*%s' % conf.domain_name) self.plugins = [(conf.PRE_HOOK_DIRECTORY , conf.pre_analysis_hooks), (conf.POST_HOOK_DIRECTORY , conf.post_analysis_hooks), (conf.DISPLAY_HOOK_DIRECTORY , conf.display_hooks)] @@ -582,6 +583,9 @@ class IWLA(object): self.current_analysis['days_stats'][cur_time.tm_mday] = stats def _newHit(self, hit): + if not self.domain_name_re.match(hit['server_name']): + return False + t = self._decodeTime(hit) cur_time = self.meta_infos['last_time'] @@ -609,7 +613,7 @@ class IWLA(object): for k in hit.keys(): if hit[k] == '-' or hit[k] == '*': hit[k] = '' - + self._appendHit(hit) return True @@ -637,8 +641,7 @@ class IWLA(object): groups = self.log_re.match(l) if groups: - if not self._newHit(groups.groupdict()): - continue + self._newHit(groups.groupdict()) else: self.logger.warning("No match for %s" % (l)) #break