{"id":35619812,"url":"https://github.com/scieloorg/scielo_log_validator","last_synced_at":"2026-01-05T06:04:31.254Z","repository":{"id":41867266,"uuid":"401438195","full_name":"scieloorg/scielo_log_validator","owner":"scieloorg","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-21T15:07:49.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-14T20:25:31.084Z","etag":null,"topics":[],"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/scieloorg.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}},"created_at":"2021-08-30T17:58:01.000Z","updated_at":"2022-01-10T02:47:00.000Z","dependencies_parsed_at":"2022-08-11T19:40:39.707Z","dependency_job_id":null,"html_url":"https://github.com/scieloorg/scielo_log_validator","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/scieloorg/scielo_log_validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fscielo_log_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fscielo_log_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fscielo_log_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fscielo_log_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scieloorg","download_url":"https://codeload.github.com/scieloorg/scielo_log_validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scieloorg%2Fscielo_log_validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28214410,"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","status":"online","status_checked_at":"2026-01-05T02:00:06.358Z","response_time":57,"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":[],"created_at":"2026-01-05T06:02:48.644Z","updated_at":"2026-01-05T06:04:31.246Z","avatar_url":"https://github.com/scieloorg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SciELO Log Validator\n\nThe SciELO Log Validator project provides tools to validate log files for the SciELO platform. It includes both command line and Python library usage options.\n\n\n## Installation\n\nTo install the SciELO Log Validator, you can use `pip`:\n\n```bash\npip install scielo-log-validator\n```\n\nAlternatively, you can clone the repository and install the dependencies manually:\n\n```bash\ngit clone https://github.com/scieloorg/scielo_log_validator.git\ncd scielo_log_validator\npip install -r requirements.txt\n```\n\n## To set up a development environment, follow these steps:\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/scieloorg/scielo_log_validator.git\ncd scielo_log_validator\n  ```\n\n2. Create a virtual environment:\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n```\n\n3. Install the dependencies:\n```bash\npip install -r requirements.txt\n```\n\n4. Install the package in editable mode:\n```bash\npip install -e .\n```\n\n5. Run tests to ensure everything is set up correctly:\n```bash\npython -m unittest discover\n```\n\n\n## Usage\n\n__Command line__\n\n```bash\nusage: log_validator [-h] -p PATH [-s SAMPLE_SIZE] [--apply_path_validation] [--apply_content_validation]\n\noptions:\n  -h, --help            show this help message and exit\n  -p PATH, --path PATH  File or directory to be checked\n  -s SAMPLE_SIZE, --sample_size SAMPLE_SIZE\n              Sample size to be checked (must be between 0 and 1)\n  --apply_path_validation\n                        Indicates whether to apply path validation\n  --apply_content_validation\n                        Indicates whether to apply content validation\n\n# Here is an example of execution for a single file:\nlog_validator -p /home/user/2022-03-01_scielo-br.log.gz --apply_path_validation --apply_content_validation\n\n# Here is an example of execution for an entire directory:\nlog_validator -p /home/user --apply_path_validation --apply_content_validation\n```\n\n__Python library__\n\n```python\nfrom scielo_log_validator import validator\n\n# Validate a single file\nresult = validator.pipeline_validate('/home/user/2022-03-01_scielo-br.log.gz', sample_size=0.25, apply_path_validation=True, apply_content_validation=True)\n\n# Validate all files in a directory\nfor root, _, files in os.walk('/home/user'):\n    for file in files:\n        file_path = os.path.join(root, file)\n        results = validator.pipeline_validate(\n            path=file_path, \n            sample_size=0.1,\n            apply_path_validation=True,\n            apply_content_validation=True\n        )\n```\n\n__Result format__\n\nIn both modes, the output of the validation process is a JSON object that provides detailed information about the log file, including a summary of the content, validation status, and path details. Here is an example of the output:\n\n```json\n{\n  \"/home/user/2022-03-01_scielo-br.log.gz\": {\n    \"content\": {\n      \"summary\": {\n        \"datetimes\": {\n          \"(2022, 3, 1, 23)\": 5,\n          \"(2022, 3, 2, 0)\": 312,\n          \"(2022, 3, 2, 1)\": 319,\n          \"(2022, 3, 2, 2)\": 321,\n          \"(2022, 3, 2, 3)\": 331,\n          \"(2022, 3, 2, 4)\": 321,\n          \"(2022, 3, 2, 5)\": 320,\n          \"(2022, 3, 2, 6)\": 324,\n          \"(2022, 3, 2, 7)\": 376,\n          \"(2022, 3, 2, 8)\": 345,\n          \"(2022, 3, 2, 9)\": 480,\n          \"(2022, 3, 2, 10)\": 416,\n          \"(2022, 3, 2, 11)\": 506,\n          \"(2022, 3, 2, 12)\": 620,\n          \"(2022, 3, 2, 13)\": 452,\n          \"(2022, 3, 2, 14)\": 419,\n          \"(2022, 3, 2, 15)\": 399,\n          \"(2022, 3, 2, 16)\": 518,\n          \"(2022, 3, 2, 17)\": 419,\n          \"(2022, 3, 2, 18)\": 406,\n          \"(2022, 3, 2, 19)\": 615,\n          \"(2022, 3, 2, 20)\": 668,\n          \"(2022, 3, 2, 21)\": 546,\n          \"(2022, 3, 2, 22)\": 683,\n          \"(2022, 3, 2, 23)\": 442\n        },\n        \"invalid_lines\": 0,\n        \"ips\": {\n          \"local\": 324,\n          \"remote\": 10239\n        },\n        \"total_lines\": 105634\n      }\n    },\n    \"is_valid\": {\n      \"all\": true,\n      \"dates\": true,\n      \"ips\": true\n    },\n    \"path\": {\n      \"collection\": null,\n      \"date\": \"2022-03-01\",\n      \"extension\": \".gz\",\n      \"mimetype\": \"application/gzip\",\n      \"paperboy\": false\n    },\n  \"probably_date\": datetime.datetime(2022, 3, 2, 0, 0)}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscieloorg%2Fscielo_log_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscieloorg%2Fscielo_log_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscieloorg%2Fscielo_log_validator/lists"}