IoTEdge.LogModule.Core 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package IoTEdge.LogModule.Core --version 1.0.0
NuGet\Install-Package IoTEdge.LogModule.Core -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IoTEdge.LogModule.Core" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IoTEdge.LogModule.Core --version 1.0.0
#r "nuget: IoTEdge.LogModule.Core, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IoTEdge.LogModule.Core as a Cake Addin
#addin nuget:?package=IoTEdge.LogModule.Core&version=1.0.0

// Install IoTEdge.LogModule.Core as a Cake Tool
#tool nuget:?package=IoTEdge.LogModule.Core&version=1.0.0

IoT Edge Log Module

Introduction

The core scenario is driven by the need to store information locally on an edge device and administer that information either locally or remotely. There are numerous scenarios in play including offline, storing data locally for retraining of ML models, and acquisition of configuration information unavailable for certain scenarios. These drive a fundamental scenario where persistent data is required and needs to be managed on edge devices.

The Log Module is publicly available with

IoT Edge Log Module APIs

The Log module provides 3 APIs which 1 or more can be configure for use.

  • REST API for inter-module operations
  • Edge Hub API for inter-module operations
  • Direct Methods API for either inter-module operations or external administration.

Features

Feature Description Interfaces
Get File Returns a file as byte array from local storage 1,2
Write File Writes a file to local storage with an optional parameter to write as an append file prepending \r\n to the write operation. 1,2
List Files Return a string[] of file names in a folder.
Remove File Deletes a file 1,2
Truncate File Remove the first "x" bytes from the beginning of a file. 1,2,3
Compress File Creates a new zip file from an existing file 1,2,3
Upload File Upload a file from local storage to Azure Blob storage with an optional parameter to write to the blob as an append file. 1,2,3
Download File Downloads a file from Azure Blob storage to local storage with an optional parameter to write the local file as an append file. 1,2,3

1 – HTTP REST API interface

2 – Edge Hub API interface

3 – Direct Methods interface

Getting Started

The IoT Edge Log Module is simple to setup and use. Follow this link for the Setup and Samples guides where we you how easy it can be to leverage persistent storage on your edge device and management it.

Configuration

  • Task 1 – Define docker volume(s) on Edge Device

    • Step 1: Logon edge device

    • Step 2: Create a docker volume using the command docker volume create &lt;name&gt;, e.g., docker volume create data

    • Step 3: Give read/write permission to docker volume

      • Execute the following command docker volume inspect <name>
      • Get the physical path of the docker volume.
      • Execute the following command sudo chmod -R ugo+rw <physical path>
  • Task 2 – Create Azure Storage Account

    • Step 1: Create an Azure Storage Account if the portal

      • Copy the name of the storage account, .e.g.. "myteststore"
      • Copy the access key
  • Task 3 – Create IoT Hub and Edge Device

    • Step 1: Go to Azure Portal and create an IoT Hub

    • Step 2: Create an edge device in within the IoT Hub, e.g., "edgedevice1"

  • Task 4 – Add the Log Module to the Edge Device

    • Step 1: Click on edge device in portal

    • Step 2: Click "Set Modules"

    • Step 3: Under "Deployment Modules" click "+Add" and select "IoT Edge Module"

    • Step 4: Fill in the following information in the blade

      • Name: iotedge-logmodule
      • Image URI: skunklab/iotedge-logmodule
      • Container Create Options paste the following, which assumes your docker volume created is name "data", otherwise replace the highlight text with your docker volume name.

      { "ExposedPorts": { "8877/tcp": {} }, "HostConfig": { "Binds": [ "data:/app/data" ], "PortBindings": { "8877/tcp": [ { "HostPort": "8877" } ] } } }

    • Step 5: Add the following Environment Variables

| Name | Value | | --- | --- | | LM_Port | 8877 | | LM_BlobStorageAccountName | <blob storage account name> | | LM_BlobStorageAccountKey | <blob storage access key> | | LM_Features | WebHost;DirectMethodsHost | - Click Save - Click Next 2 times - Click Submit

Follow Up

The Log module is ready to be implemented. You will want to call the log module from another module. The Nuget Package already has clients in C#, such that you can implement another module to test. The following code can be used to write a file to the log module then upload to blob storage from another module.

Write a file

public static async Task WriteNewFileAsync()

{
    string containerName = &quot;iotedge-logmodule&quot;;

    int port = 8877;

    HttpLogModuleClient client = new HttpLogModuleClient(containerName, port);

    string path = &quot;./data&quot;;

    string filename = &quot;test.txt&quot;;

    byte[] body = Encoding.UTF8.GetBytes(&quot;The quick brown fox jumps over the lazy dog.&quot;);

    bool append = false;

    await client.WriteFile(path, filename, body, append);

}

Upload a file

public static async Task UploadFileAsync()

{

    string containerName = &quot;iotedge-logmodule&quot;;

    int port = 8877;

    HttpLogModuleClient client = new HttpLogModuleClient(containerName, port);

    string path = &quot;./data&quot;;

    string filename = &quot;test.txt&quot;;

    string blobPath = &quot;mycontainer&quot;;

    string blobFilename = &quot;mytest.txt&quot;;

    string contentType = &quot;text/plain&quot;;

    bool append = false;

   await client.UploadFile(path, filename, blobPath,

                           blobFilename, contentType, append);

}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

IoT Edge Log Module