From b1bd634e1da297edbf6d826832226c8a5c2681e7 Mon Sep 17 00:00:00 2001 From: Chris Gilmer Date: Thu, 7 Nov 2019 21:18:28 +0000 Subject: [PATCH 1/2] Add missing script to checking alb logs --- scripts/README.md | 9 +++++++++ scripts/download-alb-logs | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 scripts/download-alb-logs diff --git a/scripts/README.md b/scripts/README.md index 049d4c38663..31ca75e39e4 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -16,6 +16,15 @@ environment. | `check-hosts-file` | Script helps ensure that /etc/hosts has all the correct entries in it | | `prereqs` | validate if all prerequisite programs have been installed | +## Operations Scripts + +These scripts are used to operate the system. + +| Script Name | Description | +| --- | --- | +| `download-alb-logs` | Download alb logs for the given enviornment and dates to a local folder | +| `scan-alb-logs` | Scan alb logs for specific http codes. | + ## Pre-commit Scripts These scripts are used primarily to check our code before diff --git a/scripts/download-alb-logs b/scripts/download-alb-logs new file mode 100755 index 00000000000..5ee06a60491 --- /dev/null +++ b/scripts/download-alb-logs @@ -0,0 +1,26 @@ +#! /usr/bin/env bash + +set -eu -o pipefail + +# +# Download alb logs for the given enviornment and dates to a local folder +# +# Requires a environment and http code but can also include a date. +# When a date is not given the current UTC date is used. +# +# Example: +# ../scripts/download-alb-logs tmp prod 2019/02/14,2019/02/16 +# +# Note: Must run from transcom-ppp/ directory +# + +[[ $# -ne 3 ]] && echo "Usage: download-alb-logs [[,]]" && exit 1 + +readonly dest=$1 +readonly environment=$2 +IFS=', ' read -r -a dates <<< "$3" + +mkdir -p "${dest}" +for date in "${dates[@]}"; do + aws s3 sync --quiet "s3://transcom-ppp-aws-logs/alb/app-${environment}/AWSLogs/923914045601/elasticloadbalancing/us-west-2/${date}/" "$dest" +done From 3d7a001e161d89799252af4b90b92445555b272d Mon Sep 17 00:00:00 2001 From: Chris Gilmer Date: Thu, 7 Nov 2019 21:32:15 +0000 Subject: [PATCH 2/2] Fix spelling error --- scripts/README.md | 2 +- scripts/download-alb-logs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 31ca75e39e4..961ecfaee56 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -22,7 +22,7 @@ These scripts are used to operate the system. | Script Name | Description | | --- | --- | -| `download-alb-logs` | Download alb logs for the given enviornment and dates to a local folder | +| `download-alb-logs` | Download alb logs for the given environment and dates to a local folder | | `scan-alb-logs` | Scan alb logs for specific http codes. | ## Pre-commit Scripts diff --git a/scripts/download-alb-logs b/scripts/download-alb-logs index 5ee06a60491..961a52930a8 100755 --- a/scripts/download-alb-logs +++ b/scripts/download-alb-logs @@ -3,7 +3,7 @@ set -eu -o pipefail # -# Download alb logs for the given enviornment and dates to a local folder +# Download alb logs for the given environment and dates to a local folder # # Requires a environment and http code but can also include a date. # When a date is not given the current UTC date is used.