---
title: LUA Parser to deal with Alternative Syslog formats
description: "I have a customer who use something called a \"Data Diode\" to enforce one way connectivity through their network.One result of this is that a"
---

- [Home](https://mydev.netwitness.com/home)
- Integrations 
    - [Netwitness Platform Integrations](https://mydev.netwitness.com/netwitnessplatformintegrations)
    - [Third Party Integrations](https://mydev.netwitness.com/thirdpartyintegrations)
- [Knowledge Center](https://mydev.netwitness.com/knowledge-base)
- Community 
    - [Blogs](https://mydev.netwitness.com/netwitness-security-llc-blog)
    - Discussions
- Customers 
    - [Manage Products and Licenses](https://mydev.netwitness.com/nwportal)
    - Downloads
- Partners 
    - [Partner Program](https://mydev.netwitness.com/partner)
    - [Partner Resources](https://mydev.netwitness.com/partnerresources)
    - [Submit a New Deal Registration](https://mydev.netwitness.com/dealregistration)
    - [Become a Partner](https://mydev.netwitness.com/becomeapartner)
    - [Update Your Partner Locator Profile](https://www.netwitness.com/partner-locator/?utm_source=pardotnewsletter&utm_medium=email&utm_campaign=partner_march)
    - [NetWitness LinkedIn Partner Hub](https://linkedin.com/showcase/netwitnesspartners/)
- Education 
    - [Instructor Led Training Schedule](https://mydev.netwitness.com/instructorledtrainingschedule)
    - [NetWitness Training Catalog](https://mydev.netwitness.com/netwitnesstrainingcatalog)
    - [Security Awareness Training](https://mydev.netwitness.com/securityawarenesstraining)
    - [New Product Readiness](https://mydev.netwitness.com/newproductreadiness)
    - [On-Demand Virtual Labs](https://mydev.netwitness.com/ondemandvirtuallabs)
    - [Additional Training Information](https://mydev.netwitness.com/additionaltraininginformation)
    - [Frequently Asked Questions](https://mydev.netwitness.com/educationfaq)
    - [Contact NetWitness Education Team](https://mydev.netwitness.com/contact-netwitness-education-team)
- Support 
    - [Contact Support](https://mydev.netwitness.com/contact-support)
    - [Create a New Case](https://mydev.netwitness.com/create-support-case)
    - [View My Cases](https://mydev.netwitness.com/viewmycase)
    - [Product Version Life Cycle](https://mydev.netwitness.com/product-version-life-cycle)
    - [Warranty & Replacement Parts](https://mydev.netwitness.com/warranty-and-replacement-parts)
    - [Community Support Forum](https://mydev.netwitness.com/community-support-forum)
    - [Technical Support Guide](https://mydev.netwitness.com/technical-support-guide)

![search](https://21725316.fs1.hubspotusercontent-na1.net/hubfs/21725316/Ladder/Image/search.svg)

![search](https://21725316.fs1.hubspotusercontent-na1.net/hubfs/21725316/Ladder/Image/search.svg)

![search](https://21725316.fs1.hubspotusercontent-na1.net/hubfs/21725316/Ladder/Image/search.svg)

![search](https://21725316.fs1.hubspotusercontent-na1.net/hubfs/21725316/Ladder/Image/search.svg)

# LUA Parser to deal with Alternative Syslog formats

- Home
 */*- [Netwitness blogs](https://mydev.netwitness.com/netwitness-security-llc-blog)
*/*- lua parser to deal with alternative syslog formats

 13 Jan, 2017

**Author:** DavidWaugh1

I have a customer who use something called a "Data Diode" to enforce one way connectivity through their network.

One result of this is that any syslog that is being sent through the diode gets its device IP changed.

For example any message that was sent through the diode would have the Source IP address and Sequence Numbers appended.

Original Message:

Jan 11 18:01:13: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet13/30, changed state to up

Message after Passing through Data Diode and seen by RSA Netwitness for Logs:

192.24.25.1 1515391: Jan 11 18:01:13: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet13/30, changed state to up

Unfortunately this means that the device.ip is populated with the Data Diode address rather than the original source address. The LUA parser below checks logs coming from the same IP as the Data Diode, and if they have this header format, the IP address is extracted and stored in device.ip. 

This method works where logs are parsed by Security Analytics even with this additional header.

1\) Edit the DataDiode.Lua on Line 41. This looks for the IP to check against with the format in decimal. In the file 192.168.123.3 is 3232267011 in decimal format.   
2\) Add the address of the datadiode in decimal format. (If you are lazy just use [http://ncalculators.com/digital-computation/ip-address-hex-decimal-binary.htm](http://ncalculators.com/digital-computation/ip-address-hex-decimal-binary.htm))   
3\) Copy the parser to /etc/netwitness/ng/parsers on both your logdecoder   
4\) Reload your parsers (with your script that you use)

local lua\_DataDiode= nw.createParser("DataDiode", "Registers the IP given by the Data Diode into device.ip")

--\[\[

 DESCRIPTION  
 Takes a message from a data diode and adds the IP address supplied into device.ip  
 Sample Mesage:

 1.2.3.4 8936: 008934: Jan 11 17:55:03.566: %SYS-6-LOGGINGHOST\_STARTSTOP: Logging to host 4.3.2.1 Port 514 started - CLI initiated

 There can be any number of sequence numbers after the IP and the messages might be coming from any number of different event sources  
 AUTHOR

[david.waugh2@rsa.com](mailto:david.waugh2@rsa.com)   
\]\]--

lua\_DataDiode:setKeys({  
 nwlanguagekey.create("alert",nwtypes.Text),  
 nwlanguagekey.create("device.ip",nwtypes.IPv4)  
})

function lua\_DataDiode:sessionBegin()  
 deviceip = nil  
 devicetype = nil  
end

function lua\_DataDiode:CheckDevice(index,dtype)  
 if dtype == 'checkpointfw1' then  
 devicetype = dtype  
 end  
 self:register()  
end

function lua\_DataDiode:CheckDeviceIP(index,dip)  
 -- Data Diode Device IP is 192.168.123.3  
 -- nw.logInfo("DataDiode: DeviceIP: " .. dip .. type(dip))  
 -- Note IP Addresses are stored in DECIMAL notation so need to convert dotted value to DECIMAL  
 -- To convert a.b.c.d is a \*256 ^3 =b \*256 ^2 +c \*256 +d  
 --- 192.168.123.3 is therefore 3232267011  
 if dip == 3232267011 then  
 deviceip = dip  
 --nw.logInfo("DataDiode: Matched")  
 end  
 self:register()  
end

function lua\_DataDiode:register()

if deviceip then  
 -- Reparse the message:  
 -- nw.logInfo("DataDiode: DeviceIP has matched" )   
 local fullPayload = nw.getPayload():tostring()  
 local o1,o2,o3,o4,sequence,rubbish = string.match(fullPayload,"(%d+).(%d+).(%d+).(%d+)%s(%d+):(.\*)")

--nw.logInfo("DataDiode: DeviceIP has matched" )

-- Check we have an IP address  
 if o1 and o2 and o3 and o4 then  
 host = o1\*256^3 + o2\*256^2 + o3\*256 + o4  
 --nw.logInfo("DataDiode: Registered New Device IP: " .. host)  
 nw.createMeta(self.keys\["device.ip"\],host)  
 end  
 end  
end

lua\_DataDiode:setCallbacks({  
 \[nwevents.OnSessionBegin\] = lua\_DataDiode.sessionBegin,  
 --\[nwlanguagekey.create("device.type", nwtypes.Text)\] = lua\_DataDiode.CheckDevice,   
 \[nwlanguagekey.create("device.ip", nwtypes.IPv4)\] = lua\_DataDiode.CheckDeviceIP,

})

 Topic:

[0 Comment](https://mydev.netwitness.com/netwitness-security-llc-blog/luaparsertodealwithalternativesyslogformats#comments-listing)

###### CATEGORIES

- All
- [Blog](https://mydev.netwitness.com/netwitness-security-llc-blog/tag/blog)

##### RECENT POST

[Netwitness Platform Integration with AWS Application Load Balancer Access logs](https://mydev.netwitness.com/netwitness-security-llc-blog/netwitnessplatformintegrationwithawsapplicationloadbalanceraccesslogs)

 23 Jul, 2024

[The Sky Is Crying: The Wake of the 19 JUL 2024 CrowdStrike Content Update for Microsoft Windows and We Should Take Away From It](https://mydev.netwitness.com/netwitness-security-llc-blog/715124)

 20 Jul, 2024

[DDoS using BotNet Use Case](https://mydev.netwitness.com/netwitness-security-llc-blog/ddosusingbotnetusecase)

 7 May, 2024

[NetWitness Platform](https://www.netwitness.com/)

[Acceptable Use Policy](https://www.netwitness.com/wp-content/uploads/Acceptable-Use-Policy-092022.pdf) [Privacy Statement](https://www.netwitness.com/wp-content/uploads/NetWitness-Privacy-Statement-07292024.pdf)

![NetWitness Logo](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/netwitness-logo-RGB-white%201.png)

[![LinkedIn](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/linkedin.png)](https://www.linkedin.com/company/netwitness-platform/) [![YouTube](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/Youtube.jpg)](https://www.youtube.com/@netwitness)

© 2026 NetWitness LLC. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "DavidWaugh1",
    "url" : "https://mydev.netwitness.com/netwitness-security-llc-blog/author/davidwaugh1"
  },
  "dateModified" : "2026-03-20T10:30:10.572Z",
  "datePublished" : "2017-01-13T05:00:00.000Z",
  "headline" : "LUA Parser to deal with Alternative Syslog formats",
  "mainEntityOfPage" : {
    "@id" : "https://mydev.netwitness.com/netwitness-security-llc-blog/luaparsertodealwithalternativesyslogformats",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://mydev.netwitness.com/hubfs/netwitness-logo-CMYK.jpg"
    }
  }
}
```