Vault - How to modify syslog timestamp to include a millisecond format
Objective
The default syslog timestamp sent from the vault does not contain milliseconds. This describes how to modify the syslog to include a millisecond value in the syslog timestamp
Environment
12.2;12.6;13.0;13.2;14.0;14.2;14.4;14.6 Privilege Cloud Service Request
Procedure
The timestamp can be modified within the RFC5424Changes.xsl translator file contained in the C:\Program Files (x86)\PrivateArk\Server\Syslog directory on the vault server.
This file is referenced at the top of the main translator file specified in the dbparm.ini for the SIEM target:-
<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:import href='./Syslog/RFC5424Changes.xsl'/>
The default RFC5424Changes.xsl does not modify the timestamp and so the syslog is sent out with just hh:mm:ss as the timestamp format.
In order to modify the timestamp, the following section should be added to the RFC5424Changes.xsl file between the </xsl:template> and </xsl:stylesheet> statements:-
<xsl:template name="Timestamp-to-UTC"> <xsl:param name="dateTime"/> <xsl:param name="offset"/>
<xsl:variable name="date" select="substring-before($dateTime, 'T')" /> <xsl:variable name="time" select="substring-before(substring-after($dateTime, 'T'), 'Z')" />
<xsl:variable name="year" select="substring($date, 1, 4)" /> <xsl:variable name="month" select="substring($date, 6, 2)" /> <xsl:variable name="day" select="substring($date, 9, 2)" />
<xsl:variable name="hour" select="substring($time, 1, 2)" /> <xsl:variable name="minute" select="substring($time, 4, 2)" /> <xsl:variable name="second" select="substring($time, 7, 2)" /> <xsl:variable name="millisecond" select="substring($time, 9, 2)" />
<xsl:variable name="a" select="floor((14 - $month) div 12)"/> <xsl:variable name="y" select="$year + 4800 - $a"/> <xsl:variable name="m" select="$month + 12*$a - 3"/> <xsl:variable name="jd" select="$day + floor((153*$m + 2) div 5) + 365*$y + floor($y div 4) - floor($y div 100) + floor($y div 400) - 32045" />
<xsl:variable name="total-seconds" select="86400*$jd + 3600*$hour + 60*$minute + $second - 3600*$offset" />
<xsl:variable name="new-jd" select="floor($total-seconds div 86400)"/> <xsl:variable name="new-hour" select="floor($total-seconds mod 86400 div 3600)"/> <xsl:variable name="new-minute" select="floor($total-seconds mod 3600 div 60)"/> <xsl:variable name="new-second" select="$total-seconds mod 60"/>
<xsl:variable name="f" select="$new-jd + 1401 + floor((floor((4 * $new-jd + 274277) div 146097) * 3) div 4) - 38"/> <xsl:variable name="e" select="4*$f + 3"/> <xsl:variable name="g" select="floor(($e mod 1461) div 4)"/> <xsl:variable name="h" select="5*$g + 2"/> <xsl:variable name="D" select="floor(($h mod 153) div 5 ) + 1"/> <xsl:variable name="M" select="(floor($h div 153) + 2) mod 12 + 1"/> <xsl:variable name="Y" select="floor($e div 1461) - 4716 + floor((14 - $M) div 12)"/> <xsl:variable name="D1"> <xsl:choose> <xsl:when test="floor($D div 10) = '0'"><xsl:value-of select="concat('0', $D)"/></xsl:when> <xsl:otherwise><xsl:value-of select="$D"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="M1"> <xsl:choose> <xsl:when test="floor($M div 10) = '0'"><xsl:value-of select="concat('0', $M)"/></xsl:when> <xsl:otherwise><xsl:value-of select="$M"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="H1"> <xsl:choose> <xsl:when test="floor($new-hour div 10) = '0'"><xsl:value-of select="concat('0', $new-hour)"/></xsl:when> <xsl:otherwise><xsl:value-of select="$new-hour"/></xsl:otherwise> </xsl:choose> </xsl:variable> <!--<xsl:value-of select="concat($Y, format-number($M, '-00'), format-number($D, '-00'))"/>--> <xsl:value-of select="concat($Y, '-', $M1, '-', $D1)"/> <xsl:text>T</xsl:text> <!--<xsl:value-of select="concat(format-number($new-hour, '00'), format-number($new-minute, ':00'), format-number($new-second, ':00'))"/> --> <xsl:value-of select="concat($H1, ':', $minute, ':', $second, ':000')"/> <xsl:text>Z</xsl:text></xsl:template>
This section also ensures that the syslog timestamp is in UTC time
The important line in this case is this one:-
<xsl:value-of select="concat($H1, ':', $minute, ':', $second, ':000')"/>
This will ensure that the timestamp of syslogs sent from the vault will be hh:mm:ss:000.
Please note, the millisecond value will always be '000' when using this configuration. This is a dummy value to address any formatting issues with the target SIEM. The value can be changed but it will always be the same.
After saving the modified file, a vault restart is required.
For Privilege Cloud environments, the above needs to be carried out by a Idira engineer. Please raise a case for assistance with this quoting this article