def mapper(self, _, line): try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid logfile line: {}\n".format(line)) return # See if this is the desired URL if o.wikipage() == "Main_Page": self.lowest.append((o.datetime, line)) self.lowest = sorted(self.lowest)[0:50] # keep just the first 50
def mapper(self, _, line): try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid logfile line: {}\n".format(line)) return # See if this is the desired URL if o.wikipage() == "Main_Page": self.lowest.append((o.datetime, line)) self.lowest = sorted(self.lowest)[0:50] # keep just the first 50
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") if "top1000ips_to_country.txt" in filename: fields = line.split("\t") self.increment_counter("Info","top1000_ips_to_country Count",1) yield fields[0], ("Country", fields[1]) else: log = Weblog(line) logfields = (log.ipaddr,log.datetime,log.url,log.wikipage()) self.increment_counter("Info","weblog Count",1) yield logfields[0], ("Weblog",logfields)
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") if "top1000ips_to_country.txt" in filename: fields = line.split("\t") self.increment_counter("Info","top1000_ips_to_country Count",1) yield fields[0], ("Country", fields[1]) else: log = Weblog(line) logfields = (log.ipaddr,log.datetime,log.url,log.wikipage()) self.increment_counter("Info","weblog Count",1) yield logfields[0], ("Weblog",logfields)
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") if "top1000ips_to_country.txt" in filename: self.increment_counter("Status","top1000_ips_to_country file found",1) try: (ipaddr, country) = line.strip().split("\t") yield ipaddr, "+"+country except ValueError as e: pass else: try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid Logfile line :{}\n".format(line)) return if o.wikipage() == "Main_Page": yield o.ipaddr, line
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") if "top1000ips_to_country.txt" in filename: self.increment_counter("Status", "top1000_ips_to_country file found", 1) try: (ipaddr, country) = line.strip().split("\t") yield ipaddr, "+" + country except ValueError as e: pass else: try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid Logfile line :{}\n".format(line)) return if o.wikipage() == "Main_Page": yield o.ipaddr, line
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") import sys if "top1000ips_to_country.txt" in filename: # Handle as a GeoLite2 file # try: (ipaddr, country) = line.strip().split("\t") yield ipaddr, ("country", country) except ValueError as e: pass else: # Handle as a weblog file try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid logfile line: {}\n".format(line)) return if o.wikipage() == "Main_Page": yield o.ipaddr, ("ip", line)
def mapper(self, _, line): # Is this a weblog file, or a MaxMind GeoLite2 file? filename = mrjob.compat.jobconf_from_env("map.input.file") import sys if "top1000ips_to_country.txt" in filename: # Handle as a GeoLite2 file # try: (ipaddr, country) = line.strip().split("\t") yield ipaddr, ("country", country) except ValueError as e: pass else: # Handle as a weblog file try: o = Weblog(line) except ValueError: sys.stderr.write("Invalid logfile line: {}\n".format(line)) return if o.wikipage() == "Main_Page": yield o.ipaddr,("ip", line)
def mapper(self, _, line): log = Weblog(line) yield log.wikipage(), 1
def mapper(self, _, line): filename = mrjob.compat.jobconf_from_env("map.input.file") log = Weblog(line) yield (log.wikipage(),1)
def mapper(self, _, line): log = Weblog(line) yield log.wikipage(), 1