{"id":21631840,"url":"https://github.com/katef/liblf","last_synced_at":"2025-03-18T21:45:07.139Z","repository":{"id":80763238,"uuid":"104151334","full_name":"katef/liblf","owner":"katef","description":"Apache LogFormat log format format parsing library","archived":false,"fork":false,"pushed_at":"2022-05-16T04:15:20.000Z","size":61,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-24T23:43:07.965Z","etag":null,"topics":["apache","apache-httpd","fmtstring","logfmt","logfmt-parser","logformat","logs","parser","parser-library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katef.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,"publiccode":null,"codemeta":null}},"created_at":"2017-09-20T01:48:06.000Z","updated_at":"2022-05-16T04:15:24.000Z","dependencies_parsed_at":"2023-02-27T18:15:43.400Z","dependency_job_id":null,"html_url":"https://github.com/katef/liblf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katef%2Fliblf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katef%2Fliblf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katef%2Fliblf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katef%2Fliblf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katef","download_url":"https://codeload.github.com/katef/liblf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244312968,"owners_count":20433002,"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","apache-httpd","fmtstring","logfmt","logfmt-parser","logformat","logs","parser","parser-library"],"created_at":"2024-11-25T02:15:34.208Z","updated_at":"2025-03-18T21:45:07.120Z","avatar_url":"https://github.com/katef.png","language":"C","readme":"\n## liblf: A parser for the syntax used by Apache's LogFormat Directive\n\nThe LogFormat directive provides a printf-like syntax for specifying\nuser-defined custom formats for log messages. It's intended for logs\nabout HTTP traffic, and includes formatting for IP addresses, response\nstatus, and other relevant things.\n\nThere's an [EBNF grammar for the syntax](doc/logfmt.ebnf).\n[Apache's documentation](https://httpd.apache.org/docs/current/mod/mod_log_config.html#formats)\nis the authoritative reference for the various format directives.\n\n## What would I use it for?\n\nMaybe you're writing a daemon that serves requests (not necessarily HTTP)\nand you'd like to give your users a familiar-feeling syntax for\nconfiguring what to log. Or perhaps you're writing a tool to convert\nApache configurations to another system.\n\nYou can disable the directives you don't need, and add custom ones.\n\n## How do I use it?\n\nThis library aims to provide a complete implementation, presenting an\nAPI independent of any particular source for data, and of any particular\noutput. The entry point is lf_parse(), which calls various callbacks as\nit parses each part of the format string. See [\u003clf.h\u003e](include/lf/lf.h)\nfor the API.\n\n* As a parser: Have your callbacks store the data,\n  and act on it later.\n* As an interpreter: Parse log format strings whilst serving a request,\n  and have your callbacks output the relevant items immediately.\n* As a compiler: Parse log format strings ahead of time, and output\n  generated code.\n\nThere's an example program which just prints out directives as they come.\nYou get pretty decent error messages:\n```\n; lfdump '%{}e %v %h %l %u %t \\\"%r\\\" %\u003es %b %{user-agent}i'\nerror: Empty name\nat 1: '%{}e %v %h %l %u %t \\\"%r\\\" %\u003es %b %{user-agent}i'\n--------^^\n```\n\nRelated projects:\n\n * This C library is an independent implementation, and uses no code from\n   [Apache's original implementation](https://github.com/apache/httpd/blob/trunk/modules/loggers/mod_log_config.c).\n * Kazeburo's [Apache::LogFormat::Compiler](https://github.com/kazeburo/Apache-LogFormat-Compiler),\n   the inspiration for this project.\n * Miyagawa's [port of Apache::LogFormat::Compiler to Go](https://github.com/miyagawa/go-apache-logformat).\n\n\nClone with submodules (contains required .mk files):\n\n    ; git clone --recursive https://github.com/katef/liblf.git\n\nTo build and install:\n\n    ; pmake -r install\n\nYou can override a few things:\n\n    ; CC=clang PREFIX=$HOME pmake -r install\n\nBuilding depends on:\n\n * Any BSD make. This includes OpenBSD, FreeBSD and NetBSD make(1)\n   and sjg's portable bmake (also packaged as pmake).\n\n * A C compiler. Any should do, but GCC and clang are best supported.\n\n * ar, ld, and a bunch of other stuff you probably already have.\n\nFuzzing depends on:\n\n * [Radamsa](https://gitlab.com/akihe/radamsa)\n * [Blab](https://github.com/aoh/blab)\n * [KGT](https://github.com/katef/kgt)\n\n```\n; pmake -r CC=gcc DEBUG=1 \u0026\u0026 pmake VERBOSE=1 -r fuzz\n```\n\nIdeas, comments or bugs: kate@elide.org\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatef%2Fliblf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatef%2Fliblf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatef%2Fliblf/lists"}