Exporting data from elmah.io
A common request through the elmah.io support is: how do I export my data?
The reasons for exporting data may be:
- Import into Excel or similar for custom processing and graphing.
- Backup of old data.
- Switch to another error management system.
Let's make one thing clear. The log messages you ship to elmah.io are yours. That's why we want to make it as simple as possible to pull our data from elmah.io. We looked at creating a UI for the purpose, but exporting something like a GB of data from a website never works very well.
Let me introduce you to the elmah.io CLI. elmah.io CLI is a command-line interface for a range of various tasks like exporting data from elmah.io. It's implemented in .NET Core and therefore works on all supported operating systems.
You can download the recent version from GitHub or install it as a .NET Global Tool:
dotnet tool install --global Elmah.Io.Cli
Then run the export
command to start exporting log messages from elmah.io:
elmahio export --apiKey API_KEY --logId LOG_ID --dateFrom 2022-01-01 --dateTo 2022-01-31
Remember to replace API_KEY
with your API key (where is my API key?) and LOG_ID
with your log ID (where is my log ID?). The elmah.io CLI now saves all content from the chosen log to a file. The tool supports a range of options like a query and date range. To dig deeper, check out the help article: Exporting log messages from the CLI.