{"id":38083498,"url":"https://github.com/logrusorgru/grokky","last_synced_at":"2026-01-16T20:50:46.825Z","repository":{"id":57498471,"uuid":"60003134","full_name":"logrusorgru/grokky","owner":"logrusorgru","description":"pure golang grok-like library","archived":false,"fork":false,"pushed_at":"2024-03-01T06:37:57.000Z","size":57,"stargazers_count":44,"open_issues_count":0,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-18T18:34:54.243Z","etag":null,"topics":["golang","grok","matching","pattern","regexp"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logrusorgru.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":"2016-05-30T10:55:53.000Z","updated_at":"2024-04-25T14:49:27.000Z","dependencies_parsed_at":"2024-03-01T07:45:35.346Z","dependency_job_id":null,"html_url":"https://github.com/logrusorgru/grokky","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/logrusorgru/grokky","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logrusorgru%2Fgrokky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logrusorgru%2Fgrokky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logrusorgru%2Fgrokky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logrusorgru%2Fgrokky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logrusorgru","download_url":"https://codeload.github.com/logrusorgru/grokky/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logrusorgru%2Fgrokky/sbom","scorecard":{"id":597444,"data":{"date":"2025-08-11","repo":{"name":"github.com/logrusorgru/grokky","commit":"f6747d8463997d82c0bb65eb5d06bab15b176944"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 4/28 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Do What The F*ck You Want To Public License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T23:30:08.249Z","repository_id":57498471,"created_at":"2025-08-20T23:30:08.249Z","updated_at":"2025-08-20T23:30:08.249Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: 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":["golang","grok","matching","pattern","regexp"],"created_at":"2026-01-16T20:50:46.756Z","updated_at":"2026-01-16T20:50:46.809Z","avatar_url":"https://github.com/logrusorgru.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grokky\n\n[![GoDoc](https://godoc.org/github.com/logrusorgru/grokky?status.svg)](https://godoc.org/github.com/logrusorgru/grokky)\n[![WTFPL License](https://img.shields.io/badge/license-wtfpl-blue.svg)](http://www.wtfpl.net/about/)\n[![Build Status](https://travis-ci.org/logrusorgru/grokky.svg)](https://travis-ci.org/logrusorgru/grokky)\n[![Coverage Status](https://coveralls.io/repos/logrusorgru/grokky/badge.svg?branch=master)](https://coveralls.io/r/logrusorgru/grokky?branch=master)\n[![GoReportCard](https://goreportcard.com/badge/logrusorgru/grokky)](https://goreportcard.com/report/logrusorgru/grokky)\n[![Gitter](https://img.shields.io/badge/chat-on_gitter-46bc99.svg?logo=data:image%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTQiIHdpZHRoPSIxNCI%2BPGcgZmlsbD0iI2ZmZiI%2BPHJlY3QgeD0iMCIgeT0iMyIgd2lkdGg9IjEiIGhlaWdodD0iNSIvPjxyZWN0IHg9IjIiIHk9IjQiIHdpZHRoPSIxIiBoZWlnaHQ9IjciLz48cmVjdCB4PSI0IiB5PSI0IiB3aWR0aD0iMSIgaGVpZ2h0PSI3Ii8%2BPHJlY3QgeD0iNiIgeT0iNCIgd2lkdGg9IjEiIGhlaWdodD0iNCIvPjwvZz48L3N2Zz4%3D\u0026logoWidth=10)](https://gitter.im/logrusorgru/grokky?utm_source=share-link\u0026utm_medium=link\u0026utm_campaign=share-link)\n\nPackage grokky is a pure Golang Grok-like patterns library, which can\nhelp you to parse log files and other. This is based on\n[RE2](https://en.wikipedia.org/wiki/RE2_%28software%29)\nregexp that\n[much more faster](https://swtch.com/~rsc/regexp/regexp1.html)\nthan\n[Oniguruma](https://en.wikipedia.org/wiki/Oniguruma) in some cases.\nCheck out the \"much more faster\" article to understand the difference.\n\nThe library was disigned for creating many patterns and using it many\ntimes. The behavior and capabilities are slightly different from the\noriginal library. The goals of the library are:\n1. simplicity,\n2. fast,\n3. ease of use.\n\n# Also\n\nSee also another golang implementation\n[vjeantet/grok](https://github.com/vjeantet/grok) that\nis closer to the\n[original](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html)\nlibrary.\n\nThe difference:\n\n1. The grokky allows named captures only. Any name of a pattern is\n  just name of a pattern and nothing more. You can treat is as an\n  alias for regexp. It's impossible to use a name of a pattern as a\n  capture group.  In some cases the grooky is similar to the grok that\n  created as `g, err :=\n  grok.NewWithConfig(\u0026grok.Config{NamedCapturesOnly: true})`.\n\n2. The grokky prefered top named group. If you have two patterns. And\n  the second pattern has same named group and nested into first. Then\n  the named group of the first pattern will be used. The grok uses last\n  (closer to tail) group in any cases. But the grok also has\n  `ParseToMultiMap` method. To see the difference explanation get the\n  package (using `go get -t`) and run the following command\n  `go test -v -run the_difference github.com/logrusorgru/grokky`. Or check\n  out [source code of the test](https://github.com/logrusorgru/grokky/blob/master/bench_test.go#L134).\n\n3. The grokky was designed as a factory of patterns. E.g. compile once and use\n  many times.\n\n# Get it\n\n```\ngo get -u -t github.com/logrusorgru/grokky\n```\n\nRun test case\n\n```\ngo test github.com/logrusorgru/grokky\n```\n\nRun benchmark comparsion with vjeantet/grok\n\n```\ngo test -bench=.* github.com/logrusorgru/grokky\n```\n\n\n# Example\n\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/logrusorgru/grokky\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n)\n\nfunc createHost() grokky.Host {\n\th := grokky.New()\n\t// add patterns to the Host\n\th.Must(\"YEAR\", `(?:\\d\\d){1,2}`)\n\th.Must(\"MONTHNUM2\", `0[1-9]|1[0-2]`)\n\th.Must(\"MONTHDAY\", `(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9]`)\n\th.Must(\"HOUR\", `2[0123]|[01]?[0-9]`)\n\th.Must(\"MINUTE\", `[0-5][0-9]`)\n\th.Must(\"SECOND\", `(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?`)\n\th.Must(\"TIMEZONE\", `Z%{HOUR}:%{MINUTE}`)\n\th.Must(\"DATE\", \"%{YEAR:year}-%{MONTHNUM2:month}-%{MONTHDAY:day}\")\n\th.Must(\"TIME\", \"%{HOUR:hour}:%{MINUTE:min}:%{SECOND:sec}\")\n\treturn h\n}\n\nfunc main() {\n\th := createHost()\n\t// compile the pattern for RFC3339 time\n\tp, err := h.Compile(\"%{DATE:date}T%{TIME:time}%{TIMEZONE:tz}\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor k, v := range p.Parse(time.Now().Format(time.RFC3339)) {\n\t\tfmt.Printf(\"%s: %v\\n\", k, v)\n\t}\n\t//\n\t// Yes, it's better to use time.Parse for time values\n\t// but this is just example.\n\t//\n}\n\n```\n\n# Performance note\n\nDon't complicate regular expressions. Use simplest regular expressions possible.\nHere is example about Nginx access log, combined format:\n\n```go\nh := New()\n\nh.Must(\"NSS\", `[^\\s]*`) // not a space *\nh.Must(\"NS\", `[^\\s]+`)  // not a space +\nh.Must(\"NLB\", `[^\\]]+`) // not a left bracket +\nh.Must(\"NQS\", `[^\"]*`)  // not a double quote *\nh.Must(\"NQ\", `[^\"]+`)   // not a double quote +\n\nh.Must(\"nginx\", `%{NS:remote_addr}\\s\\-\\s`+\n\t`%{NSS:remote_user}\\s*\\-\\s\\[`+\n\t`%{NLB:time_local}\\]\\s\\\"`+\n\t`%{NQ:request}\\\"\\s`+\n\t`%{NS:status}\\s`+\n\t`%{NS:body_bytes_sent}\\s\\\"`+\n\t`%{NQ:http_referer}\\\"\\s\\\"`+\n\t`%{NQ:user_agent}\\\"`)\n\nnginx, err := h.Get(\"nginx\")\nif err != nil {\n\tpanic(err)\n}\n\nfor logLine := range catLogFileLineByLineChannel {\n\tvalues := nginx.Parse(logLine)\n\n\t// stuff\n\n}\n```\n\nor there is a version (thanks for __@nanjj__)\n\n```go\nh := New()\n\nh.Must(\"NSS\", `[^\\s]*`) // not a space *\nh.Must(\"NS\", `[^\\s]+`)  // not a space +\nh.Must(\"NLB\", `[^\\]]+`) // not a left bracket +\nh.Must(\"NQS\", `[^\"]*`)  // not a double quote *\nh.Must(\"NQ\", `[^\"]+`)   // not a double quote +\nh.Must(\"A\", `.*`)       // all (get tail)\n\nh.Must(\"nginx\", `%{NS:clientip}\\s%{NSS:ident}\\s%{NSS:auth}`+\n\t`\\s\\[`+\n\t`%{NLB:timestamp}\\]\\s\\\"`+\n\t`%{NS:verb}\\s`+\n\t`%{NSS:request}\\s`+\n\t`HTTP/%{NS:httpversion}\\\"\\s`+\n\t`%{NS:response}\\s`+\n\t`%{NS:bytes}\\s\\\"`+\n\t`%{NQ:referrer}\\\"\\s\\\"`+\n\t`%{NQ:agent}\\\"`+\n\t`%{A:blob}`)\n\n// [...]\n```\n\n## More performance\n\nSince the\n[`grokky.Pattern`](https://godoc.org/github.com/logrusorgru/grokky#Pattern)\ninherits [`regexp.Regexp`](https://godoc.org/regexp#Regexp), it's possible\nto use methods of the `regexp.Regexp`. E.g. you can to use\n[`FindStringSubmatch`](https://godoc.org/regexp#Regexp.FindStringSubmatch)\nfor example instead of `(grokky.Pattern).Parse`. Or any other method of\nthe `regexp.Regexp`.\n\nCheck out\n[Benchmark_parse_vs_findStringSubmatch](https://github.com/logrusorgru/grokky/blob/master/bench_test.go#L409)\nfor example.\n\nFor my machine result of this becnhmark is (the map is `Parse`, and the slice is\n`FindStringSubmatch`)\n\n```\nmap-4      200000    9980 ns/op    1370 B/op    5 allocs/op\nslice-4    200000    7508 ns/op     416 B/op    2 allocs/op\n```\n\n# Licensing\n\nCopyright © 2016-2018 Konstantin Ivanov \u003ckostyarin.ivanov@gmail.com\u003e  \nThis work is free. It comes without any warranty, to the extent\npermitted by applicable law. You can redistribute it and/or modify\nit under the terms of the Do What The Fuck You Want To Public License,\nVersion 2, as published by Sam Hocevar. See the LICENSE file for\nmore details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogrusorgru%2Fgrokky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogrusorgru%2Fgrokky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogrusorgru%2Fgrokky/lists"}