Cybersecurity Forum

This forum is for all security enthusiasts to discuss Fortinet's latest & evolving technologies and to connect & network with peers in the cybersecurity hemisphere. Share and learn on a broad range of topics like best practices, use cases, integrations and more. For support specific questions/resources, please visit the Support Forum or the Knowledge Base.

New Contributor II

CiscoFTDParser - not parsing all fields

Hello there,

I am currently on version 6.1.1 and noticed that "CiscoFTDParser" is not parsing all the fields.

A little of everything is happening:
1- For some evens the "Computer" fields is been assign to "user" field.
2- Multiples fields as missing such as Group, Source IP, User name (showing Display name, required to removed the space and add a ".")

See below sample logs that are having the issue:

<165>Jul 21 2021 17:14:38 firepower : %FTD-5-722011: Group <Name-AnyConnect-Group-Policy> User <Adam Blue> IP <> SVC Message: 17/WARNING: Reconnecting the VPN tunnel..

<165>Jul 21 17:14:49 firepower : %FTD-5-722028: Group <Name-AnyConnect-Group-Policy> User <Adam Blue2> IP <> Stale SVC connection closed.

<164>Jul 21 17:14:50 firepower : %FTD-4-313005: No matching connection for ICMP error message: icmp src Name-VPN_PO1.804:\Adam Blue3) dst Inside_Zone: (type 3, code 3) on DName-VPN_PO1.804 interface. Original IP payload: udp src dst

I am not sure is there is something wrong with he regex expression below (that is suppose to parse the event above) or something else within the parser that is not parsing most of the events types.

Any help will be appreciate it


<when test="$_evtId = '111009'">
<!-- <135>Apr 09 2012 18:20:19: %ASA-7-111009: User 'joeUser' executed cmd: show startup-config -->
<collectAndSetAttrByRegex src="$_body">
<regex><![CDATA[User '<user:gPatStrSQ>' executed cmd:\s+<command:gPatMesgBody>]]></regex>
New Contributor III


The Events you list above 722011, 722028, and 313005 would not match the sample you posted, which is event ID 111009.  For each of those event types listed, you would need to find the relevant block, for example, look for a when block that starts with this:
<when test="$_evtId = '722011'">

At quick glance on my 6.1.1 instance, I don't see 722011 or 722028 created in the parser, which means you would have to add <when> blocks for those IDs.  I do see one for 313005, which doesn't seem to parse out much other than source and destination interface name:

<when test="$_evtId = '313005'">
<!-- <132>Feb 04 2019 02:44:46 ACFASA : %ASA-4-313005: No matching connection for ICMP error message: icmp src inside: dst outside: (type 11, code 0) on inside interface. Original IP payload: tcp src dst -->
<collectFieldsByRegex src="$_body">
<regex><![CDATA[icmp src <srcIntfName:gPatStrEndColon>:<_srcStr:gPatStr> dst <destIntfName:gPatStrEndColon>:<_destStr:gPatStr>]]></regex>

Thank you so much Karn.
Got it, I need to add multiples events types as they are not included on the parser.


All missing events were added to the parser and now we are parsing most of the events. 
I noticed that for some event types, for example: "%FTD-4-722041" and many others the "User" field contains "User Name" or "Computer Name". See below an example.

<164>Jul 29 2021 20:49:34 firepower : %FTD-4-722041: TunnelGroup <XXX-AnyConnect-VPN> GroupPolicy <XXX-AnyConnect-Group-Policy> User <John Last> IP <xx.xx.xx.xx> No IPv6 address available for SVC connection

<164>Jul 29 2021 20:49:34 firepower : %FTD-4-722041: TunnelGroup <XXX-AnyConnect-VPN> GroupPolicy <XXX-AnyConnect-Group-Policy> User <> IP <> No IPv6 address available for SVC connection

Have you found a way to parse those fields respectively?  So when the logs contains the user name field assign the field to: "user" and when the logs contains the Computer name assign the field to "Computer Name".

Another detail is that the user name contains an space between FirstName and LastName. Do you have that space too?
Have you found a solution for the issues above? If the answer is yes, would you mind sharing that portion of the parser?




This is a bit tough when the vendor's log is putting two different types of data into the same field.  What you have to determine first is whether or not there is always something in that field that could help you identify it as one or the other.  For instance, in your example, in regex would be "\w+-\w+.\w+.\w+".  "John Last" would simply be "\w+ \w+" Since gPatWord is basically a \w+  (e.g. <pattern name="gPatWord"><![CDATA[\w+]]></pattern>), you could string these together to match the text or make your own pattern definition at the top of the parser.  I would then just have two CollectFieldsbyRegex statements to catch each condition.
Now, you need to make sure it's always John[space]Last or John[dash]computer[dot]domain[dot]com, if there are other formats of data coming in, it obviously won't work.

There may be a more elegant way to do this, but that is how I would think about it.

Thanks Karn, It worked for me. See below a portion of the parser code for anyone who may be on the situation. 

<!-- These patterns help to capture either the Computer Name (computer) or user name (user). They need to be declared at the beginning of the parser -->
<pattern name="patStrcomputer"><![CDATA[\w+\-\w+]]></pattern>
<pattern name="patStruser"><![CDATA[\w+ \w+]]></pattern>

<when test="$_evtId = '722051'">
<!-- Two sample events for the same event type, one shows logs containing user name with space between "First" and "Last". The second one shows computer name and domain -->
<!-- <164>May 08 2013 12:38:06: %ASA-4-722051: Group <SBL> User <potts amber> IP <> Address <> assigned to session -->
<!-- <164>May 08 2013 12:38:06: %ASA-4-722051: Group <SBL> User <> IP <> Address <> assigned to session -->

<collectAndSetAttrByRegex src="$_body">
<regex><![CDATA[Group \<<userGrp:gPatStr>\> User \<<user:patStruser>\> IP \<<srcIpAddr:gPatIpAddr>\> IPv4 Address \<<localVpnIpAddr:gPatIpAddr>\>]]></regex>
<!-- Making sure the user name space between "First Last" is replaced by a dot "First.Last" -->
<setEventAttribute attr="user">replaceStringByRegex($user, "\s", ".")</setEventAttribute>
<collectAndSetAttrByRegex src="$_body">
<!-- Here we will be capturing "computer" and "domain" in case there are multiples domains in your organization -->
<regex><![CDATA[Group \<<userGrp:gPatStr>\> User \<<computer:patStrcomputer>.<domain:gPatStr>\> IP \<<srcIpAddr:gPatIpAddr>\> IPv4 Address \<<localVpnIpAddr:gPatIpAddr>\>]]></regex>

<!-- The same concept needs to be replicated to each event type  that provides "user" and "computer" on the same event. Example: 722051, 722041, ... --->

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.