{"id":15010098,"url":"https://github.com/smartrent/ramoops_logger","last_synced_at":"2025-04-09T17:54:01.564Z","repository":{"id":35008786,"uuid":"168729934","full_name":"smartrent/ramoops_logger","owner":"smartrent","description":"Elixir Logger Backend that writes to the Linux Ramoops driver","archived":false,"fork":false,"pushed_at":"2023-04-11T00:05:43.000Z","size":61,"stargazers_count":11,"open_issues_count":4,"forks_count":2,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-01T03:37:57.178Z","etag":null,"topics":["elixir","elixir-logger","linux"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartrent.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":"2019-02-01T16:51:04.000Z","updated_at":"2024-07-30T01:21:39.000Z","dependencies_parsed_at":"2024-09-28T17:20:33.397Z","dependency_job_id":null,"html_url":"https://github.com/smartrent/ramoops_logger","commit_stats":{"total_commits":61,"total_committers":7,"mean_commits":8.714285714285714,"dds":0.5737704918032787,"last_synced_commit":"194a0078318c79105bcce95038b8e6146a08fb12"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartrent%2Framoops_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartrent%2Framoops_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartrent%2Framoops_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartrent%2Framoops_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartrent","download_url":"https://codeload.github.com/smartrent/ramoops_logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248083558,"owners_count":21045122,"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-logger","linux"],"created_at":"2024-09-24T19:30:09.967Z","updated_at":"2025-04-09T17:54:01.546Z","avatar_url":"https://github.com/smartrent.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RamoopsLogger\n\n[![CircleCI](https://circleci.com/gh/smartrent/ramoops_logger/tree/main.svg?style=svg)](https://circleci.com/gh/smartrent/ramoops_logger/tree/main)\n[![Hex version](https://img.shields.io/hexpm/v/ramoops_logger.svg \"Hex version\")](https://hex.pm/packages/ramoops_logger)\n\nThis is an Elixir Logger backend for forwarding log messages to the [ramoops\nlogger](https://www.kernel.org/doc/html/v4.19/admin-guide/ramoops.html) on Linux\nand Nerves systems. Messages sent to this log are written to a special area of\nDRAM that can be recovered after reboots or very short power outages.\n\nHere's a demo video:\n\n[![RamoopsLogger Demo](http://img.youtube.com/vi/vpD511Bk5rU/0.jpg)](http://www.youtube.com/watch?v=vpD511Bk5rU)\n\n## Configuration\n\nRamoopsLogger uses the Linux `pstore` device driver, so it only works on\nLinux-based platforms. Most official Nerves Projects systems start the `pstore`\ndriver automatically and you can skip the Linux configuration.\n\n### Linux configuration\n\nThe most important part of using the RamoopsLogger is ensuring that the `pstore`\ndevice driver is enabled and configured in your Linux kernel. The device driver\nwrites logs to a fixed location in DRAM that is platform-specific. If you are\nlucky, someone will have determined a good place to store the logs. The official\nNerves Project systems all have a small amount of memory allocated for use by\nthe `pstore` driver. If you are not using Nerves, it's possible that one of the\ndevice tree files (for ARM platforms) may be helpful.\n\nIf you're not using an official Nerves system, here's an example device tree\nfragment that would need to be updated for your device, but may be helpful as a\nstart.\n\n```c\nreserved-memory {\n        #address-cells = \u003c1\u003e;\n        #size-cells = \u003c1\u003e;\n        ranges;\n\n        ramoops@88d00000{\n                compatible = \"ramoops\";\n                reg = \u003c0x88d00000 0x100000\u003e;\n                ecc-size = \u003c16\u003e;\n                record-size     = \u003c0x00020000\u003e;\n                console-size    = \u003c0x00020000\u003e;\n                ftrace-size     = \u003c0\u003e;\n                pmsg-size       = \u003c0x00020000\u003e;\n        };\n};\n```\n\nOne way of testing whether the `pstore` driver is available is to check whether\nthe `/dev/pmsg0` file exists.\n\n### Update your Elixir project\n\nOnce you're satisfied with the Linux, add `ramoops_logger` to your project's\n`mix.exs` dependencies list.\n\n```elixir\ndef deps do\n  [\n    {:ramoops_logger, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\nNext, update your `config.exs` to tell the Elixir Logger to send log messages to\nthe `RamoopsLogger`:\n\n```elixir\nuse Mix.Config\n\n# Add the RamoopsLogger backend. If you already have a logger configuration, to add\n# RamoopsLogger the only change needed is to add RamoopsLogger to the :backends list.\nconfig :logger, backends: [RamoopsLogger, :console]\n```\n\n## IEx Session Usage\n\nTo read the last ramoops log to the console run:\n\n```elixir\niex\u003e RamoopsLogger.dump()\n```\n\nTo read the last ramoops log and it to a variable run:\n\n```elixir\niex\u003e {:ok, contents} = RamoopsLogger.read()\n```\n\n## Nerves Automatic Log Check\n\nIf you want to have your system check if there is an oops log available, and you\nare using Nerves, you can add this to your `rootfs_overlay/etc/iex.exs` file in\nyour firmware project:\n\n```elixir\nif RamoopsLogger.available_log?() do\n  IO.puts(\"Oops! There's something in the oops log. Check with RamoopsLogger.dump()\")\nend\n```\n\n## License\n\nCopyright (C) 2020-21 SmartRent\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartrent%2Framoops_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartrent%2Framoops_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartrent%2Framoops_logger/lists"}