{"id":13821406,"url":"https://github.com/mike-mosher/aws-la","last_synced_at":"2025-05-16T12:33:21.533Z","repository":{"id":217313255,"uuid":"101719233","full_name":"mike-mosher/aws-la","owner":"mike-mosher","description":"AWS Log Analyzer -- Send AWS logs to ELK running locally in Docker containers","archived":false,"fork":false,"pushed_at":"2020-10-07T01:24:49.000Z","size":4992,"stargazers_count":31,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T21:36:04.535Z","etag":null,"topics":["alb","albaccesslogs","amazon","amazon-web-services","aws","dashboard","docker","elasticsearch","elasticsearch-cluster","elb","elbaccesslogs","elk","kibana","python","python2","python3","route53","route53-query-logs","vpc","vpc-flow-logs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mike-mosher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-29T04:33:54.000Z","updated_at":"2024-10-16T02:36:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"43ce0e78-9dc1-486a-8ff0-d415737b5b9d","html_url":"https://github.com/mike-mosher/aws-la","commit_stats":null,"previous_names":["mike-mosher/aws-la"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike-mosher%2Faws-la","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike-mosher%2Faws-la/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike-mosher%2Faws-la/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike-mosher%2Faws-la/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mike-mosher","download_url":"https://codeload.github.com/mike-mosher/aws-la/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254530650,"owners_count":22086653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alb","albaccesslogs","amazon","amazon-web-services","aws","dashboard","docker","elasticsearch","elasticsearch-cluster","elb","elbaccesslogs","elk","kibana","python","python2","python3","route53","route53-query-logs","vpc","vpc-flow-logs"],"created_at":"2024-08-04T08:01:21.377Z","updated_at":"2025-05-16T12:33:17.923Z","avatar_url":"https://github.com/mike-mosher.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# AWS-LA (AWS Log Analyzer)\n\n## Description\n\nThis script allows you to easily import various AWS log types into an Elasticsearch cluster running locally on your computer in a docker container.\n\n## Supported AWS Log Types\n\n- ELB access logs\n- ALB access logs\n- VPC flow logs\n- [Route53 query logs][r53-query-logs]\n- Apache access logs\n\n## Future Log Types Supported\n\n- Cloudtrail audit logs\n- Cloudfront access logs\n- S3 access logs\n- Others to come!\n\n## Steps Automated\n\nThe script configures everything that is needed in the ELK stack:\n\n- Elasticsearch:\n\n  - indices\n  - mappings\n  - ingest pipelines\n\n- Kibana:\n\n  - index-patterns\n  - field formatting for index-pattern fields\n  - importing dashboards, visualizations, and dashboards\n  - custom link directly to the newly created dashboard\n\n## Installation Steps\n\n- Install [Docker for Windows][docker-for-windows] or [Docker for Mac][docker-for-mac]\n- Clone this git repository:\n\n  `git clone https://github.com/mike-mosher/aws-la.git \u0026\u0026 cd aws-la`\n\n- Install requirements:\n\n  `pip install -r ./requirements.txt`\n\n## Running the Script\n\n- Bring the docker environment up:\n\n  `docker-compose up -d`\n\n- Verify that the containers are running:\n\n  `docker ps`\n\n- Verify that Elasticsearch is running:\n\n  `curl -XGET localhost:9200/_cluster/health?pretty`\n\n- To run the script, specify the log type and directory containing the logs. For example, you could run the following command to import ELB Access Logs\n\n  `python importLogs.py --logtype elb --logdir ~/logs/elblogs/`\n\n- Valid log types are specified by running the `--help` argument. Currently, the valid logtypes are the following:\n\n  ```\n  elb                 # ELB access logs\n  alb                 # ALB access logs\n  vpc                 # VPC flow logs\n  r53                 # Route53 query logs\n  apache              # apache access log ('access_log')\n  apache_archives     # apache access logs (gunzip compressed with logrotate)\n  ```\n\n- Browse to the link provided in the output by using `cmd + double-click`, or browse directly to the default Kibana page:\n\n  `http://localhost:5601`\n\n- You can import multiple log types in the same ELK cluster. Just run the command again with the new log type and log directory:\n\n  ```\n   python importLogs.py --logtype vpc --logdir ~/logs/vpc-flowlogs/\n  ```\n\n- When done, you can shutdown the containers:\n\n  `docker-compose down -v`\n\n## Screenshots / Examples:\n\n- Python output: ![Python script output][cli-output]\n\n  - As you can see, I was able to import 12.5 million VPC flowlogs in around 2 hours\n\n- Searching for traffic initiated by RFC1918 (private) IP addresses:\n\n  - Browse to Discover tab, and enter the following query in the query bar:\n\n  `source_ip_address:\"10.0.0.0/8\" OR source_ip_address:\"172.16.0.0/12\" OR source_ip_address:\"192.168.0.0/16\"`\n\n  ![Search for RFC1918 Traffic][search-rfc1918]\n\n  - Alternately, you can search for all traffic initiated by Public IP addresses in the logs:\n\n  `NOT (source_ip_address:\"10.0.0.0/8\" OR source_ip_address:\"172.16.0.0/12\" OR source_ip_address:\"192.168.0.0/16\")`\n\n  ![Search for non-RFC1918 Traffic][search-non-rfc1918]\n\n  - Search for a specific flow to/from a specific ENI:\n\n  `interface-id:\u003ceni-name\u003e AND (source_port:\u003cport\u003e OR dest_port:\u003cport\u003e)`\n\n  ![Search flow to Specific ENI][search-eni]\n\n  - Note: VPC Flow Logs split a flow into two log entries, so the above search will find both sides of the flow and show packets / bytes for each\n\n- Dashboard imported for VPC Flow Logs: ![VPC Dashboard][vpc-dashboard]\n\n- Dashboard imported for ALB Access Logs: ![ALB Dashboard][alb-dashboard]\n\n[alb-dashboard]: examples_screenshots/ALB_Dashboard_Screenshots/ALB_Dashboard.jpg?raw=true\n[cli-output]: examples_screenshots/VFL_example_12.5m_documents_imported.png?raw=true\n[docker-for-mac]: https://docs.docker.com/docker-for-mac/install/#download-docker-for-mac\n[docker-for-windows]: https://docs.docker.com/docker-for-windows/install/#download-docker-for-windows\n[r53-query-logs]: https://aws.amazon.com/about-aws/whats-new/2017/09/amazon-route-53-announces-support-for-dns-query-logging/\n[search-eni]: examples_screenshots/VPC_Dashboard_Screenshots/Search_for_both_sides_of_a_flow_record_for_a_specific_ENI.png?raw=true\n[search-non-rfc1918]: examples_screenshots/VPC_Dashboard_Screenshots/Search_for_non_RFC1918_traffic.png?raw=true\n[search-rfc1918]: examples_screenshots/VPC_Dashboard_Screenshots/Search_for_RFC1918_traffic.png?raw=true\n[vpc-dashboard]: examples_screenshots/VPC_Dashboard_Screenshots/VPC_Flow_Logs_Dashboard.jpg?raw=true\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike-mosher%2Faws-la","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmike-mosher%2Faws-la","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike-mosher%2Faws-la/lists"}