{"id":43154684,"url":"https://github.com/jackjoe/mailgun_logger","last_synced_at":"2026-02-01T00:34:07.580Z","repository":{"id":46021662,"uuid":"238761537","full_name":"jackjoe/mailgun_logger","owner":"jackjoe","description":"Simple Mailgun log persistence in Phoenix/Elixir","archived":false,"fork":false,"pushed_at":"2025-02-21T12:02:53.000Z","size":1213,"stargazers_count":74,"open_issues_count":3,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-21T13:19:58.799Z","etag":null,"topics":["elixir","mailgun","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jackjoe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-02-06T18:57:44.000Z","updated_at":"2025-02-21T12:02:59.000Z","dependencies_parsed_at":"2024-12-13T12:22:58.878Z","dependency_job_id":"134e54e3-9223-4aad-86fc-d42331b428c5","html_url":"https://github.com/jackjoe/mailgun_logger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jackjoe/mailgun_logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackjoe%2Fmailgun_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackjoe%2Fmailgun_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackjoe%2Fmailgun_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackjoe%2Fmailgun_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackjoe","download_url":"https://codeload.github.com/jackjoe/mailgun_logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackjoe%2Fmailgun_logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28962082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T23:03:11.038Z","status":"ssl_error","status_checked_at":"2026-01-31T22:56:44.691Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["elixir","mailgun","self-hosted"],"created_at":"2026-02-01T00:34:07.135Z","updated_at":"2026-02-01T00:34:07.568Z","avatar_url":"https://github.com/jackjoe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mailgun Logger\n\n**BREAKING**\n\nSince the 2305.1.0 release we are no longer saving the actual stored message (the raw data) as it has proven to put too much stress on the db without any added value. There is a config option `store_message` that, if set to `true` also requires an AWS config to be added. Then the raw messages will be stored in an S3 bucket.\nAlso, the `stored_message` data column should be regarded as deprecated and will be removed via a migration in a future release.\n\n**Note**\n\nSince version 2302.1.0 (Feb 2023) the database has switched from MySQL to PostgreSQL.\n\n\u003cdiv align=\"center\" width=\"100%\"\u003e\n  \u003cimg src=\"./public/logo.svg\" width=\"128\" alt=\"\" /\u003e\n\u003c/div\u003e\n\n[![Build Status](https://app.travis-ci.com/jackjoe/mailgun_logger.svg?branch=master)](https://app.travis-ci.com/jackjoe/mailgun_logger)\n\nSimple Mailgun log persistence in Phoenix/Elixir.\n\nMailgunLogger is a simple admin tool that uses the Mailgun API to retrieves events on a regular basis from Mailgun - who only provide a limited time of event storage - and stores them inside a PostgreSQL database.\nFor efficiency and less complexity, it retrieves events for the last two days (free accounts offer up to three days of persistence) and then inserts everything. Only new events will pass the unique constraint on the db.\n\nThis is done because, as stated in the Mailgun docs, it is not guaranteed that for a given time period, all actual events will be ready, since some take time to get into the system although they already happened.\n\nAn AWS bucket can be configured to store the raw messages on S3.\n\nSee the docs for implementation details.\n\n_**IMPORTANT**_\n\n_This application is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Mailgun, or any of its subsidiaries or its affiliates. The official Mailgun website can be found at [Mailgun](https://mailgun.com)._\n\n_This is NOT meant as a replacement for the excellent online tooling provided by Mailgun. Just simple storage, that's it._\n\n_Jack + Joe is not responsible for your use of this tool, neither for any persistence guarantees. Free comes at a price :)_\n\n## Versioning\n\nWe use a simplified version numbering in the format of:\n\n```\nYYMM.MAJOR.MINOR\n```\n\nWhere minor version bumps are consider to be hotfixes or small patches, major are bigger changes. For example:\n\n```\n2202.3.1 -\u003e 2022, Februari, third major release, hotfix number 1.\n```\n\nEvery month the major and minor versions are reset to zero, but start with one:\n\n```\n2202.4.0\n2202.4.1\n2202.5.0\n2203.1.0\n2203.2.0\n2203.3.0\n2203.3.1\n2203.3.2\n2203.4.0\n2204.1.0\n...\n```\n\n## Installation\n\nMailgunLogger is available as a Docker image at [Docker](https://hub.docker.com/r/jackjoe/mailgun_logger).\n\n### Variables\n\nFollowing variables are available:\n\n[Required]\n\n- **ML_DB_USER**: database user\n- **ML_DB_PASSWORD**: database password\n- **ML_DB_NAME**: database name\n- **ML_DB_HOST**: database host\n\n[Optional]\n\n- **ML_STORE_MESSAGES**: when true, persist messages to the S3 bucket described below, defaults to false\n- **ML_PAGESIZE**: events per page\n- **ML_LOG_LEVEL**: log level (info, debug, warn, ...)\n- **MAILGUN_API_KEY**: to send the password reset email\n- **MAILGUN_DOMAIN**: to send the password reset email\n- **MAILGUN_FROM**: to send the password reset email\n- **MAILGUN_REPLY_TO**: to send the password reset email\n- **AWS_ACCESS_KEY_ID**: AWS key\n- **AWS_SECRET_ACCESS_KEY**: AWS access key\n- **AWS_REGION**: AWS region (e.g.: `eu-central-1`)\n- **AWS_BUCKET**: AWS bucket\n- **AWS_PORT**: AWS port (e.g.: 443)\n- **AWS_SCHEME**: AWS scheme (e.g.: `https`)\n- **AWS_ASSET_HOST**: AWS asset host name (e.g.: `http://files.yourdomain.com.s3.amazonaws.com/`)\n- **AWS_HOST**: AWS host (e.g.: `s3.eu-central-1.amazonaws.com`)\n- **RAW_PATH**: path from bucket root to store the messages on AWS\n\n### Docker\n\n```bash\n$ docker run -d -p 5050:5050 \\\n  -e \"ML_DB_USER=username\" \\\n  -e \"ML_DB_PASSWORD=password\" \\\n  -e \"ML_DB_NAME=mailgun_logger\" \\\n  -e \"ML_DB_HOST=my_db_host\" \\\n  --name mailgun_logger jackjoe/mailgun_logger\n```\n\n### Docker Compose\n\nWith the following `docker-compose.yml`:\n\n```yml\nversion: \"3\"\n\nservices:\n  db:\n    image: postgres\n    networks:\n      - webnet\n    environment:\n      - POSTGRES_PASSWORD=logger\n      - POSTGRES_USER=logger\n      - POSTGRES_DATABASE=mailgun_logger\n    volumes:\n      - db_data:/var/lib/postgresql/data\n\n  web:\n    image: jackjoe/mailgun_logger\n    depends_on:\n      - db\n    entrypoint: [\"./wait-for\", \"db:5432\", \"--\", \"./start.sh\"]\n    ports:\n      - \"5050:5050\"\n    networks:\n      - webnet\n    environment:\n      - \"ML_DB_USER=logger\"\n      - \"ML_DB_PASSWORD=logger\"\n      - \"ML_DB_NAME=mailgun_logger\"\n      - \"ML_DB_HOST=db\"\n      - \"MAILGUN_API_KEY=*****\"\n      - \"MAILGUN_DOMAIN=m.mydomain.be\"\n      - \"AWS_ACCESS_KEY_ID=******\"\n      - \"AWS_SECRET_ACCESS_KEY=******\"\n      - \"AWS_REGION=eu-central-1\"\n      - \"AWS_BUCKET=*****\"\n      - \"AWS_PORT=443\"\n      - \"AWS_SCHEME=https://\"\n      - \"AWS_ASSET_HOST=*****\"\n      - \"AWS_HOST=s3.eu-central-1.amazonaws.com\"\n      - \"RAW_PATH=mailgun_logger/messages\"\n\nnetworks:\n  webnet:\n    external: false\n\nvolumes:\n  db_data: {}\n```\n\nRun:\n\n```bash\n$ docker-compose up\n```\n\nThen head over to [http://0.0.0.0:5050](http://0.0.0.0:5050).\n\n### Postgresql tip\n\nIf you find yourself with many events in your database and a slow search, consider installing the [**pg_trm** extension](https://www.postgresql.org/docs/current/pgtrgm.html).\nAdding an index on these 3 fields will give you a huge speed gain:\n\n```mysql\nCREATE EXTENSION pg_trgm;\n\nCREATE INDEX events_recipient_gin_trgm_idx ON events USING gin (recipient gin_trgm_ops);\nCREATE INDEX events_message_from_gin_trgm_idx ON events USING gin (message_from gin_trgm_ops);\nCREATE INDEX events_message_subject_gin_trgm_idx ON events USING gin (message_subject gin_trgm_ops);\n```\n\n## Contributing\n\nTo run on your local machine, you need to setup shop first.\nMailgun Logger requires a PostgreSQL database using the following environment variables along with their defaults:\n\n```elixir\n# config/config.ex\nconfig :mailgun_logger, MailgunLogger.Repo,\n  username: System.get_env(\"ML_DB_USER\", \"mailgun_logger_ci\"),\n  password: System.get_env(\"ML_DB_PASSWORD\", \"johndoe\"),\n  database: System.get_env(\"ML_DB_NAME\", \"mailgun_logger_ci_test\"),\n  hostname: System.get_env(\"ML_DB_HOST\", \"localhost\"),\n```\n\nEither export your own enviroment variables or adhere to the defaults. Then, for convenience, run:\n\n```bash\n# runs mix local.hex, deps.get, compile; install dev certificates, make run (see below)\n$ make install\n```\n\nwhich will install all dependencies and setup local dev https certificates using `phx.cert`.\n\nNext you need to run the migrations and seeder:\n\n```bash\n$ source .env \u0026\u0026 mix ecto.migrate\n$ source .env \u0026\u0026 mix run priv/repo/seeds.exs\n```\n\nThen you can run the project:\n\n```bash\n# runs `iex -S mix phx.server`\n$ make run\n```\n\nAll of the make targets are convenience wrappers around `mix`, feel free to run your own. If you are using your own environment variables, consider gathering them in an `.env` file and source that prior to running the make command:\n\n```bash\n# non POSIX uses `source` instead of `.`\n$ . .env \u0026\u0026 make run\n```\n\nThen head over to [https://0.0.0.0:7070](https://0.0.0.0:7070).\n\n## TODO\n\n- [ ] test coverage\n- [ ] provide generic logging agent? (no papertrail)\n\n## License\n\nThis software is licensed under [the MIT license](LICENSE).\n\n## About Jack + Joe\n\nMailgunLogger is our very first open source project, and we are excited to get it out! We love open source and contributed to various tools over the years, and now we have our own! We use it ourselves as well.\n\nOur [announcement article](https://jackjoe.be/articles/mailgun-logger).\n\nGet to know our projects, get in touch. [jackjoe.be](https://jackjoe.be)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackjoe%2Fmailgun_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackjoe%2Fmailgun_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackjoe%2Fmailgun_logger/lists"}