{"id":21500654,"url":"https://github.com/podium/uinta","last_synced_at":"2025-07-15T22:31:56.913Z","repository":{"id":38988448,"uuid":"247760210","full_name":"podium/uinta","owner":"podium","description":"Simpler structured logs and lower log volume for Elixir apps","archived":false,"fork":false,"pushed_at":"2024-03-26T16:05:27.000Z","size":106,"stargazers_count":17,"open_issues_count":0,"forks_count":10,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-03-26T17:27:44.551Z","etag":null,"topics":["elixir","elixir-lang","logger","logging"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/uinta","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/podium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-03-16T16:12:07.000Z","updated_at":"2024-04-15T16:11:32.470Z","dependencies_parsed_at":"2023-11-08T05:54:01.792Z","dependency_job_id":"17c3a12a-66fc-4d8c-9615-7c4cff102b34","html_url":"https://github.com/podium/uinta","commit_stats":{"total_commits":52,"total_committers":11,"mean_commits":"4.7272727272727275","dds":0.6538461538461539,"last_synced_commit":"078fd94b793d1d5dc5d883f037d60574bfd1ae03"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fuinta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fuinta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fuinta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podium%2Fuinta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/podium","download_url":"https://codeload.github.com/podium/uinta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226077587,"owners_count":17570163,"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":["elixir","elixir-lang","logger","logging"],"created_at":"2024-11-23T17:43:01.332Z","updated_at":"2024-11-23T17:43:01.794Z","avatar_url":"https://github.com/podium.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uinta\n\n[![Build Status](https://github.com/podium/uinta/actions/workflows/ci.yml/badge.svg)](https://github.com/podium/uinta/actions/workflows/ci.yml) [![Hex.pm](https://img.shields.io/hexpm/v/uinta.svg)](https://hex.pm/packages/uinta) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/uinta)\n[![Total Download](https://img.shields.io/hexpm/dt/uinta.svg)](https://hex.pm/packages/uinta)\n[![License](https://img.shields.io/hexpm/l/uinta.svg)](https://github.com/podium/uinta/blob/master/LICENSE.md)\n\nUinta is a plugin for the default Elixir logger that lowers log volume while\nmaximizing log usefulness. It is not a logger backend, but rather includes\n`Uinta.Formatter` which will format logs on top of the default Elixir logger\nbackend.\n\nIn addition to the formatter, Uinta also includes `Uinta.Plug`. The plug is a\ndrop-in replacement for `Plug.Logger` that will log out the request and response\non a single line. It can also put the request info into the top-level JSON for\neasier parsing by your log aggregator.\n\n## Why Uinta?\n\nAt Podium we log millions of lines per minute and store around a terabyte of log\ndata per day. A large percentage of those lines are the typical `GET /` and\n`Sent 200 in 2ms` that `Phoenix.Logger` sends by default. By combining those\ninto a single line, we're able to cut out that percentage of lines so that the\nindexes in our Elasticsearch cluster will be smaller and searches will be\nfaster.\n\nIn addition, about 2/3 of those requests are GraphQL requests. Their first log\nline simply says `POST /graphql` every time, which gives us no insight into what\nthe request is actually doing. `Uinta.Plug` will extract GraphQL query names\nwhen they exist to make these log lines more useful without having to enable\ndebug logs: `QUERY messagesForLocation (/graphql)` or `MUTATION createMessage (/graphql)`.\n\nFor smaller organizations, the ability to filter out lines pertaining to certain\nrequests paths can also be useful to cut down on log noise. Kubernetes health\nchecks and other requests don't usually need to show up in the logs, so\n`Uinta.Plug` allows you to ignore certain paths as long as they return a\n200-level status code.\n\nWhen set up to do so, Uinta will additionally wrap the log line in a JSON object\nso that it can more easily be parsed by Fluentbit and other log parsers. This\nincreases log line size, but improves searchability and makes logs more useful.\n\n## Installation\n\nThe package can be installed by adding `uinta` to your list of dependencies in\n`mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:uinta, \"~\u003e 0.6\"}\n  ]\nend\n```\n\n### Available Formatters\n\n#### Standard\n\nNo special formatting or fields, good for general use.\n\nModule: `Uinta.Formatter` (or `Uinta.Formatter.Standard`)\n\n#### Datadog\n\nAdds Datadog specific metadata to the log output. See the module for more setup information and details.\n\nModule: `Uinta.Formatter.Datadog`\n\nTo enable the full log format to use DataDog log service, just use `include_datadog_fields: true` in your plug initialization\n\n### Formatter Installation\n\nTo use the formatter, you'll need to add it to your logger configuration. In\nyour (production) config file, look for a line that looks something like\nthis:\n\n```elixir\nconfig :logger, :console, format: \"[$level] $message\\\\n\"\n```\n\nYou'll want to replace it with this:\n\n```elixir\nconfig :logger, :console, format: {Uinta.Formatter, :format}\n```\n\n### Plug Installation\n\nInstallation of the plug will depend on how your app currently logs requests.\nOpen `YourApp.Endpoint` and look for the following line:\n\n```elixir\nplug Plug.Logger\n```\n\nIf it exists in your endpoint, replace it with this (using the options you\nwant):\n\n```elixir\nplug Uinta.Plug, format: :string, log: :info\n```\n\nYou can also perform log sampling by setting the `success_log_sampling_ratio`. Following is a 20% log sampling\n\n```elixir\nplug Uinta.Plug, success_log_sampling_ratio: 0.2\n```\n\nIf your endpoint didn't call `Plug.Logger`, add the above line above the line\nthat looks like this:\n\n```elixir\nplug Plug.RequestId\n```\n\nNow you will also want to add the following anywhere in your main config file to\nmake sure that you aren't logging each request twice:\n\n```elixir\nconfig :phoenix, logger: false\n```\n\n## Attribution\n\nMuch of this work, especially `Uinta.Plug`, is based on Elixir's\n[`Plug.Logger`](https://github.com/elixir-plug/plug/blob/v1.9.0/lib/plug/logger.ex)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodium%2Fuinta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpodium%2Fuinta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodium%2Fuinta/lists"}