Skip to content

Commit

Permalink
ignore google bot access to apache
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Sep 21, 2016
1 parent b2d67c0 commit db34c70
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion es_cmsrep_apache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
from es_utils import send_payload
from hashlib import sha1
from json import dumps
from logwatch import logwatch, run_cmd
from logwatch import logwatch, run_cmd, LOGWATCH_APACHE_IGNORE_AGENTS

def process (line, count):
for agent in LOGWATCH_APACHE_IGNORE_AGENTS:
if argent in line: return True
payload = {}
items = line.split(" ")
if len(items)<12: return True
Expand Down
4 changes: 3 additions & 1 deletion es_cmssdt_apache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from es_utils import send_payload
from hashlib import sha1
from json import dumps
from logwatch import logwatch, run_cmd
from logwatch import logwatch, run_cmd, LOGWATCH_APACHE_IGNORE_AGENTS

def process (line, count):
for agent in LOGWATCH_APACHE_IGNORE_AGENTS:
if argent in line: return True
payload = {}
items = line.split(" ")
if len(items)<10: return True
Expand Down
4 changes: 3 additions & 1 deletion es_doxygen_apache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from es_utils import send_payload
from hashlib import sha1
from json import dumps
from logwatch import logwatch, run_cmd
from logwatch import logwatch, run_cmd, LOGWATCH_APACHE_IGNORE_AGENTS

def process (line, count):
for agent in LOGWATCH_APACHE_IGNORE_AGENTS:
if argent in line: return True
payload = {}
items = line.split(" ")
if len(items)<10: return True
Expand Down
2 changes: 2 additions & 0 deletions logwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from commands import getstatusoutput
from hashlib import sha256

LOGWATCH_APACHE_IGNORE_AGENTS = ["www.google.com/bot.html", "ahrefs.com/robot", "yandex.com/bots"]

def run_cmd (cmd, exit_on_error=True):
err, out = getstatusoutput (cmd)
if err and exit_on_error:
Expand Down

0 comments on commit db34c70

Please sign in to comment.