Verified Commit 7a906731 authored by Xueshan Feng's avatar Xueshan Feng
Browse files

mention default start time.

parent d056a96e
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -2,11 +2,14 @@
#
# sfeng@stanford.edu 2018
# 
# Read AWS cloudwatch logs.
# Read AWS cloudwatch logs. Default is logs from 5 minutes ago.
# See https://github.com/jorgebastida/awslogs for full usage information.

### MAIN
program=$(basename $0 .sh | sed 's/-/_/g')

cmd=${@:-'--help'}

# Make sure docker is installed.
if ! which docker 2>&1 > /dev/null ; then 
  abort 1 "Need to install docker."
@@ -14,8 +17,13 @@ fi

aws_profile=${AWS_PROFILE:-"NODEFAULT"}
if [ "$aws_profile" = "NODEFAULT" ]; then
  echo "AWS profile is required. please do: export AWS_PROILE=<profile>." && exit 1
  echo "AWS profile is required. please do: export AWS_PROILE=<profile>."
  exit 1
fi

echo Running $program...
docker run --rm -it -v $HOME/.aws:/root/.aws suet/awslogs "$@" --profile=$aws_profile
if docker run --rm -it -v $HOME/.aws:/root/.aws suet/awslogs $cmd --profile=$aws_profile | grep "An error occurred"; then
  docker run --rm -it -v $HOME/.aws:/root/.aws suet/awslogs --help
else
  docker run --rm -it -v $HOME/.aws:/root/.aws suet/awslogs $cmd --profile=$aws_profile
fi