{"id":13685899,"url":"https://github.com/weppos/apachelogregex","last_synced_at":"2026-03-08T23:31:21.608Z","repository":{"id":423427,"uuid":"43378","full_name":"weppos/apachelogregex","owner":"weppos","description":"Ruby parser for Apache log files based on regular expressions.","archived":false,"fork":false,"pushed_at":"2009-12-19T11:28:25.000Z","size":350,"stargazers_count":54,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T19:59:25.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://simonecarletti.com/apachelogregex","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weppos.png","metadata":{"files":{"readme":"README.rdoc","changelog":"CHANGELOG.rdoc","contributing":null,"funding":null,"license":"LICENSE.rdoc","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-08-17T19:08:01.000Z","updated_at":"2023-09-08T16:24:57.000Z","dependencies_parsed_at":"2022-07-08T01:50:34.963Z","dependency_job_id":null,"html_url":"https://github.com/weppos/apachelogregex","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/weppos/apachelogregex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weppos%2Fapachelogregex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weppos%2Fapachelogregex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weppos%2Fapachelogregex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weppos%2Fapachelogregex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weppos","download_url":"https://codeload.github.com/weppos/apachelogregex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weppos%2Fapachelogregex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30276908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-08-02T14:00:58.773Z","updated_at":"2026-03-08T23:31:21.588Z","avatar_url":"https://github.com/weppos.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"= Apache Log Regex\n\nApache Log Regex is a Ruby port of Peter Hickman's Apache::LogRegex 1.4 Perl module, \navailable at http://cpan.uwinnipeg.ca/~peterhi/Apache-LogRegex.\nIt provides functionalities to parse a line from an Apache log file into a hash.\n\n\n== Dependencies\n\n* Ruby \u003e= 1.8.6 (not tested with previous versions)\n\nApacheLogRegex is compatible with Ruby 1.9.1.\n\n\n== Overview\n\nApache Log Regex is designed to be a simple class to parse Apache log files. \n\nIt takes an Apache logging format and generates a regular expression which is used to parse a line from a log file and returns a Hash with keys corresponding to the fields defined in the log format.\nThe log format should match the one defined in your Apache configuration file with the LogFormat directive.\n\n\n== Example Usage\n\nThe following one is the most simple example usage. \nIt tries to parse the `access.log` file and echoes each parsed line.\n\n  format = '%h %l %u %t \\\"%r\\\" %\u003es %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"'\n  parser = ApacheLogRegex.new(format)\n  \n  File.foreach('/var/apache/access.log') do |line|\n    parser.parse(line)\n    # {\"%r\"=\u003e\"GET /blog/index.xml HTTP/1.1\", \"%h\"=\u003e\"87.18.183.252\", ... }\n  end\n\nMore often, you might want to collect parsed lines and use them later in your program.\nThe following example iterates all log lines, parses them and returns an array of Hash with the results.\n\n  format = '%h %l %u %t \\\"%r\\\" %\u003es %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"'\n  parser = ApacheLogRegex.new(format)\n\n  File.readlines('/var/apache/access.log').collect do |line|\n    parser.parse(line)\n    # {\"%r\"=\u003e\"GET /blog/index.xml HTTP/1.1\", \"%h\"=\u003e\"87.18.183.252\", ... }\n  end\n\nIf you want more control over the parser you can use the \u003ctt\u003eparse!\u003c/tt\u003e method. \nIt raises a \u003ctt\u003eParseError\u003c/tt\u003e if given line doesn't match the log format.\n\n  common_log_format = '%h %l %u %t \\\"%r\\\" %\u003es %b'\n  parser = ApacheLogRegex.new(common_log_format)\n  \n  # No exception\n  parser.parse(line) # =\u003e nil\n  \n  # Raises an exception\n  parser.parse!(line) # =\u003e ParseError\n\n\n\n== Acknowledgments\n\nThis library is essentially a Ruby port of Apache::LogRegex Perl library.\nA big thanks goes to Peter Hickman, the author of the original package. This Ruby GEM would probably not exists without your contribution!\n\nI also want to thank you Harry Fuecks and Hamish Morgan, \nthe authors of the Python[http://code.google.com/p/apachelog/] and PHP[http://kitty0.org/] ports.\nFirst of all they gave me the inspiration to translate the original Perl code to Ruby, \nas soon as I discovered nobody did it before me.\nLast but not least, their library have been extremely useful to help me understand some obscure Perl statements\nfrom the original package.\n\n\n== Author\n\n* {Simone Carletti}[http://www.simonecarletti.com] \u003cweppos@weppos.net\u003e\n\n\n== Resources\n\n* {Homepage}[http://code.simonecarletti.com/apachelogregex]\n* {API}[http://apachelogregex.rubyforge.org]\n* {Source}[http://github.com/weppos/apachelogregex]\n* {Bugs \u0026 Features}[http://github.com/weppos/apachelogregex/issues]\n\n\n== Changelog\n\nSee the CHANGELOG.rdoc file for details.\n\n\n== License\n\nCopyright (c) 2008-2009 Simone Carletti, ApacheLogRegex is released under the MIT license. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweppos%2Fapachelogregex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweppos%2Fapachelogregex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweppos%2Fapachelogregex/lists"}