Beispiel #1
0
    def handle(self, *args, **options):
        log_dir = options['log_dir'][0]
        logs = Parse(log_dir)
        entries = logs.parse()

        for entry in entries:
            Entry.objects.get_or_create(
                real_ip=entry["real_ip"],
                time=entry["time"],
                request=entry["request"],
                page=entry["page"],
                status=entry["status"],
                bytes_sent=entry["bytes_sent"],
                referer=entry["referer"],
                user_agent=entry["user_agent"],
                mobile=entry["mobile"]
            )
Beispiel #2
0
    def test_entry_parse_script(self):
        log_dir = "/Users/dave/Downloads/log"
        logs = Parse(log_dir)
        entries = logs.parse()

        for entry in entries:
            Entry.objects.get_or_create(
                real_ip=entry["real_ip"],
                time=entry["time"],
                request=entry["request"],
                page=entry["page"],
                status=entry["status"],
                bytes_sent=entry["bytes_sent"],
                referer=entry["referer"],
                user_agent=entry["user_agent"],
                mobile=entry["mobile"]
            )