{"id":15136353,"url":"https://github.com/tommy-muehle/error-log-parser","last_synced_at":"2025-09-29T05:30:34.293Z","repository":{"id":57070562,"uuid":"48863617","full_name":"tommy-muehle/error-log-parser","owner":"tommy-muehle","description":"Simple PHP library to parse Apache or Nginx error-log file entries for further usage.","archived":true,"fork":false,"pushed_at":"2020-04-09T18:42:54.000Z","size":23,"stargazers_count":22,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-15T15:55:17.171Z","etag":null,"topics":["apache","error-log","formless","nginx","parser","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/tommy-muehle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-31T22:14:55.000Z","updated_at":"2024-07-10T12:07:59.000Z","dependencies_parsed_at":"2022-08-24T14:54:22.750Z","dependency_job_id":null,"html_url":"https://github.com/tommy-muehle/error-log-parser","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-muehle%2Ferror-log-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-muehle%2Ferror-log-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-muehle%2Ferror-log-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommy-muehle%2Ferror-log-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommy-muehle","download_url":"https://codeload.github.com/tommy-muehle/error-log-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234594021,"owners_count":18857416,"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":["apache","error-log","formless","nginx","parser","php"],"created_at":"2024-09-26T06:21:07.540Z","updated_at":"2025-09-29T05:30:28.851Z","avatar_url":"https://github.com/tommy-muehle.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# error-log-parser\n\n[![Build Status](https://travis-ci.org/tommy-muehle/error-log-parser.svg?branch=master)](https://travis-ci.org/tommy-muehle/error-log-parser)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg?style=flat-square)](https://php.net/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/tommy-muehle/error-log-parser/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/tommy-muehle/error-log-parser.svg)](https://github.com/tommy-muehle/error-log-parser/issues)\n\nSimple PHP library to parse Apache or Nginx error-log file entries for further usage. \n\n## Install\n\nUsing [Composer](https://getcomposer.org/)\n\n    $ composer require tm/error-log-parser\n    \nor manually add this to composer.json\n\n    {\n        \"require\": {\n            \"tm/error-log-parser\": \"~1.1\"\n        }\n    }\n\n## Usage\n\nInstantiate the class:\n\n    use TM\\ErrorLogParser\\Parser; \n    $parser = new Parser(Parser::TYPE_APACHE) // or TYPE_NGINX;\n    \nAnd then parse the lines:\n\n    function getLines($file)\n     {\n        $f = fopen($file, 'r');\n        if (!$f) throw new Exception();\n        while ($line = fgets($f)) {\n            yield $line;\n        }\n        fclose($f);\n    }\n    \n    foreach (getLines('/var/log/apache2/error.log') as $line) {\n        $entry = $parser-\u003eparse($line);\n    }\n    \nWhere ```$entry``` hold all parsed data.\nFor Apache:\n\n    stdClass Object (\n        [date] =\u003e \"Tue Dec 29 08:14:45 2015\"\n        [type] =\u003e \"warn\"\n        [client] =\u003e \"193.158.15.243\"\n        [message] =\u003e \"mod_fcgid: stderr: PHP Warning:  Division by zero in /var/www/kd/app.de/src/Calc.php on line 346, referer: https://www.app.de\"\n    )\n\nAnd for Nginx:\n\n    stdClass Object (\n        [date] =\u003e \"2011/06/10 13:30:10\"\n        [type] =\u003e \"error\"\n        [message] =\u003e \"*1 directory index of \"/var/www/ssl/\" is forbidden\"\n        [client] =\u003e \"86.186.86.232\"\n        [server] =\u003e \"hotelpublisher.com\"\n        [request] =\u003e \"GET / HTTP/1.1\"\n        [host] =\u003e \"hotelpublisher.com\"\n    )\n\nOtherwise you can use the FormlessParser for formless log files:\n\n    stdClass Object (\n        [type] =\u003e \"info\"\n        [message] =\u003e \"23263#0: *1 directory index of \"/var/www/ssl/\" is forbidden, client: 86.186.86.232, server: hotelpublisher.com, request: \"GET / HTTP/1.1\", host: \"hotelpublisher.com\"\"\n    )\n## Contributing\n\nPlease refer to [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy-muehle%2Ferror-log-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommy-muehle%2Ferror-log-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommy-muehle%2Ferror-log-parser/lists"}