/cloudhawk

:cloud: :eagle: Alternative AWS CloudWatch Logs viewer

Primary LanguageTypeScriptMIT LicenseMIT

CloudHawk logo cloudhawk

Run Tests

Very early stages and unstable. Use at your own risk!

CloudHawk image generated by Stable Diffusion

Stable Diffusion: A clip art image of a hawk flying over a cloud. Cartoon, clip art, simple design, logo

This is an alternative frontend for CloudWatch. Frontend at this time is written in React/JavaScript, bootstrapped with create-react-app, and the backend is written in Go.

Screenshot

Currently the focus is on CloudWatch Insights queries, but I may consider adding other use cases in the future such as viewing log streams.

If there's a use case that isn't supported yet, please let me know by creating an issue.

Setup

First, create an .env file using .env.example as the base, or simply define these environment variables: (using your own values)

# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

# Alternatively, you can also let the AWS SDK load credentials from shared credentials file.
# However, AWS_SDK_LOAD_CONFIG needs to be set for the region to be pulled from the config.
# https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html
# AWS_SDK_LOAD_CONFIG=true

Run without Docker

npm install --production

go mod download

npm run build

go run main.go

Run with Docker

Using Environment Variables only

docker run --env-file .env -p 8080:8080 -d coteh/cloudhawk:latest

Using Shared Credentials file

docker run --env-file .env -v $HOME/.aws:/root/.aws -p 8080:8080 -d coteh/cloudhawk:latest

CloudHawk should then be available at http://localhost:8080/.

Development

npm install

go mod download

go run main.go

npm start

Features

  • Query logs using CloudWatch Insights
  • Query results are cached to local storage
  • Perform multiple queries and switch between them
  • Filter columns in query results

Sequence Diagram

NOTE: Certain parts are not implemented yet, namely the persistent store and log streaming.

This diagram is best viewed on the GitHub website.

sequenceDiagram
    participant Web App
    participant Server
    participant CloudWatch
    participant Persistent Store


    Web App->>Server: Send query
    Server->>Persistent Store: Store query information
    Server->>CloudWatch: Execute query
    CloudWatch->>Server: Return query execution info
    Server->>Persistent Store: Store query execution info in query information
    Server->>Web App: Return query execution information
    Web App->>Server: Retrieve logs from query exeuction
    Server->>CloudWatch: Request logs from query execution result
    CloudWatch->>Server: Stream logs
    Server->>Web App: Stream logs
Loading

Roadmap

A few ideas that I want to tackle:

  • Ability to download logs to file
  • Generate a shareable link to the query on CloudWatch web console
  • Ability to change region on per-query basis
  • Ability to switch profiles on per-query basis
  • Adding GitHub issues and a project for all the items I want to do in the future
  • Please post a GitHub issue if there's something you want