{"id":19458500,"url":"https://github.com/postgrespro/pg_logging","last_synced_at":"2025-04-25T06:30:28.103Z","repository":{"id":69542807,"uuid":"136713558","full_name":"postgrespro/pg_logging","owner":"postgrespro","description":"PostgreSQL logging interface","archived":false,"fork":false,"pushed_at":"2018-12-27T10:21:42.000Z","size":58,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-24T10:48:42.738Z","etag":null,"topics":["logging","monitoring","postgresql"],"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/postgrespro.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":"2018-06-09T10:29:36.000Z","updated_at":"2022-09-26T17:32:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"44cb416e-4241-4488-a8f4-44b8c4b2d6bd","html_url":"https://github.com/postgrespro/pg_logging","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/postgrespro%2Fpg_logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fpg_logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgrespro","download_url":"https://codeload.github.com/postgrespro/pg_logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250766957,"owners_count":21483894,"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":["logging","monitoring","postgresql"],"created_at":"2024-11-10T17:27:22.009Z","updated_at":"2025-04-25T06:30:28.088Z","avatar_url":"https://github.com/postgrespro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/postgrespro/pg_logging.svg?branch=master)](https://travis-ci.org/postgrespro/pg_logging)\n[![GitHub license](https://img.shields.io/badge/license-PostgreSQL-blue.svg)](https://raw.githubusercontent.com/postgrespro/pg_logging/master/LICENSE)\n\npg_logging\n=================\n\nPostgreSQL logging interface.\n\nInstallation\n-------------\n\n    # make sure that directory with pg_config in PATH or specify it with PG_CONFIG variable\n    make install\n\n    # in postgresql.conf add:\n    shared_preload_libraries = 'pg_logging'\n\n    # install the extension\n    \u003e CREATE EXTENSION pg_logging;\n\nAvailable functions\n--------------------\n\n    get_log(\n        flush               bool default true\n    )\n\n    get_log(\n        from_position       int\n    )\n\nThis function is used to fetch the logged information. The information is\nsimilar to the data that postgres writes to log files.\n\n`flush` means that fetched data will not be returned on next query calls. By\ndefault it's true.\n\n`from_position` is used as fail-safe case, when a client specifies until\nwhich position it already has data. This position should be equal to\n`position` field from `log_item`. If there was wraparound there is a chance\nthat the position will be invalid and query will raise an error. In this case\nthe client should use `get_log(flush bool)` function (and possibly increase\nthe ring buffer size).\n\nLogs are stored in the ring buffer which means that non fetched data will\nbe rewritten in the buffer wraparounds. Since reading position should be\naccordingly moved on each rewrite it could slower down the database.\n\n`get_log` function returns rows of `log_item` type. `log_item` is specified as:\n\n    create type log_item as (\n        log_time            timestamp with time zone,\n        level               int,\n        pid                 int,\n        line_num            bigint,                     /* log line number */\n        appname             text,\n        start_time          timestamp with time zone,   /* backend start time */\n        datid               oid,                        /* database id */\n        errno               int,\n        errcode             int,\n        errstate            text,\n        message             text,\n        detail              text,\n        detail_log          text,\n        hint                text,\n        context             text,\n        context_domain      text,\n        domain              text,\n        internalpos         int,\n        internalquery       text,\n        userid              oid,\n        remote_host         text,\n        command_tag         text,\n        vxid                text,                       /* virtual transaction id */\n        txid                bigint,                     /* transaction id */\n        query               text,\n        query_pos           int,\n        position            int\n    );\n\n`error_level` type\n-------------------\n\nThe extension installs special type called `error_level` which can be used to\nget textual representation of `level` field from `log_item`. To do that\njust add something like `level::error_level` to the columns list in your query.\n\n\nOptions\n---------\n\n    pg_logging.buffer_size (10240) - size of internal ring buffer in kilobytes.\n    pg_logging.enabled (on) - enables or disables the logging.\n    pg_logging.ignore_statements (off) - skip statements lines if `log_statement=all`\n    pg_logging.set_query_fields (on) - set query and query_pos fields.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fpg_logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgrespro%2Fpg_logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fpg_logging/lists"}