Hello everyone, I ask you to help me deal with the following problem. I have a voodle that, using Python, takes the log I need from opensearch and sends it to the queue socket. The message to be sent looks like this:
1:Teleport_OS_query:{'addr.remote': '
10.20.10.28:59948', 'caller': 'events/emitter.go:278', 'cluster_name': 'test', 'code': 'T3009I', 'component': 'audit', 'ei': 0, 'event': 'kube.request', 'kubernetes_cluster': 'test', 'kubernetes_groups': ['test-admins', 'system:authenticated'], 'kubernetes_labels': {'teleport.internal/resource-id': 'bf1b3e37', 'teleport_cluster_name': 'test'}, 'kubernetes_users': ['teleport-admins'], 'level': 'info', 'login': 'admin@test', 'message': 'kube.request', 'namespace': 'default', 'proto': 'kube', 'request_path': '/version', 'response_code': 200, 'server_id': '266f08f8', 'sid': '', 'time': '2024-03-26T07:23:34.346Z', 'timestamp': '2024-03-26T07:23:34Z', 'uid': '16c5d6e0', 'user': 'admin@test', 'user_kind': 1, 'verb': 'GET'}
The script runs successfully even if you add the following rule:
<rule id="100322" level="0">
<location>Teleport_OS_query</location>
<decoded_as>json</decoded_as>
<description>Teleport audit logs</description>
</rule>
Then I see alerts and everything looks good. But I would like to add rules to filter out unnecessary alerts, for example, I tried the following rule, which does not work:
<rule id="100323" level="3">
<if_sid>100322</if_sid>
<decoded_as>json</decoded_as>
<field name="event" type="pcre2">kube.request</field>
<field name="resource_kind">\.+</field>
<description>Teleport: User $(login) made a request $(verb) to the $(namespace) for the $(resource_kind) in cluster $(kubernetes_cluster) </description>
</rule>
I understand that with a high degree of probability, the problem is that the initial log does not come in the json format and Vazukh does not understand what format it is, and accordingly, cannot get the fields from the log. However, I don’t understand how to specify that vazukh considers this log a valid personal log. Please help me figure it out. Thank you in advance.