I am trying to remove text out of an ADFS log, and my regex works to hightlight the text, but I want to remove it out of a message and leave the rest but its not working.
This is my rule:
rule "remove all before AuditBase"
when
has_field("message")
then
let ADFS = regex("(?i)(^The Federation Service.*|^Activity ID: .*|^Additional Data.*|^XML: .*|^<AuditBase.*|^</AuditBase>|^\\n)mg", to_string($message.message));
set_field("message", ADFS["0"]);
end
The Federation Service failed to validate a new credential. See XML for failure details.
Activity ID: b7d7deb6-4323-40fd-9259-00800100007f
Additional Data
XML: <?xml version="1.0" encoding="utf-16"?>
<AuditBase xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FreshCredentialAudit">
<AuditType>FreshCredentials</AuditType>
<AuditResult>Failure</AuditResult>
<FailureType>CredentialValidationError</FailureType>
<ErrorCode>N/A</ErrorCode>
<ContextComponents>
<Component xsi:type="ResourceAuditComponent">
<RelyingParty>https://weblogin.contoso.edu/adfs/services/trust</RelyingParty>
<ClaimsProvider>N/A</ClaimsProvider>
<UserId>contonso.edu\rachael</UserId>
</Component>
<Component xsi:type="AuthNAuditComponent">
<PrimaryAuth>N/A</PrimaryAuth>
<DeviceAuth>false</DeviceAuth>
<DeviceId>N/A</DeviceId>
<MfaPerformed>false</MfaPerformed>
<MfaMethod>N/A</MfaMethod>
<TokenBindingProvidedId>false</TokenBindingProvidedId>
<TokenBindingReferredId>false</TokenBindingReferredId>
<SsoBindingValidationLevel>NotSet</SsoBindingValidationLevel>
</Component>
<Component xsi:type="ProtocolAuditComponent">
<OAuthClientId>N/A</OAuthClientId>
<OAuthGrant>N/A</OAuthGrant>
</Component>
<Component xsi:type="RequestAuditComponent">
<Server>https://weblogin.contoso.edu/adfs/services/trust</Server>
<AuthProtocol>SAMLP</AuthProtocol>
<NetworkLocation>Intranet</NetworkLocation>
<IpAddress>199.199.94.22</IpAddress>
<ForwardedIpAddress>65.129.84.94</ForwardedIpAddress>
<ProxyIpAddress>N/A</ProxyIpAddress>
<NetworkIpAddress>N/A</NetworkIpAddress>
<ProxyServer>N/A</ProxyServer>
<UserAgentString>Mozilla/5.0 (Linux; Android 7.1.1; SM-T350 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.138 Safari/537.36 MinuteMaid</UserAgentString>
<Endpoint>/adfs/ls/</Endpoint>
</Component>
</ContextComponents>
</AuditBase>