{"id":35322655,"url":"https://github.com/ywzheng1/logs-analysis-project","last_synced_at":"2026-04-09T02:31:13.633Z","repository":{"id":235382134,"uuid":"198125215","full_name":"ywzheng1/logs-analysis-project","owner":"ywzheng1","description":null,"archived":false,"fork":false,"pushed_at":"2019-07-28T21:26:03.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-17T16:14:35.715Z","etag":null,"topics":["database","linux","python","sql","sql-server","vagrant","virtual-machine"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ywzheng1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-07-22T01:34:36.000Z","updated_at":"2019-09-16T14:08:35.000Z","dependencies_parsed_at":"2024-04-23T07:54:37.331Z","dependency_job_id":null,"html_url":"https://github.com/ywzheng1/logs-analysis-project","commit_stats":null,"previous_names":["ywzheng1/logs-analysis-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ywzheng1/logs-analysis-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywzheng1%2Flogs-analysis-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywzheng1%2Flogs-analysis-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywzheng1%2Flogs-analysis-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywzheng1%2Flogs-analysis-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ywzheng1","download_url":"https://codeload.github.com/ywzheng1/logs-analysis-project/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ywzheng1%2Flogs-analysis-project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31582569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","linux","python","sql","sql-server","vagrant","virtual-machine"],"created_at":"2025-12-30T23:02:19.655Z","updated_at":"2026-04-09T02:31:13.623Z","avatar_url":"https://github.com/ywzheng1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Newspaper logs analysis project\n==============================\n\n\nThis is an internal reporting tool that produces answers by printing them out in the plain text in the Terminal. The tool produces answers to the following three questions based on the data in the database:\n\n**Question 1:**   \nWhat are the most popular three articles of all time?\n\n**Question 2:**   \nWho are the most popular articles authors of all time?\n\n**Question 3:**   \nOn which days did more than 1% of requests lead to errors?\n\nThis tool is a Python program that uses the psycopg2 module to connect to the database.\nThis project is using tools called [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/wiki/Download_Old_Builds_5_1) to install and manage the VM. You'll need to install these to run this project\n\n##### Use a Terminal\nYou'll be doing these exercises using a Unix-style terminal on your computer. If you are using a Mac or Linux system, your regular terminal program will do just fine. On Windows, I recommend using the Git Bash terminal that comes with the Git software. If you don't already have Git installed, download Git from [git-scm.com](https://git-scm.com/downloads).\n\n-----\n\n\n### How To Install Report Tool:\n##### Prepare the software and data\nTo start on this project, you'll need database software (provided by a Linux virtual machine) and the data to analyze.\n\n##### The virtual machine\nThis project makes use of the same Linux-based virtual machine (VM). You will need to install virtual box and vagrant to run this project.\n\n\n#### Start the virtual machine  \nFrom your terminal, inside the vagrant subdirectory, run the command `vagrant up`. This will cause Vagrant to download the Linux operating system and install it. This may take quite a while (many minutes) depending on how fast your Internet connection is.\n\nWhen `vagrant up` is finished running, you will get your shell prompt back. At this point, you can run `vagrant ssh` to log in to your newly installed Linux VM!\n\n\n\n\n#### Download database\nDatabase was provide by Udacity and available to download here: [database](https://d17h27t6h515a5.cloudfront.net/topher/2016/August/57b5f748_newsdata/newsdata.zip).\n\n##### Download or Clone the file into your local machine\nTo build the reporting tool, you'll need to load the site's data into your local database.\n\n\nTo load the data, cd into the vagrant directory and use the command `psql -d news -f newsdata.sql`.\nHere's what this command does:\n\n\n\n#### Inside The database\nThe database includes three tables:\n\n- The authors table includes information about the authors of articles.\n- The articles table includes the articles themselves.\n- The log table includes one entry for each time a user has accessed the site.  \n\n------\n\n\n#### PSQL Views Created for Report\nQuestion 2:\n```\n#article views\nCREATE VIEW articles_view AS\n\tselect title, COUNT(log.id) as view\n\tfrom articles, log where articles.slug = (replace(path, '/article/', ''))\n\tGROUP BY articles.title;\n\n#author\nCREATE VIEW article_authors AS\n\tSELECT title, name\n\tFROM articles, authors\n\tWHERE articles.author = authors.id;\n```\n\nQuestion 3:\n```\n#error log\nCREATE VIEW error_log AS\n\tselect cast(time as date),\n\tCOUNT(status) as Error_Count from log\n\twhere status like '404%'\n\tGROUP BY cast(time as date);\n\n#all log\nCREATE VIEW logcount\n\tAS select cast(time as date),\n\tCOUNT(status) as logcount from log\n\tgroup by cast(time as date);\n```\n\n-----\n\n#### Final Output Result\nCheck out output.txt file for result.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fywzheng1%2Flogs-analysis-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fywzheng1%2Flogs-analysis-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fywzheng1%2Flogs-analysis-project/lists"}