This website uses cookies. By clicking OK, you consent to the use of cookies. Click Here to learn more about how we use cookies.
OK
  • RSA.com
  • Products
    • Archer®
      • Archer®
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Archer® Exchange
      • Training
      • Upcoming Events
      • Videos
    • RSA® Fraud & Risk Intelligence Suite
      • RSA® Fraud & Risk Intelligence Suite
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Web Threat Detection
      • Upcoming Events
      • Videos
    • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Cloud
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Upcoming Patch Content
      • Videos
    • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication Mobile SDK
      • Advisories
      • Events
      • Ideas
      • Knowledge Base
      • Request Access
      • Training
    • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 7.x
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Events
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® Adaptive Authentication for eCommerce
      • RSA® Adaptive Authentication for eCommerce
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Ideas
      • Knowledge Base
      • Training
      • Videos
    • RSA® FraudAction Services
      • RSA® FraudAction Services
      • Advisories
      • Discussions
      • Documentation
      • Ideas
      • Videos
    • RSA® Web Threat Detection
      • RSA® Web Threat Detection
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Videos
    • RSA NetWitness® Platform
      • RSA NetWitness® Platform
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Integrations
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • RSA NetWitness® Detect AI
      • RSA NetWitness® Detect AI
      • Documentation
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA NetWitness® Investigator
      • RSA NetWitness® Investigator
      • Documentation
      • Download the Client
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA NetWitness® Orchestrator
      • RSA NetWitness® Orchestrator
      • Overview
      • Documentation
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
    • RSA SecurID® Suite
      • RSA SecurID® Suite
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Knowledge Base
      • Ideas
      • Integrations
      • Training
      • Videos
    • RSA® Identity Governance & Lifecycle
      • RSA® Identity Governance & Lifecycle
      • Advisories
      • Blog
      • Community Exchange
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • RSA SecurID® Access
      • RSA SecurID® Access
      • Advisories
      • Blog
      • Discussions
      • Documentation
      • Downloads
      • Ideas
      • Integrations
      • Knowledge Base
      • Training
      • Upcoming Events
      • Videos
    • Other RSA® Products
      • Other RSA® Products
      • RSA® Access Manager
      • RSA® Data Loss Prevention
      • RSA® Digital Certificate Solutions
      • RSA enVision®
      • RSA® Federated Identity Manager
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
      •  
  • Resources
    • Advisories
      • Product Advisories on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Hosted
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Product Advisories
    • Blogs
      • Blogs on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Blogs on RSA Link
    • Discussion Forums
      • Discussion Forums
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Discussion Forums on RSA Link
    • Documentation
      • Product Documentation
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Documentation on RSA Link
    • Downloads
      • Product Downloads
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Downloads on RSA Link
    • Ideas
      • Idea Exchange
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® FraudAction Services
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Documentation on RSA Link
    • Knowledge Base
      • Knowledge Base
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication Mobile SDK
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Knowledge Base Pages on RSA Link
    • Upcoming Events on RSA Link
      • Upcoming Events
    • Videos
      • Videos on RSA Link
      • Archer®
      • RSA® Adaptive Authentication Cloud
      • RSA® Adaptive Authentication On-Premise 7.x
      • RSA® Adaptive Authentication On-Premise 14.x
      • RSA® Adaptive Authentication for eCommerce
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
      • RSA® Web Threat Detection
      • All Videos on RSA Link
  • Support
    • RSA Link Support
      • RSA Link Support
      • News & Announcements
      • Getting Started
      • Support Forum
      • Support Knowledge Base
      • Ideas & Suggestions
    • RSA Product Support
      • RSA Product Support
      • General Security Advisories and Statements
      • Product Life Cycle
      • Support Information
      •  
      •  
      •  
      •  
      •  
  • RSA Ready
  • RSA University
    • Certification Program
      • Certification Program
    • Course Catalogs
      • Course Catalogs
      • Archer®
      • RSA NetWitness® Platform
      • RSA SecurID® Suite
    • On-Demand Subscriptions
      • On-Demand Subscriptions
      • Archer®
      • RSA NetWitness® Platform
      • RSA SecurID® Suite
    • Product Training
      • Product Training
      • Archer®
      • RSA® Fraud & Risk Intelligence Suite
      • RSA® Identity Governance & Lifecycle
      • RSA NetWitness® Platform
      • RSA SecurID® Access
    • Student Resources
      • Student Resources
      • Access On-Demand Learning
      • Access Virtual Labs
      • Contact RSA University
      • Enrollments & Transcripts
      • Frequently Asked Questions
      • Getting Started
      • Learning Modalities
      • Payments & Cancellations
      • Private Training
      • Training Center Locations
      • Training Credits
      • YouTube Channel
    • Upcoming Events
      • Upcoming Events
      • Full Calendar
      • Conferences
      • Live Classroom Training
      • Live Virtual Classroom Training
      • Webinars
Sign In Register Now
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Search instead for 
Did you mean: 
Announcements

RSA NetWitness® Platform Discussions

Discussions about the RSA NetWitness Platform.
  • RSA Link
  • :
  • Products
  • :
  • RSA NetWitness Platform
  • :
  • Discussions
  • :
  • Lua Parser to Split DOMAIN\USERNAME into separate ...
  • Options
    • Subscribe to RSS Feed
    • Mark Topic as New
    • Mark Topic as Read
    • Float this Topic for Current User
    • Bookmark
    • Subscribe
    • Mute
    • Printer Friendly Page
DavidWaugh1
Employee DavidWaugh1
Employee
‎2016-03-02 03:54 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Lua Parser to Split DOMAIN\USERNAME into separate components

I had an email from a customer asking the following question.

 

Could you help me for parser MS IIS logs? Some logs from MS IIS have user.dst field in format «domain\username»

 

Could you write parser to extract username to filed user.dst and write domain name (like mydomain.com) to domain field if this field present in original user.dst? For example – anonymous don’t have domain prefix. It will be very usefully for our customers on the community.

 

I'm going to post the answer here once I write the parser!

  • Tags:
  • Community Thread
  • Discussion
  • Forum Thread
  • NetWitness
  • NW
  • NWP
  • RSA NetWitness
  • RSA NetWitness Platform
1 Like
Share
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
5 Replies
DavidWaugh1
Employee DavidWaugh1
Employee
‎2016-03-02 04:44 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Here is the parser:

 

local ExtractUser = nw.createParser("ExtractUser", "Splits a username of the form domain\user into domain and username parts")

 

--[[

    DESCRIPTION

        Splits a username of the from DOMAIN\USERNAME into DOMAIN and USERNAME parts

        If the username does not contain a \ then we write the value unchanged

    VERSION

      2nd March - Initial Developemnt

 

    AUTHOR

 

        david.waugh2@rsa.com

    DEPENDENCIES

  The input key is trans_username

  In the Table Map Custom.xml file on the logdecoder make sure username is mapped to tr_username as follows:

 

  <mapping envisionName="username" nwName="tr_username" flags="Transient" format="Text" envisionDisplayName="UserName|UserID|User|UserName|Username" nullTokens="none|-"/>

    NOTES

        None

--]]

 

-- These are the meta keys that we will write meta into

ExtractUser:setKeys({

    nwlanguagekey.create("user.dst", nwtypes.Text),

  nwlanguagekey.create("domain", nwtypes.Text)})

 

 

function ExtractUser:userdst(index, myusername)

  local domain,username = string.match(myusername,"(.*)\\(.*)")

  if(domain == nil) then -- Username was not of the form domain\user

    nw.createMeta(self.keys["user.dst"],myusername)

  else -- Username was of the form domain\user so split into component parts

  nw.createMeta(self.keys["user.dst"],username)

  nw.createMeta(self.keys["domain"],domain)

  end

end

 

 

ExtractUser:setCallbacks({

  [nwlanguagekey.create("tr_username", nwtypes.Text)] =ExtractUser.userdst,

})

1 Like
Share
Reply
AlexeyFedorov
AlexeyFedorov New Contributor
New Contributor
In response to DavidWaugh1
‎2016-03-02 05:07 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Hello David,

 

Some username also can be in format USERNAME@DOMAIN. Could you improve parser and add this patern to the parser? The USERNAME put to user.dst field, the DOMAIN put to domain filed and @ is delete.

0 Likes
Share
Reply
DavidWaugh1
Employee DavidWaugh1
Employee
In response to AlexeyFedorov
‎2016-03-02 08:27 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Here is the new version

 

 

local ExtractUser = nw.createParser("ExtractUser", "Splits a username of the form domain\user into domain and username parts")

 

 

--[[

    DESCRIPTION

 

 

        Splits a username of the from DOMAIN\USERNAME into DOMAIN and USERNAME parts

  Splits a username of the form DOMAIN@USERNAME into DOMAIN and USERNAME parts

  Splits a username of the form DOMAIN\USERNAME@DOMAIN into DOMAIN and USERNAME parts

        If the username does not contain a \ then we write the value unchanged

 

 

    VERSION

 

 

       2nd March - Initial Developemnt

    2.0 - Add ability parse our username@DOMAIN

 

 

    AUTHOR

 

 

        david.waugh2@rsa.com

 

 

 

 

    DEPENDENCIES

  The input key is tr_username

  In the Table Map Custom.xml file on the logdecoder make sure username is mapped to tr_username as follows:

  <mapping envisionName="username" nwName="tr_username" flags="Transient" format="Text" envisionDisplayName="UserName|UserID|User|UserName|Username" nullTokens="none|-"/>

    NOTES

 

 

                None

 

 

--]]

 

 

 

 

 

 

-- These are the meta keys that we will write meta into

ExtractUser:setKeys({

    nwlanguagekey.create("user.dst", nwtypes.Text),

  nwlanguagekey.create("domain", nwtypes.Text)})

 

 

function ExtractUser:userdst(index, myusername)

   local domain,username = string.match(myusername,"(.*)\\(.*)") -- Check for \

   local atusername,domainat = string.match(myusername,"(.*)%@(.*)") -- Check for @

   local domainslash,usernameat,atdomain = string.match(myusername,"(.*)\\(.*)%@(.*)")

 

 

--[[ For Debugging  

if domain then   nw.logInfo("domain: " .. domain) end

if username then nw.logInfo("username: " .. username) end

if domainat then nw.logInfo("domainat: " .. domainat) end

if atusername then nw.logInfo("atusername: " .. atusername) end

if domainslash then nw.logInfo("domainslash: " .. domainslash) end

if usernameat then nw.logInfo("usernameat: " .. usernameat) end

if atdomain then nw.logInfo("atdomain: " ..atdomain) end

--]] 

 

 

  if(domain == nil and domainat == nil and domainslash ==nil) then

    nw.createMeta(self.keys["user.dst"],myusername)

  else -- Username was of the form domain\user so split into component parts

  --nw.logInfo("myusername: " .. myusername)

    if( domain and not domainslash) then -- myusername contained \

  nw.createMeta(self.keys["user.dst"],username)

     nw.createMeta(self.keys["domain"],domain)

  else if(domainat and not domainslash) then-- myusername contained @

  nw.createMeta(self.keys["user.dst"],atusername)

     nw.createMeta(self.keys["domain"],domainat)

  else if(domainslash) then

  

  nw.createMeta(self.keys["user.dst"],usernameat)

         nw.createMeta(self.keys["domain"],domainslash)

  nw.createMeta(self.keys["domain"],atdomain)

  end

  end

  end

  end

end

 

 

ExtractUser:setCallbacks({

   [nwlanguagekey.create("tr_username", nwtypes.Text)] =ExtractUser.userdst,

})

 

It will work with usernames of the following form

 

user1@domain1

domain2@user2

domain3\\user3@domain4

ExtractUser.lua.zip
4 Likes
Share
Reply
SeanKoniarz
SeanKoniarz Beginner
Beginner
‎2016-04-01 11:03 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

How do you use LUA parsers for logs?  Like, where do I put this? 

0 Likes
Share
Reply
AlexeyFedorov
AlexeyFedorov New Contributor
New Contributor
In response to SeanKoniarz
‎2016-04-01 12:57 PM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

No different between Logs and Packets. You should upload the parser through Parser tab of your Log Decoder.

0 Likes
Share
Reply
Powered by Khoros
  • Products
  • Resources
  • Solutions
  • RSA University
  • Support
  • RSA Labs
  • RSA Ready
  • About RSA Link
  • Terms & Conditions
  • Privacy Statement
  • Provide Feedback
© 2021 RSA Security LLC or its affiliates.
All rights reserved.