├── .babelrc ├── .eslintrc.js ├── .gitignore ├── Documentation.md ├── LICENSE ├── README.md ├── __mocks__ └── styleMock.js ├── __tests__ ├── Console.test.js ├── Credentials.test.js ├── logController.test.js └── server.test.js ├── client ├── components │ ├── App.jsx │ ├── Console.jsx │ ├── ConsoleNav.jsx │ ├── ConsoleNav │ │ ├── ConsoleNav.jsx │ │ ├── InputBox.jsx │ │ ├── LogGroupDropdown.jsx │ │ ├── LogStreamDropdown.jsx │ │ ├── RefreshButton.jsx │ │ └── ThemeButton.jsx │ ├── Credentials │ │ ├── Credentials.jsx │ │ └── CredentialsForm │ │ │ ├── AccessKeyInput.js │ │ │ ├── CredentialsForm.jsx │ │ │ ├── RegionSelect.js │ │ │ ├── SecretKeyInput.js │ │ │ └── SubmitButton.js │ ├── Header.jsx │ └── Splash │ │ ├── Contributors.jsx │ │ ├── FeatureSection.jsx │ │ ├── Footer.jsx │ │ ├── GetStarted.jsx │ │ ├── MainSection.jsx │ │ └── Splash.jsx ├── hooks │ ├── useLogGroupOptions.js │ ├── useLogGroups.js │ ├── useLogStreamOptions.js │ ├── useLogStreams.js │ ├── useLogs.js │ ├── useRegions.js │ ├── useSearch.js │ ├── useSelectGroup.js │ ├── useSelectStream.js │ └── useThemeButton.js ├── public │ └── favicon.ico └── src │ ├── images │ ├── Hoang.jpeg │ ├── LinkedIn.png │ ├── Luke.png │ ├── Nick.jpeg │ ├── Placeholder.png │ ├── conrad.jpeg │ ├── consoleContent.png │ ├── creds.png │ ├── github-mark.png │ └── ll-logo.png │ ├── index.html │ ├── index.js │ ├── styles.css │ └── styles │ ├── Console.module.css │ ├── ConsoleNav.module.css │ ├── Contributors.module.css │ ├── Credentials.module.css │ ├── FeatureSection.module.css │ ├── Footer.module.css │ ├── Header.module.css │ └── MainSection.module.css ├── docs └── assets │ └── images │ ├── consoleContent.png │ ├── consolePage.png │ ├── get-access-key.gif │ ├── homepage.png │ ├── minLogo.png │ └── region.png ├── jest.config.js ├── package-lock.json ├── package.json ├── server ├── Controllers │ └── logController.js ├── middleware │ └── awsConfig.js ├── routes │ └── logRoutes.js └── server.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env", "@babel/preset-react"], 3 | "plugins": ["@babel/plugin-transform-runtime"] 4 | } 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'root': true, 3 | 'ignorePatterns': ['**/test', '**/__tests__'], 4 | 'env': { 5 | 'node': true, 6 | 'browser': true, 7 | 'es2021': true 8 | }, 9 | 'plugins': ['react'], 10 | 'extends': ['eslint:recommended', 'plugin:react/recommended'], 11 | 'parserOptions': { 12 | 'sourceType': 'module', 13 | 'ecmaFeatures': { 14 | 'jsx': true 15 | } 16 | }, 17 | 'rules': { 18 | 'indent': ['warn', 2], 19 | 'no-unused-vars': ['off', { 'vars': 'local' }], 20 | 'no-case-declarations': 'off', 21 | 'prefer-const': 'warn', 22 | 'quotes': ['warn', 'single'], 23 | 'react/prop-types': 'off', 24 | 'semi': ['warn', 'always'], 25 | 'space-infix-ops': 'warn' 26 | }, 27 | 'settings': { 28 | 'react': { 'version': 'detect'} 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # yarn v2 126 | .yarn/cache 127 | .yarn/unplugged 128 | .yarn/build-state.yml 129 | .yarn/install-state.gz 130 | .pnp.* 131 | 132 | .DS_Store 133 | build/ -------------------------------------------------------------------------------- /Documentation.md: -------------------------------------------------------------------------------- 1 | ## Lambda Logger Documentation 2 | --- 3 | 4 | ### Overview 5 | 6 | Lambda Logger is a web application designed to facilitate the management and monitoring of AWS Lambda function logs through Amazon CloudWatch. The application is built using React for the front end and a Node.js Express backend. The frontend uses React Router for navigation, allowing users to navigate between different views seamlessly. 7 | 8 | --- 9 | ### Components 10 | 11 | #### `App` 12 | 13 | - The main component that serves as the entry point for the Lambda Logger application. 14 | - Uses React Router (`BrowserRouter`, `Routes`, and `Route`) to define routes for different views in the app. 15 | - Manages the application state for user credentials and interacts with custom hooks for fetching log groups, log streams, and logs. 16 | - Renders the `Header`, `Splash`, `Credentials`, `ConsoleNav`, and `Console` components based on the defined routes. 17 | 18 | #### `Header` 19 | 20 | - Displays the application header with the Lambda Logger logo and navigation links. 21 | - Navigation links include Home, Docs, Github, and the main application page (Credentials). 22 | 23 | #### `Splash` 24 | 25 | - Represents the splash or landing page of the Lambda Logger application. 26 | - Rendered when the root URL (`/`) is accessed. 27 | 28 | #### `Credentials` 29 | 30 | - Manages the user's AWS credentials (Access Key, Secret Key, and Region) and handles the authentication process. 31 | - Utilizes custom hooks (`useLogGroups`, `useLogStreams`, `useLogs`, `useThemeButton`, and `useSearch`) to fetch and manage data related to log groups, log streams, logs, themes, and search functionality. 32 | - Renders the `CredentialsForm` component for entering AWS credentials. 33 | 34 | #### `CredentialsForm` 35 | 36 | - A form component used for entering AWS credentials (Access Key, Secret Key, and Region). 37 | - Dynamically updates the region dropdown based on the available AWS regions. 38 | - Displays loading indicators during data fetching. 39 | 40 | #### `ConsoleNav` 41 | 42 | - Provides navigation and control options for the Console view. 43 | - Allows users to select log groups, log streams, switch themes, perform searches, and fetch the latest logs. 44 | - Uses custom hooks (`useLogGroupOptions`, `useLogStreamOptions`, `useSelectStream`, and `useSelectGroup`) to manage options and selections for log groups and log streams. 45 | 46 | #### `Console` 47 | 48 | - Displays logs using syntax highlighting. 49 | - Takes a `jsonString` prop and a `theme` prop for rendering JSON logs with the specified theme. 50 | 51 | --- 52 | 53 | 54 | ### Custom Hooks 55 | 56 | - `useLogGroups`: Manages API calls for fetching log groups and related state. 57 | - `useLogStreams`: Manages API calls for fetching log streams and related state. 58 | - `useLogs`: Manages API calls for fetching logs and related state. 59 | - `useThemeButton`: Manages theme toggling in React components. 60 | - `useSearch`: Manages search functionality and querying logs. 61 | 62 | --- 63 | 64 | 65 | ### Routing 66 | 67 | - The React Router library is used for client-side routing. 68 | - Different views are defined for the root (`/`), credentials (`/credentials`), and console (`/console`). 69 | 70 | --- 71 | 72 | 73 | ### Styles 74 | 75 | - Styling is implemented using CSS modules for local scoping of styles. 76 | - Stylesheets are imported into components for styling. 77 | 78 | --- 79 | 80 | 81 | ### Using the App 82 | 83 | 1. Start the application by running the appropriate scripts (e.g., `npm start` if in production or `npm run dev` if contributing). 84 | 2. Navigate to different views using the navigation links. 85 | 3. Enter AWS credentials on the Credentials screen. 86 | 4. Explore logs using the Console view. 87 | 88 | --- 89 | 90 | 91 | ### Contributing 92 | 93 | Contributions to the Lambda Logger project are welcome. Please follow the guidelines outlined in the project's documentation and make sure to adhere to coding standards. 94 | 95 | --- 96 | 97 | ## Custom Hooks 98 | 99 | ### `useLogGroupOptions` 100 | 101 | This custom hook is responsible for creating options for a dropdown menu based on an array of log groups. 102 | 103 | ##### Usage: 104 | 105 | `const { logGroupOptions } = useLogGroupOptions(logGroups);` 106 | 107 | ##### Parameters: 108 | 109 | - `logGroups`: An array of log groups retrieved from AWS CloudWatch. 110 | 111 | ##### Returns: 112 | 113 | - `logGroupOptions`: An array of React `