PTA - Syslog messages from Vault not parsing correctly and causing error in diamond log
Symptom
Syslog message from Vault are reaching PTA but they are not being processed and an error like the one below appears in the diamond log:-
LOG | [2022-11-22|13:57:32.719|CET] | ERROR | {aid=listener} | {sid=} | {rid=} | {tid=siem_blocking_queue-2} | com.cyberark.diamond.inbound.plugin.PluginAuditCreatorFactory$PluginAuditCreator.createAudit(PluginAuditCreatorFactory.java:116) - SYS0253E :: Fail to create audit for <5>1 2022-11-22T12:57:32:00Z XXXXXXXXXXXX Cyber-Ark Vault 361 - |user|2022-11-22T12:57:32Z|361|Keystroke logging|10.0.0.1|Root\Operating System-user|Unix|hostname|Operating System||Command=tail -f /opt/tomcat/logs/diamond.log | grep 'Incoming syslog';ConnectionComponentId=PSM-SSH;DstHost=hostname;Protocol=SSH;PSMID=PSMServer;SessionID=f3a0d124-ab6a-4855-84aa-866325270bf5;SrcHost=10.0.1.1;SSHOffset=388350B;User=initial;VIDOffset=2558T;| with plugin com.cyberark.diamond.plugins.impl.inbound.PSMCommandAuditCreator
java.lang.IllegalArgumentException: 2022-11-22T12:57:32:00Z
Environment
N/A Privileged Access Manager (PAM, self-hosted) PTA
PTA
Vault
Cause
There are several issues with the way this particular syslog message is formatted. In this case the timestamp is in a format that PTA is not expecting. 2022-11-22T12:57:32:00Z should be more like 2022-11-22T12:57:32Z. There is too much information and this causes an IllegalArgumentException.
This is most likely due to an issue with the xsl file on the Vault server. For PTA, the PTA.xsl translator file should be used, however this also references an RFC5424Changes.xsl file as shown in the first few lines of PTA.xsl below:-
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href='./Syslog/RFC5424Changes.xsl'/>
<xsl:output method='text' version='1.0' encoding='UTF-8'/>
<xsl:key name="CAProperty_Name" match="CAProperty" use="@Name"/>
Both should be checked.
In this particular case, the RFC5424Changes.xsl file had been modified to contain the following:-
<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)" />
This was causing the incorrect date format to be sent to PTA.
Resolution
The RFC5424Changes.xsl file referenced by PTA.xsl should contain only the following:-
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text' version='1.0' encoding='UTF-8'/>
<xsl:template match="*">
<xsl:choose>
<xsl:when test="audit_record/Rfc5424='yes'">
<xsl:text><</xsl:text><!-- the character '<' -->
<xsl:choose>
<xsl:when test="audit_record/Severity='Critical'">10</xsl:when>
<xsl:when test="audit_record/Severity='Error'">7</xsl:when>
<xsl:when test="audit_record/Severity='Info'">5</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
<xsl:text>></xsl:text> <!-- the character '>' -->
<xsl:text>1 </xsl:text> <!-- Syslog Version -->
<xsl:value-of select="audit_record/IsoTimestamp"/>
<xsl:text> </xsl:text> <!-- space -->
<xsl:value-of select="audit_record/Hostname"/>
<xsl:text> </xsl:text> <!-- space -->
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
If the RFC5424Changes.xsl file needs to be modified to alter the way syslog messages are formatted for sending to other SIEM servers, then the modified RFC5424Changes.xsl file should be saved with a different name and then the file with the new name referenced in the translator used by the xsl file for the other SIEM server.