This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
logging.basicConfig( | |
format='%(asctime)s,%(msecs)05.1f (%(funcName)s) %(message)s', | |
datefmt='%H:%M:%S') | |
log = logging.getLogger() | |
log.setLevel(logging.INFO) | |
import threading | |
import os | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import hashlib | |
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
from tqdm import tqdm | |
class Storage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql.functions import split, regexp_extract | |
split_df = base_df.select(regexp_extract('value', r'^([^\s]+\s)', 1).alias('host'), | |
regexp_extract('value', r'^.*\[(\d\d/\w{3}/\d{4}:\d{2}:\d{2}:\d{2} -\d{4})]', 1).alias('timestamp'), | |
regexp_extract('value', r'^.*"\w+\s+([^\s]+)\s+HTTP.*"', 1).alias('path'), | |
regexp_extract('value', r'^.*"\s+([^\s]+)', 1).cast('integer').alias('status'), | |
regexp_extract('value', r'^.*\s+(\d+)$', 1).cast('integer').alias('content_size')) | |
split_df.show(truncate=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder