Json formatted Log Event
This article provides examples with detailed information on a technical level intended to guide developers create JSON formatted Log Events for use within your custom logging solutions. The JSON formatted Log Events may be sent directly to the LogAPI or sent to a queue/folder for asynchronous fetch by the Pickup Service (recommended approach).
The Log Event has three distinct parts:
- Event details
- Payload
- Context properties
LogDateTime = 2018-05-03 13:37:00+02:00
EndPointName = https://api.nodinite.com/...
MessageType=Invoice
...] end subgraph "2. Payload" ro[fal:fa-envelope Message
Body=base64EncodedMessage] end subgraph "3. Context Properties" roKey[fal:fa-key Key Values
InvoiceNo = 123
CorrelationId=456
...] end end
1. Details
The first 7 event fields are mandatory and the rest of the fields are optional (set value to null
or do not provide the field at all). By providing additional details about the Log Event, end users may have a better user experience with Nodinite.
Mandatory | Data Type | Field | Value | Comment |
---|---|---|---|---|
string |
LogAgentValueId | 42 | Who (Log Agents) sent the data | |
string |
EndPointName | "INT101: Receive Hello World Log Events" | Name of Endpoint transport | |
string |
EndPointUri | "C:\DropArea\in" | URI for Endpoint transport | |
number |
EndPointDirection | 0 | Direction for Endpoint transport | |
number |
EndPointTypeId | 60 | Type of Endpoint transport | |
string |
OriginalMessageTypeName | "https://nodinite.com/Customers/1.0#Batch" | Message Type Name | |
string |
LogDateTime | "2018-05-03T13:37:00.123Z" | Client Log datetime (UTC format) | |
number |
EventDirection | 17 | External Incoming (before receive port) | |
number |
ProcessingUser | "DOMAIN\user" | Log Identity | |
string |
ProcessingUser | "DOMAIN\user" | Log Identity | |
number |
SequenceNo | 0 | Provide your own sequence number | |
number |
EventNumber | 0 | Provide your own event number | |
string |
LogText | "File successfully generated" | Your log text goes here | |
string |
ApplicationInterchangeId | "" | Id for Application scope | |
guid |
LocalInterchangeId | null | Id for local scope | |
string |
LogStatus | 0 | As defined for each Log Agent | |
string |
ProcessName | "My customer process" | Name of process | |
string |
ProcessingMachineName | "localhost" | Name of server where log event originated | |
string |
ProcessingModuleName | "INT101-HelloHappyCustomers-Application" | Name of module | |
string |
ProcessingModuleType | "FilePickup" | Type of module, exe, dll, service | |
guid |
ServiceInstanceActivityId | null | Id for run scope | |
string |
ProcessingTime | 80 | Flow execution time so far in milliseconds |
LogDateTime - Provide timezone data for example -01:00
, +02:00
or Z
. If time zone data is not provided then UTC time will be used. Value from LogDateTime is always converted to UTC time and stored as that in Nodinite databases. This means that Nodinite will present the correct datetime for end users regardless in which timezone you happen to view logged events.
Example: 2017-04-10T08:44:22.309+02:00 (+02:00 against UTC)
Value for the guid data type is sent without brackets or null
.
Example: "064205E2-F7CF-43A6-B514-4B55536C2B67"
2. Payload
The payload/body - is a base64 encoded string / file or null
.
You can omit the "Body" field totally if you have no body to log.
Mandatory | Data Type | Field | Value | Comment |
---|---|---|---|---|
string |
Body | "SGVsbG8gV29ybGQ=" | base64 encoded string |
3. Context Properties
The Context properties is simply a collection of key-values. Feel free to send whatever you need in order to create usable self service Log Views for your business.
You can omit the "Context" field totally if you have no context properties to log.
...
"Context": {
"CorrelationId": "064205E2-F7CF-43A6-B514-4B55536C2B67",
"FileName": "\\server\\share\\NodiniteHappyCustomerList.txt"
}
Mandatory | Data Type | Field | Value | Comment |
---|---|---|---|---|
array |
Context | { "Key1": "ABC", "Key2": "123"} | comma separated list of key values of string data type |
Repository
By providing additional details in the Context, the Repository Model may be populated with that information when processed by the Logging Service. Read more about this topic in the documentation for Context Options.
Full Example
Complete Log Event with all available fields set, optional and mandatory:
{
"LogAgentValueId": 42,
"EndPointName": "INT101: Receive Hello World Log Events",
"EndPointUri": "C:\\temp\\in",
"EndPointDirection": 0,
"EndPointTypeId": 60,
"OriginalMessageTypeName": "Hello.World.File/1.0",
"LogDateTime": "2017-11-22T08:44:22.309Z",
"EventDirection": "17",
"ProcessingUser": "DOMAIN\\user",
"SequenceNo": 0,
"EventNumber": 0,
"LogText": "File OK",
"ApplicationInterchangeId": "",
"LocalInterchangeId": null,
"LogStatus": 0,
"ProcessName": "My Process",
"ProcessingMachineName": "localhost",
"ProcessingModuleName": "INT101-HelloWorld-Application",
"ProcessingModuleType": "FilePickup",
"ServiceInstanceActivityId": null,
"ProcessingTime": 80,
"Body": "SGVsbG8gV29ybGQ=",
"Context": {
"CorrelationId": "064205E2-F7CF-43A6-B514-4B55536C2B67",
"FileName": "Hello.txt"
}
}
Minimal Example
Minimal incoming Log Event with mandatory fields (endpoint is file based in this example):
{
"LogAgentValueId": 42,
"EndPointName": "INT101: Receive Hello World Log Events",
"EndPointUri": "C:\\temp\\in",
"EndPointDirection": 0,
"EndPointTypeId": 60,
"OriginalMessageTypeName": "Hello.World.File/1.0",
"LogDateTime": "2017-11-22T08:44:22.309Z"
}
Next Step
Related
- Message Types
- Log Agents - Events and messages
- Logging Service - Processes (indexing) the messages
- Log Views - Manage User access to events and messages across platform
- Log Databases - Keep as much data as you like
- Repository Model