---
title: Mule ESB Custom Connector – Log Event Fields, Message Types, and Context
description: "What the Nodinite Custom Connector for Mule ESB writes: the mandatory and optional JSON Log Event fields, Message Type naming and planning, context properties, repair and resubmit properties, exception handling with Log Status Codes, and correlation."
---

# Custom Connector: Log Event Content

The value of your Mule ESB logging depends on what each [Log Event][Log Events] carries. This page is the field reference for the :Nodinite: [Custom Connector][]: what goes into each [JSON Log Event][], and how to set [Message Types][], context properties, status codes, and correlation so business users can find their data.

* ✅ Know which fields are mandatory and which are recommended  
* ✅ Plan Message Types before go-live; they can't be changed after logging  
* ✅ Make errors, context, and correlation searchable  

## JSON Log Event Format

The Custom Connector formats Mule messages as JSON Log Events following the :Nodinite: schema. Understanding this format is critical for proper integration.

### Mandatory Fields

The following fields are **required** for every logged event:

|Field|Data Type|Description|Example Value|  
|---|---|---|---|  
|:fa-fingerprint: **LogAgentValueId**|`number`|ID of the [Log Agent][Log Agents] sending events|`42`|  
|:fa-tag: **EndPointName**|`string`|Name of [Endpoint][Endpoints] (transport description)|`"INT101: Receive Invoices"`|  
|:fa-link: **EndPointUri**|`string`|URI/address of [Endpoint][Endpoints]|`"file:///drop/invoices"`|  
|:fa-arrow-right-arrow-left: [EndPointDirection][Endpoint Directions]|`number`|Direction: `0` (receive), `1` (send)|`0`|  
|:fa-network-wired: [EndPointTypeId][EndpointTypes]|`number`|Transport type ID|`60` (File)|  
|:fa-envelope: **OriginalMessageTypeName**|`string`|[Message Type][Message Types] identifier|`"Invoice#1.0"`|  
|:fa-calendar-day: **LogDateTime**|`string`|Timestamp in ISO 8601 UTC format|`"2018-05-03T13:37:00.123Z"`|  

### Optional But Recommended Fields

|Field|Data Type|Description|Example Value|  
|---|---|---|---|  
|:fa-file-lines: **Body**|`string`|Message payload (base64-encoded if binary)|Full message content|  
|:fa-diagram-project: **CorrelationId**|`string`|Correlation identifier for related events|GUID or business key|  
|:fa-traffic-light: **LogStatus**|`number`|[Status code][Log Status Codes]: `-1` (error), `0` (success), `1` (info)|`0`|  
|:fa-align-left: **LogText**|`string`|Human-readable log message|`"Invoice processed successfully"`|  
|:fa-list: **ContextProperties**|`object`|Key-value pairs for [Context Options][]|`{"orderId": "12345", "customer": "Contoso"}`|  

See the [JSON Log Event][] documentation for the complete schema and examples.

## Message Types Configuration

>[!IMPORTANT]
>**Message Types are mandatory and cannot be changed after logging.** The `OriginalMessageTypeName` field determines which [Search Field Expressions][] are applied to extract business data from logged events.

### Why Message Types Matter

Many :Nodinite: features depend on well-defined [Message Types][]:

1. [Search Fields][] - Extract Order Numbers, Customer IDs, Invoice amounts, Transaction codes using [Search Field Expressions][] bound to Message Types
2. [Log Views][] - Filter and search logs by business identifiers (not just timestamps and correlation IDs)
3. [Non-Events Monitoring][] - Track message volumes, detect missing messages, alert on pattern anomalies
4. [Business Process Modeling (BPM)][BPM] - Correlate transactions end-to-end across Mule flows and other integration platforms

#### Without proper Message Types

* Search Field extraction fails - no business data in search results
* Log Views can only filter by technical metadata
* Non-Events cannot detect missing invoices, orders, or payments
* BPM cannot correlate multi-step business processes

### Naming Best Practices

Use consistent, meaningful Message Type names:

* **Include domain and version:** `Invoice#1.0`, `Order#2.0`
* **Use PascalCase:** `CustomerUpdate#1.0` (not `customer_update_v1`)
* **Version changes:** Increment version when payload schema changes significantly
* **Avoid generic names:** Use `SAPPurchaseOrder#1.0` instead of `Message#1.0`

#### Example: Setting Message Type in Mule flow

```groovy
// Set Message Type in session variable before logging
sessionVars['nodiniteMessageTypeName'] = "Invoice#1.0";
```

### Planning Message Types During Development

Message Types cannot be changed after events are logged. Plan your naming convention during development:

1. **Identify message types** in your integration flows (orders, invoices, confirmations, etc.)
2. **Define naming convention** for your organization
3. **Create Search Field Expressions** for each Message Type before go-live
4. **Document Message Types** in your integration design specifications

## Context Options and Custom Properties

[Context Options][] allow you to add custom key-value pairs to logged events for filtering, searching, and reporting.

### Common Context Properties

|Property|Purpose|Example Value|  
|---|---|---|  
|**orderId**|Business transaction identifier|`"ORD-12345"`|  
|**customerId**|Customer/partner identifier|`"CUST-98765"`|  
|**fileName**|Source file name|`"invoices_2024-11-03.xml"`|  
|**fileSize**|File size in bytes|`"524288"`|  
|**invoiceAmount**|Transaction amount|`"1250.00"`|  
|**currency**|Currency code|`"USD"`|  
|**isGDPRData**|Contains personal data flag|`"true"`|  

#### Example: Setting context properties in Groovy

```groovy
sessionVars['nodiniteContextValues'] = [
    orderId: flowVars['orderId'],
    customerId: flowVars['customerId'],
    invoiceAmount: flowVars['amount'].toString(),
    currency: "USD",
    isGDPRData: "true"
];
```

### Repair and Resubmit Properties

Use context properties to enable message repair and resubmission:

```groovy
sessionVars['nodiniteContextValues'] = [
    orderId: flowVars['orderId'],
    // Repair/resubmit metadata
    originalEndpoint: "file:///drop/invoices",
    retryCount: flowVars['retryCount'].toString(),
    canResubmit: "true",
    resubmitEndpoint: "vm://reprocess-invoice"
];
```

Build your Mule flows to handle resubmitted messages (check `retryCount`, implement idempotency, etc.).

## Exception Handling and Error Logging {#exception-handling-and-error-logging}

Add the Custom Connector to exception handlers to log error conditions with appropriate [Log Status Codes][]:

```xml
<flow name="invoice-processing-flow">
    <file:inbound-endpoint path="/drop/invoices" />
    
    <!-- Normal processing ... -->
    
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <scripting:component doc:name="Set Error Logging Variables">
            <scripting:script engine="Groovy"><![CDATA[
                sessionVars['nodiniteMessageTypeName'] = "Invoice#1.0";
                sessionVars['nodiniteLogText'] = "Processing failed: " + exception.getMessage();
                sessionVars['nodiniteLogStatus'] = -1; // Error status
                sessionVars['nodiniteEndPointDirection'] = 0;
                sessionVars['nodiniteContextValues'] = [
                    fileName: flowVars['originalFilename'],
                    errorType: exception.getClass().getSimpleName(),
                    errorMessage: exception.getMessage(),
                    stackTrace: exception.getStackTrace().toString()
                ];
                return payload;
            ]]></scripting:script>
        </scripting:component>
        <flow-ref name="nodinite-logging-subflow" doc:name="Log Error"/>
    </catch-exception-strategy>
</flow>
```

### Log Status Code Guidelines

* **`-1` (Error)** - Processing failure, message rejected, exception thrown
* **`0` (Success)** - Normal processing, message accepted
* **`1` (Information)** - Audit trail, milestone reached, no action required

## Correlation

Correlation links related log events across flows, systems, and time. See the [Mule ESB Correlation][] guide for detailed correlation strategies.

### Basic correlation example

```groovy
// Set correlation ID at flow entry
sessionVars['correlationId'] = message.id; // or flowVars['orderId']
message.correlationId = sessionVars['correlationId'];

// Use same correlation ID for all log events in this flow
sessionVars['nodiniteContextValues'] = [
    correlationId: sessionVars['correlationId']
];
```

## :fa-hand-point-right: Next Steps

:fa-list-ol: [Implement the Custom Connector][]  
:fa-code: [Complete Working Example][Custom Connector - Complete Example]  
:fa-magnifying-glass-plus: [Add or manage Search Fields][Add or manage Search Field]  
:fa-hard-drive: [Add or manage Log Views][Add or manage Log View]  

## :fa-link-horizontal: Related Topics

:fa-puzzle-piece: [Custom Connector for Mule ESB Logging][Custom Connector]  
:fa-code: [JSON Log Event][]  
:fa-file: [Message Types][]  
:fa-magnifying-glass-plus: [Search Field Expressions][]  
:fa-list: [Context Options][]  
:fa-key: [Log Status Codes][]  
:fa-link: [Mule ESB Correlation][]  
:fa-sitemap: [Endpoints][]  
:fa-arrow-right-arrow-left: [Endpoint Directions][]  
:fa-plug: [Endpoint Types][EndpointTypes]  
:fa-user-secret: [Log Agents][]  
:fa-stopwatch: [Non-Events Monitoring][]  
:fa-project-diagram: [Business Process Modeling (BPM)][BPM]  

[Add or manage Log View]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/Add%20or%20Manage%20Log%20View.md
[Add or manage Search Field]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Add%20or%20manage%20Search%20Field.md
[BPM]:{ndr}/Repository%20Model/BPMs/Overview.md
[Context Options]:{ndr}/Core%20Services/Log%20Event/Features/Context%20Options.md
[Custom Connector]:{ndr}/Logging%20and%20Monitoring/MuleSoft%20-%20AnyPoint%20Platform%20-%20Logging/Features/Custom%20Connector.md
[Custom Connector - Complete Example]:{ndr}/Logging%20and%20Monitoring/MuleSoft%20-%20AnyPoint%20Platform%20-%20Logging/Features/Custom%20Connector%20-%20Complete%20Example.md
[Endpoint Directions]:{ndr}/Core%20Services/Log%20Event/Features/Endpoint%20Directions.md
[Endpoints]:{ndr}/Repository%20Model/Endpoints/Overview.md
[EndpointTypes]:{ndr}/Core%20Services/Log%20Event/Features/Endpoint%20Types.md
[Implement the Custom Connector]:{ndr}/Logging%20and%20Monitoring/MuleSoft%20-%20AnyPoint%20Platform%20-%20Logging/Features/Custom%20Connector%20-%20Implementation.md
[JSON Log Event]:{ndr}/Core%20Services/Log%20Event/Features/JSON%20Log%20Event.md
[Log Agents]:{ndr}/Administration/1.%20Log%20Management/3.%20Log%20Agents/Features/What%20is%20a%20Log%20Agent.md
[Log Events]:{ndr}/Core%20Services/Log%20Event/Overview.md
[Log Status Codes]:{ndr}/Administration/1.%20Log%20Management/3.%20Log%20Agents/Features/What%20is%20a%20Log%20Status%20Code.md
[Log Views]:{ndr}/Administration/1.%20Log%20Management/1.%20Log%20Views/Features/What%20is%20a%20Log%20View.md
[Message Types]:{ndr}/Repository%20Model/Message%20Types/Overview.md
[Mule ESB Correlation]:{ndr}/Logging%20and%20Monitoring/MuleSoft%20-%20AnyPoint%20Platform%20-%20Logging/Troubleshooting/How%20do%20I%20correlate%20logged%20events.md
[Non-Events Monitoring]:{ndr}/Logging%20and%20Monitoring/Non-Events/Overview.md
[Search Field Expressions]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/Search%20Field%20Expressions/Overview.md
[Search Fields]:{ndr}/Administration/1.%20Log%20Management/2.%20Search%20Fields/Features/What%20is%20a%20Search%20Field.md