You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cse/rules/before-writing-custom-rule.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Now that we understand the mapping in Cloud SIEM, we can see we will want to be
51
51
52
52
In this step, we’ll create the query that will serve as the rule expression when we create the rule.
53
53
54
-
1. Using the attributes we discovered from looking at the log mapping, we’ll run the following query, which returns the usernames that have successfully logged on over the last week, counted by `user_username`.
54
+
1. Using the attributes we discovered from looking at the log mapping, we’ll run the following query, which returns the usernames that have successfully logged on over the last week, counted by `user_username`:
55
55
56
56
```sql
57
57
_index=sec_record_*
@@ -63,10 +63,10 @@ In this step, we’ll create the query that will serve as the rule expression wh
63
63
64
64
The results show two of our standard username patterns:
65
65
66
-
* The username for regular user accounts are a plain string, with no special characters, like specops and jask.
66
+
* The username for regular user accounts are a plain string, with no special characters, like `specops` and `jask`.
67
67
* Machine usernames are a string, followed by a dash character, followed by a string, followed by a dollar sign, like `win10-admin$` and `win10-client$`.
68
68
69
-
1. Now, we can refine our search to return usernames that do not comply with either of our standard patterns.
69
+
1. Now, we can refine our search to return usernames that do not comply with either of our standard patterns:
70
70
71
71
```sql
72
72
_index=sec_record_*
@@ -76,7 +76,7 @@ In this step, we’ll create the query that will serve as the rule expression wh
1. Usernames returned include “anonymous logon”. A little [research](https://social.technet.microsoft.com/Forums/ie/en-US/dbcbb9f1-c6a7-43ea-94b8-ba72a89e2221/nt-authorityanonymous-logon?forum=winservergen) indicates that this is typically no cause for alarm, so we’ll refine our search again to exclude “anonymous logon”.
79
+
1. Usernames returned include “anonymous logon”. A little [research](https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-special-identities-groups) indicates that this is typically no cause for alarm, so we’ll refine our search again to exclude “anonymous logon”:
80
80
81
81
```sql
82
82
_index=sec_record_*
@@ -89,17 +89,25 @@ In this step, we’ll create the query that will serve as the rule expression wh
1. Now we have a query we can use as the basis of an expression for our rule. Note that when you paste it into the rules editor you should remove the first portion of the query, which is only necessary when you are querying records in Sumo Logic: `_index=sec_record_*`
99
+
1. Now we have a query we can use as the basis of an expression for our rule. Note that when you paste it into the rules editor, you should remove the first portion of the query (`_index=sec_record_*` and `| where`), which is only necessary when you are querying records in Sumo Logic. The expression is then as follows:
101
100
102
-
You should also ensure that the syntax of the expression matches what is needed by the [Cloud SIEM rules syntax](/docs/cse/rules/cse-rules-syntax/).
101
+
```sql
102
+
metadata_vendor ="Microsoft"
103
+
and metadata_product ="Windows"
104
+
and metadata_deviceEventId ="Security-4624"
105
+
and !(user_username matches /^[a-zA-Z]*$/or user_username matches "*-*$")
106
+
and user_username !="anonymous logon"
107
+
and fields["EventData.ProcessName"] matches "*.exe"
108
+
```
109
+
110
+
Also ensure that the syntax of the expression matches what is needed by the [Cloud SIEM rules syntax](/docs/cse/rules/cse-rules-syntax/). Once you are satisfied that the expression is ready, click **Test Rule Expression** to verify that the expression returns expected results.
103
111
104
112
You can use an expression like this example in any rule type. Here is an example Match rule with the expression, shown in the rules editor.
0 commit comments