A log viewer that can parse log files and stream logs from C#, Python, Java and others.
Usage and how to create custom data providers
Analogy Log Viewer is multi purpose Log Viewer for Windows Operating systems with support for most log frameworks log files: it supports both offline log files:
- Supports common frameworks like Serilog, NLog, etc.
- Supports generic log files like plain text with Regex parser and XML/Json parsers.
And real time streaming of logs:
For a complete list visit Analogy Overview repository.
The application has many standard operations for analysis logs (like filtering, excluding) but its strength is in the ability to add additional custom data sources by implementing few interfaces. This allows adding any logs formats and/or custom modification of logs before presenting the data in the UI Layer.
Some features of this tool are:
- Windows event log support (evtx files)
- Aggregation into single view.
- Search in multiple files
- Combine multiple files
- Compare logs
- Themes support
- 64 bit support (allow loading more files)
- Personalization (users settings per user)
- Columns Extendable: Ability to add more columns specific to the data source implementation
- Exporting to Excel/CSV files
- Collaboration-like feature: ability to send log messages to gRPC/WCF service and/or between data providers
Main interaction UI:
- Ribbon area: Log files operations (open) and tools (search/combine/Compare)
- Messages area: File system UI and Main Log viewer area
Thre are 3 modes of operations:
- real time log server: a gRPC Windows service that can receive messages from any gRPC client and the Log viewer app can connect to it to show real time logs.
- real time logs: different implementation tha tcan receive logs in real time (e.g: Windows event log data provider that show event logs as they are created)
- Offline mode: Parse log files. There are many different implemetations. For a full list: see implementations for common logs files/frameworks.
You can also create your own providers: to implement a new data provider do the following:
- Create new cs project and make sure your assembly is named Analogy.LogViewer.*.dll.
- reference nuget package Analogy.LogViewer.Interfaces.
- implement interface:
public interface IAnalogyFactory
{
Guid FactoryId { get; }
string Title { get; }
IEnumerable<IAnalogyChangeLog> ChangeLog { get; }
IEnumerable<string> Contributors { get; }
string About { get; }
}
The FactoryId is the identifier of your provider.
- implement interfaces IAnalogyRealTimeDataProvider (for real time messages) or IAnalogyOfflineDataProvider (for existing log files).
public interface IAnalogyRealTimeDataProvider : IAnalogyDataProvider
{
event EventHandler<AnalogyDataSourceDisconnectedArgs> OnDisconnected;
event EventHandler<AnalogyLogMessageArgs> OnMessageReady;
event EventHandler<AnalogyLogMessagesArgs> OnManyMessagesReady;
IAnalogyOfflineDataProvider FileOperationsHandler { get; }
Task<bool> CanStartReceiving();
void StartReceiving();
void StopReceiving();
bool IsConnected { get; }
}
public interface IAnalogyOfflineDataProvider : IAnalogyDataProvider
{
bool DisableFilePoolingOption { get; }
bool CanSaveToLogFile { get; }
string FileOpenDialogFilters { get; }
string FileSaveDialogFilters { get; }
IEnumerable<string> SupportFormats { get; }
string InitialFolderFullPath { get; }
Task<IEnumerable<AnalogyLogMessage>> Process(
string fileName,
CancellationToken token,
ILogMessageCreatedHandler messagesHandler);
IEnumerable<FileInfo> GetSupportedFiles(DirectoryInfo dirInfo, bool recursiveLoad);
Task SaveAsync(List<AnalogyLogMessage> messages, string fileName);
bool CanOpenFile(string fileName);
bool CanOpenAllFiles(IEnumerable<string> fileNames);
}
- Implement the container for those interfaces IAnalogyDataProvidersFactory (make sure FactoryId is the same one you created at step 2):
public interface IAnalogyDataProvidersFactory
{
/// <summary>
/// the factory id which this Data providers factory belongs to
/// </summary>
Guid FactoryId { get; }
string Title { get; }
IEnumerable<IAnalogyDataProvider> DataProviders { get; }
}
you can implement additional interfaces:
- IAnalogyDataProviderSettings - add ability to create use control to load in the application user settings. You can create a specific UI to change specific settings for your provider. this interface comes from nuget package Analogy.DataProviders.Extensions.
- IAnalogyCustomActionsFactory - custom action to add to the UI
- IAnalogyShareableFactory - add ability to send log messages from one provider to another
Project Analogy.LogViewer.Example has concrete example.
- Put your dll at the same folder as the application. You can download latest version
The application has some analyzers and visualization.
-
Time Distribution: shows at what time of day the message was logged.
-
Frequency: shows count of how many repeated messages were logged (you can define the text to filter).
-
On/Off Distribution: Show existance of message along the time.
- Windows 10 blocks Zip files by default. Make sure to unblock them before unzipping. How to unblocked.