{"id":24407818,"url":"https://github.com/carlosabalde/libvmod-gossip","last_synced_at":"2025-10-15T06:58:05.768Z","repository":{"id":41292471,"uuid":"133179165","full_name":"carlosabalde/libvmod-gossip","owner":"carlosabalde","description":"VMOD useful to dump customizable information about contents currently stored in the cache to a JSON file","archived":false,"fork":false,"pushed_at":"2025-08-21T13:14:02.000Z","size":150,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-21T15:40:00.830Z","etag":null,"topics":["varnish-cache","vmods"],"latest_commit_sha":null,"homepage":"","language":"C","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/carlosabalde.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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,"zenodo":null}},"created_at":"2018-05-12T20:00:44.000Z","updated_at":"2025-08-21T13:08:12.000Z","dependencies_parsed_at":"2024-01-05T16:27:52.825Z","dependency_job_id":"dcf6db47-bbcc-4d5d-937d-0a8098148afc","html_url":"https://github.com/carlosabalde/libvmod-gossip","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/carlosabalde/libvmod-gossip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosabalde%2Flibvmod-gossip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosabalde%2Flibvmod-gossip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosabalde%2Flibvmod-gossip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosabalde%2Flibvmod-gossip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carlosabalde","download_url":"https://codeload.github.com/carlosabalde/libvmod-gossip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosabalde%2Flibvmod-gossip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279058704,"owners_count":26094844,"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":"2025-10-15T02:00:07.814Z","response_time":56,"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":["varnish-cache","vmods"],"created_at":"2025-01-20T05:18:07.939Z","updated_at":"2025-10-15T06:58:05.764Z","avatar_url":"https://github.com/carlosabalde.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n.. image:: https://github.com/carlosabalde/libvmod-gossip/actions/workflows/main.yml/badge.svg?branch=main\n   :alt: GitHub Actions CI badge\n   :target: https://github.com/carlosabalde/libvmod-gossip/actions\n.. image:: https://codecov.io/gh/carlosabalde/libvmod-gossip/branch/main/graph/badge.svg\n   :alt: Codecov badge\n   :target: https://codecov.io/gh/carlosabalde/libvmod-gossip\n\nVMOD useful to dump customizable information about contents currently stored in the cache to a JSON file for subsequent analysis in order to consider better caching strategies.\n\nLooking for official support for this VMOD? Please, contact `Allenta Consulting \u003chttps://www.allenta.com\u003e`_, a `Varnish Software Premium partner \u003chttps://www.varnish-software.com/partner/allenta-consulting\u003e`_.\n\nSYNOPSIS\n========\n\nimport gossip;\n\n::\n\n    Function VOID dump(STRING file, BOOL discard=1)\n\n    Function VOID discard()\n\n    Function STRING escape_json_string(STRING value)\n\nEXAMPLE\n=======\n\n/etc/varnish/default.vcl\n------------------------\n\n::\n\n    vcl 4.0;\n\n    import gossip;\n    import std;\n\n    backend default {\n        .host = \"127.0.0.1\";\n        .port = \"8080\";\n    }\n\n    acl local_acl {\n        \"localhost\";\n    }\n\n    sub vcl_recv {\n        if (req.url ~ \"^/gossip/(?:dump/.+|discard/)$\") {\n            if (client.ip ~ local_acl) {\n                if (req.url ~ \"^/gossip/dump/.+\") {\n                    set req.http.X-Gossip-File = regsub(\n                        regsub(req.url, \"^/gossip/dump\", \"\"),\n                        \"\\?.*$\",\n                        \"\");\n                    if (req.url ~ \"[?\u0026]discard=[^\u0026]*\") {\n                        set req.http.X-Gossip-Discard = regsub(\n                            req.url,\n                            \"^.*[?\u0026]discard=([^\u0026]*).*$\",\n                            \"\\1\");\n                    }\n                    gossip.dump(\n                        req.http.X-Gossip-File,\n                        std.integer(req.http.X-Gossip-Discard, 1) \u003e 0);\n                    return (synth(200, \"Now dumping.\"));\n                } elsif (req.url == \"/gossip/discard/\") {\n                    gossip.discard();\n                    return (synth(200, \"Discarded.\"));\n                } else {\n                    return (synth(404, \"Not found.\"));\n                }\n            } else {\n                return (synth(405, \"Not allowed.\"));\n            }\n        }\n    }\n\n    sub vcl_deliver {\n        unset resp.http.X-Gossip-Info;\n    }\n\n    sub vcl_backend_response {\n        set beresp.http.X-Gossip-Info =\n            {\"{\"} +\n            {\"\"tst\":\"} + std.time2real(now, 0) + {\",\"} +\n            {\"\"url\":\"\"} + gossip.escape_json_string(bereq.http.Host + bereq.url) + {\"\",\"} +\n            {\"\"device\":\"\"} + gossip.escape_json_string(bereq.http.X-Device) + {\"\",\"} +\n            {\"\"ip\":\"\"} + gossip.escape_json_string(client.ip) + {\"\"\"} +\n            {\"}\"};\n\n        set beresp.ttl = 1h;\n        set beresp.grace = 24h;\n    }\n\nDump cache contents\n-------------------\n\n::\n\n    $ curl http://127.0.0.1/gossip/dump/tmp/objects.json?discard=0\n\n    $ cat /tmp/objects.json\n    {\"tst\":0.000000,\"now\":1527154240.137104}\n    ...\n    {\"info\":{\"tst\":1527154237.470,\"url\":\"127.0.0.1/foo\",\"device\":\"desktop\",\"ip\":\"127.0.0.1\"},\"hits\":42,\"ttl\":3597.545651,\"grace\":86400.000000,\"keep\":0.000000}\n    {\"info\":{\"tst\":1527154237.483,\"url\":\"127.0.0.1/bar\",\"device\":\"desktop\",\"ip\":\"127.0.0.1\"},\"hits\":314,\"ttl\":3597.651994,\"grace\":86400.000000,\"keep\":0.000000}\n    {\"info\":{\"tst\":1527154237.494,\"url\":\"127.0.0.1/bar\",\"device\":\"mobile\",\"ip\":\"127.0.0.1\"},\"hits\":271,\"ttl\":3597.558113,\"grace\":86400.000000,\"keep\":0.000000}\n\n    $ curl http://127.0.0.1/gossip/dump/tmp/objects.json?discard=1\n\n    $ cat /tmp/objects.json\n    {\"tst\":0.000000,\"now\":1527154241.506256}\n    ...\n    {\"tst\":1527154237.470,\"url\":\"127.0.0.1/foo\",\"device\":\"desktop\",\"ip\":\"127.0.0.1\"}\n    {\"tst\":1527154237.483,\"url\":\"127.0.0.1/bar\",\"device\":\"desktop\",\"ip\":\"127.0.0.1\"}\n    {\"tst\":1527154237.494,\"url\":\"127.0.0.1/bar\",\"device\":\"mobile\",\"ip\":\"127.0.0.1\"}\n\nINSTALLATION\n============\n\nThe source tree is based on autotools to configure the building, and does also have the necessary bits in place to do functional unit tests using the varnishtest tool.\n\n**Beware this project contains multiples branches (main, 4.1, etc.). Please, select the branch to be used depending on your Varnish Cache version (Varnish trunk → main, Varnish 4.1.x → 4.1, etc.).**\n\nCOPYRIGHT\n=========\n\nSee LICENSE for details.\n\nBSD's implementation of the red–black tree and the splay tree data structures by Niels Provos has been borrowed from the `Varnish Cache project \u003chttps://github.com/varnishcache/varnish-cache\u003e`_:\n\n* https://github.com/varnishcache/varnish-cache/blob/master/include/vtree.h\n\nCopyright (c) Carlos Abalde \u003ccarlos.abalde@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlosabalde%2Flibvmod-gossip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlosabalde%2Flibvmod-gossip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlosabalde%2Flibvmod-gossip/lists"}