Skip to content

Commit 001984b

Browse files
committed
generate new image
1 parent 700f89d commit 001984b

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Diff for: logs-to-tsdb/backfill/do-all.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
for fil in `ls *.txt`
33
do
44
echo "ON FILE "$fil
5-
python3 munge2.py $fil
5+
yes | python3 munge2.py $fil
66
rm logs*gz
77
rm ready*json
88
done

Diff for: logs-to-tsdb/backfill/get-all-days.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ def get_query_results(query_id, filename):
3636
def main():
3737
log_group = "/ecs/ceramic-prod-cas"
3838

39-
start_date_str = "2024-06-17 23:59:00"
40-
end_date_str = "2024-06-26 00:00:00"
39+
start_date_str = "2024-07-01 23:59:00"
40+
end_date_str = "2024-07-15 20:00:00"
4141
start_date = datetime.strptime(start_date_str, "%Y-%m-%d %H:%M:%S").replace(tzinfo=timezone.utc)
4242
end_date = datetime.strptime(end_date_str, "%Y-%m-%d %H:%M:%S").replace(tzinfo=timezone.utc)
4343

4444
query_ids = []
4545

4646
# Start all the queries
4747
while start_date < end_date:
48-
next_date = start_date + timedelta(minutes=30)
48+
next_date = start_date + timedelta(minutes=5)
4949
query_id = start_query_for_period(log_group, start_date, next_date)
5050
if query_id:
5151
query_ids.append((query_id, start_date.strftime('%Y-%m-%d-%H-%M'))) # Storing the date for filename

Diff for: logs-to-tsdb/backfill/munge2.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@
7070
LAM_TEMP = { "awslogs": { "data": "" }}
7171

7272
for logs in ls:
73+
print("Inserting data from logstream: " + logs)
7374
(grp,part,logid) = logs.split('/')
74-
fname = 'logs_{}.json'.format(logid)
75+
fname = '{}.json'.format(backfile)
7576
with open(fname, 'w') as f:
7677
json.dump(ls[logs], f)
7778
os.system('gzip {}'.format(fname))
7879
newl = LAM_TEMP.copy()
7980
newl['awslogs']['data'] = subprocess.run(['base64', '{}.gz'.format(fname)], capture_output=True, text=True).stdout.strip()
8081

81-
with open('ready_{}.json'.format(logid), 'w') as f:
82+
with open('ready_{}.json'.format(backfile), 'w') as f:
8283
json.dump(newl, f)
83-
cmd = 'python-lambda-local -f handler ../logs-lambda.py ready_{}.json --timeout 20'.format(logid)
84-
os.system('python-lambda-local -f handler ../logs-lambda.py ready_{}.json --timeout 20'.format(logid))
84+
cmd = 'python-lambda-local -f handler ../logs-lambda.py ready_{}.json --timeout 20'.format(backfile)
85+
os.system('python-lambda-local -f handler ../logs-lambda.py ready_{}.json --timeout 20'.format(backfile))

Diff for: logs-to-tsdb/kinesis-lambda.py

+1
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,4 @@ def handler(event, context):
111111
context = {}
112112

113113
handler(event, context)
114+
print("Done")

0 commit comments

Comments
 (0)