<decoder name="sap">
<prematch type="pcre2">([23])([A-Z][A-Z][A-Z0-9])(\d\d\d\d\d\d\d\d)(\d\d\d\d\d\d)</prematch>
</decoder>
<decoder name="sap">
<parent>sap</parent>
<regex type="pcre2">([23])([A-Z][A-Z][A-Z0-9])(\d\d\d\d\d\d\d\d)(\d\d\d\d\d\d)</regex>
<order>id,message_id,date,time</order>
</decoder>
<decoder name="sap">
<parent>sap</parent>
<regex type="pcre2">(\w\w)(.{5})(.{2})(.{3})(.)(.)(.{8})(.{12})(.{20})(.{40})(.{3})(.)(.{64})(.{20})</regex>
<order>term1,os_process_id,term2,work_process_number,sap_process,WP,term3,user,transaction,app,client,term4,message,terminal_name</order>
</decoder><rule id="104001" level="3">
<decoded_as>sap</decoded_as>
<description>SAP events.</description>
</rule>
**Phase 1: Completed pre-decoding.
full event: '2AUW20240311174217002249200028D1 SAPSYS RSDSBUFF 0001RSDSBUFF& '
**Phase 2: Completed decoding.
name: 'sap'
WP: '7'
app: ' RSDSBUFF '
client: ' '
date: '20240311'
dstuser: '49200028D1 '
id: '2'
message: ' 0001RSDSBUFF& '
message_id: 'AUW'
os_process_id: 'UW202'
sap_process: '1'
term1: '2A'
term2: '40'
term3: '42170022'
term4: ' '
terminal_name: ' '
time: '174217'
transaction: ' SAPSYS '
work_process_number: '311'
**Phase 3: Completed filtering (rules).
id: '104001'
level: '3'
description: 'SAP events.'
groups: '["SAP"]'
firedtimes: '1'
mail: 'false'
**Alert to be generated.**Phase 1: Completed pre-decoding.
full event: '2AUW20240311174217002249200028D1 SAPSYS RSDSBUFF 0001RSDSBUFF& 2AUW20240311174217002249200028D1 SAPSYS RSDS_BP_FREEWP 0001RSDS_BP_FREEWP& 2AUW20240311174219002249200028D1 SAPSYS RSDSENQ 0001RSDSENQ& 2AUW20240311174219002249200028D1 SAPSYS RS_UPDATE_STATUS 0001RS_UPDATE_STATUS& 2AUW20240311174219002249200028D1 SAPSYS RSSHM_CCMS_COLLECTOR 0001RSSHM_CCMS_COLLECTOR& '
**Phase 2: Completed decoding.
name: 'sap'
WP: '7'
app: ' RSDSBUFF '
client: ' '
date: '20240311'
dstuser: '49200028D1 '
id: '2'
message: ' 0001RSDSBUFF& '
message_id: 'AUW'
os_process_id: 'UW202'
sap_process: '1'
term1: '2A'
term2: '40'
term3: '42170022'
term4: ' '
terminal_name: ' '
time: '174217'
transaction: ' SAPSYS '
work_process_number: '311'
**Phase 3: Completed filtering (rules).
id: '104001'
level: '3'
description: 'SAP events.'
groups: '["SAP"]'
firedtimes: '1'
mail: 'false'
**Alert to be generated.
Hello Dimitriy,
Thank you for posting in the community.
First of all, I would like to advise you to use this as a prematch:
\d[A-Z]{3}[0-9]{26}\w\d\s+It is less general and will help you identify the beginning of the line.
On the other hand, unfortunately, Wazuh does not provide support for oneliner logs, I mean without a classic start (^) or end of line ($).
My recommendation here is to try to configure SAP to write logs in another format CEF or JSON, if the application can write in JSON you will not need to create your decoder, Wazuh can decode JSON by default.
As a final recommendation, if the application can not do that, you can create a script to transform the logs to a multi-line log and then do the agent to read this new multi-line log. It is a little more complicated but I think it can do the trick without issues.
I hope to help here.