Hi Aizat,
You have some errors regarding the decoders.
parent label (the first one)prematch or program_name label to first match a log.Also, in the case of the logs that you are using, they start with 709 <14> and that is not a default log format, so it can not be pre-decoded. But we can use these codes to set the prematch as follows:
<decoder name="ExtraHop">
<prematch>^\d+ \<\d+></prematch>
</decoder>
Then, to extract the timestamp, we can use a sibling decoder (with a name different to “timestamp”, as it is a reserved name):
<!-- 2021-10-04T15:19:30.141+08:00 -->
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>\<\d+>(\d+-\d+-\d+\w+\d+:\d+:\d+.\d+\p\d+:\d+) </regex>
<order>log_timestamp</order>
</decoder>
And then your others decoders work as expected, just removed the “^“:
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>(\d+)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|</regex>
When I tested it with wazuh-logtest I got the following output:
╰─# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.2.4
Type one log per line
709 <14>2021-10-04T15:19:30.141+08:00 EDA CEF:0|ExtraHop|Reveal(x)|7.8|1|Daily Summary: Credentials Received over HTTP|6|cn1=127 cn1Label=detectionID cn2=60 cn2Label=riskScore cs1=https://192.168.0.111/extrahop/#/detections/detail/127 cs1Label=detectionURL cs2=sec,sec.caution cs2Label=category rt=2021-10-04T07:19:30.087Z end=2021-10-04T07:19:30.087Z start=2021-10-04T07:19:30.087Z src=00:0C:29:C3:9C:96 msg=Over the past day, servers received HTTP data with passwords or basic authentication headers. If the unencrypted HTTP data is accessible to an attacker, they can collect sensitive information. Confirm that the SSL/TLS protocol or HTTP Strict Transport Security (HSTS) policy is enabled for these servers.
**Phase 1: Completed pre-decoding.
full event: '709 <14>2021-10-04T15:19:30.141+08:00 EDA CEF:0|ExtraHop|Reveal(x)|7.8|1|Daily Summary: Credentials Received over HTTP|6|cn1=127 cn1Label=detectionID cn2=60 cn2Label=riskScore cs1=https://192.168.0.111/extrahop/#/detections/detail/127 cs1Label=detectionURL cs2=sec,sec.caution cs2Label=category rt=2021-10-04T07:19:30.087Z end=2021-10-04T07:19:30.087Z start=2021-10-04T07:19:30.087Z src=00:0C:29:C3:9C:96 msg=Over the past day, servers received HTTP data with passwords or basic authentication headers. If the unencrypted HTTP data is accessible to an attacker, they can collect sensitive information. Confirm that the SSL/TLS protocol or HTTP Strict Transport Security (HSTS) policy is enabled for these servers.'
**Phase 2: Completed decoding.
name: 'ExtraHop'
CEFversion: '0'
EventID: '1'
EventName: 'Daily Summary: Credentials Received over HTTP'
EventSeverity: '6'
Product: 'Reveal(x)'
ProductVersion: '7.8'
Vendor: 'ExtraHop'
cn1: '127'
cn1Label: 'detectionID'
cn2: '60'
cn2Label: 'riskScore'
cs1: 'https://192.168.0.111/extrahop/#/detections/detail/127'
cs1Label: 'detectionURL'
cs2: 'sec,sec.caution'
cs2Label: 'category'
end: '2021-10-04T07:19:30.087Z'
log_timestamp: '2021-10-04T15:19:30.141+08:00'
msg: 'Over the past day, servers received HTTP data with passwords or basic authentication headers. If the unencrypted HTTP data is accessible to an attacker, they can collect sensitive information. Confirm that the SSL/TLS protocol or HTTP Strict Transport Security (HSTS) policy is enabled for these servers.'
rt: '2021-10-04T07:19:30.087Z'
start: '2021-10-04T07:19:30.087Z'
**Phase 3: Completed filtering (rules).
id: '1002'
level: '2'
description: 'Unknown problem somewhere in the system.'
groups: '['syslog', 'errors']'
firedtimes: '1'
gpg13: '['4.3']'
mail: 'False'
I would strongly recommend you to read the following Wazuh documentation pages in order to have a better understanding of how to elaborate custom rules and decoders:
I hope that my answer helps you!
Best Regards,
Mariano Koremblum
For some weird reason, the previous message’s XML visualization is not the best, so here it is:
<decoder name="ExtraHop">
<prematch>^\d+ \<\d+></prematch>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>\<\d+>(\d+-\d+-\d+\w+\d+:\d+:\d+.\d+\p\d+:\d+) </regex>
<order>log_timestamp</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>(\d+)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|(\.*)\|</regex>
<order>CEFversion,Vendor,Product,ProductVersion,EventID,EventName,EventSeverity</order>
</decoder>
<!--
cn1=127
cn1Label=detectionID
cn2=60
cn2Label=riskScore
cs1=https://192.168.0.111/extrahop/#/detections/detail/127
cs1Label=detectionURL
cs2=sec,sec.caution
cs2Label=category
rt=2021-10-04T07:19:30.087Z
end=2021-10-04T07:19:30.087Z
start=2021-10-04T07:19:30.087Z
src=00:0C:29:C3:9C:96
msg=
-->
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cn1=(\.*)\s\w+=|cn1=(\.*)$</regex>
<order>cn1</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cn1Label=(\.*)\s\w+=|cn1Label=(\.*)$</regex>
<order>cn1Label</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cn2=(\.*)\s\w+=|cn2=(\.*)$</regex>
<order>cn2</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cn2Label=(\.*)\s\w+=|cn2Label=(\.*)$</regex>
<order>cn2Label</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cs1=(\.*)\s\w+=|cs1=(\.*)$</regex>
<order>cs1</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cs1Label=(\.*)\s\w+=|cs1Label=(\.*)$</regex>
<order>cs1Label</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cs2=(\.*)\s\w+=|cs2=(\.*)$</regex>
<order>cs2</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>cs2Label=(\.*)\s\w+=|cn2Label=(\.*)$</regex>
<order>cs2Label</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>rt=(\.*)\s\w+=|rt=(\.*)$</regex>
<order>rt</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>end=(\.*)\s\w+=|end=(\.*)$</regex>
<order>end</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>start=(\.*)\s\w+=|start=(\.*)$</regex>
<order>start</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>source=(\.*)\s\w+=|source=(\.*)$</regex>
<order>source</order>
</decoder>
<decoder name="ExtraHop">
<parent>ExtraHop</parent>
<regex>msg=(\.*)\s\w+=|msg=(\.*)$</regex>
<order>msg</order>
</decoder>