brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchAgents
Replace /usr/local/etc/nginx/nginx.conf
with the nginx.conf
in this gist. I'm using port 8081 for my current project.
import boto3 | |
import time | |
start = time.time() | |
# Location should not end with a slash, just CloudTrail | |
location = "s3://aws-cloudtrail-logs-255149284406-4cec155e/AWSLogs/255149284406/CloudTrail" | |
# results only needed for the last part (where we validate the query worked) | |
results = "s3://com.alationpro/athena" | |
region = "us-west-2" | |
database = "default" |
query_text = f""" | |
SELECT eventname, substr(eventtime, 1, 10) as eventdate,count(*) | |
FROM {database}.{cloudtrail_table} | |
WHERE region='{region}' | |
and year=date_format(date_add('day',-1,current_date),'%Y') | |
and month=date_format(date_add('day',-1,current_date),'%m') | |
and day=date_format(date_add('day',-1,current_date),'%d') | |
and eventname='StartQueryExecution' | |
GROUP BY 1, 2 | |
ORDER BY 1, 2 |
import re | |
import requests | |
with open("Hashmasks Provenance Record") as hash: | |
while(hash): | |
t = hash.readline() | |
t0 = t.split("|") | |
if len(t0)==3: | |
t2 = t0[2] | |
t3 = re.search("[a-zA-Z0-9]+", t2) |