Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/oracle/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.6.0"
changes:
- description: Added support for database audit events, originally it was only supporting objects.
type: enhancement
link: https://github.com/elastic/integrations/pull/4447
- version: "1.5.0"
changes:
- description: Add support for specially crafted action lines.
Expand All @@ -8,7 +13,7 @@
changes:
- description: Pipeline issue fixes in Performance datastream.
type: bugfix
link: https://github.com/elastic/integrations/pull/4421
link: https://github.com/elastic/integrations/pull/4421
- version: "1.4.1"
changes:
- description: Remove duplicate field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,12 @@ DBID:[10] '123'
SESSIONID:[10] '123'
USERHOST:[24] 'testmachine.local'
CLIENT ADDRESS:[0] ''
ACTION NUMBER:[2] '47'
ACTION NUMBER:[2] '47'

Thu May 13 23:20:32 2021 -04:00
LENGTH: "385"
SESSIONID:[10] "12354" ENTRYID:[1] "1" STATEMENT:[1] "9" USERID:[11] "TEST_USER" USERHOST:[25] "test.local" TERMINAL:[7] "unknown" ACTION:[3] "103" RETURNCODE:[1] "0" OBJ$CREATOR:[11] "TEST_OBJ" OBJ$NAME:[10] "ATTRIBUTES" SES$ACTIONS:[16] "---------S------" SES$TID:[6] "157827" OS$USERID:[8] "test_id" DBID:[10] "12345" CURRENT_USER:[11] "TEST_USR"

Mon Aug 17 05:25:25 2020 -04:00
LENGTH: "361"
SESSIONID:[9] "123456" ENTRYID:[1] "1" STATEMENT:[1] "1" USERID:[14] "TEST_USER" USERHOST:[26] "test.local" TERMINAL:[7] "unknown" ACTION:[3] "100" RETURNCODE:[1] "0" COMMENT$TEXT:[99] "TEST_COMMENT" OS$USERID:[8] "test_id" DBID:[10] "1123554"
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@
"action": "database_audit",
"category": "database",
"kind": "event",
"original": "Thu Jan 28 18:27:48 2021 -05:00\nLENGTH : '2462'\nACTION :[2192] 'DECLARE\n link_failed boolean;\n\nBEGIN\n FOR f IN ( SELECT *\n FROM test_db\n where field1 not in ('teststring')\n and field1 = upper('teststring2')\n and test_db = upper('test.domain')\n ORDER BY field, test_db)\n LOOP\n TEST.create_job (\n job_name =\u003e f.owner || '.TESTSTRING',\n job_type =\u003e 'TESTSTRING',\n job_action =\u003e 'TESTSTRING '\n || ' TESTSTRING; '\n || 'TESTSTRING '\n || ' SELECT dummy into x from TEST@'\n || f.test3\n || ' ;'\n || ' TEST.put_line('''\n || f.test2\n || ' '\n || f.test\n || ' VALID !!!!!!!!!!!!!!!!!!'');'\n || 'END ; ');\n\n BEGIN\n TEST.run_job (f.owner || '.TESTSTRING ', TRUE);\n EXCEPTION\n WHEN OTHERS\n THEN\n link_failed:=true;\n TEST.put_line (\n f.owner\n || ' '\n || f.db_link\n || ' INVALID (ORA'\n || SQLCODE\n || ')');\n END;\n\n TEST.job (f.owner || ' . TESTSTRING ');\n\n if link_failed THEN\n TEST.put_line (\n f.owner\n || ' '\n || f.TEST\n || ' TESTSTRING - TEST (ORA'\n || SQLCODE\n || ')');\n insert into TEST.somestring\n values (f.owner, f.test, 'INVALID', sysdate);\n commit;\n else\n insert into TEST.somestring\n values (f.owner, f.test, 'VALID', sysdate);\n commit;\n end if;\n\n END LOOP;\nEND;'\nDATABASE USER:[1] '/'\nPRIVILEGE :[6] 'SYSDBA'\nCLIENT USER:[6] 'oracle'\nCLIENT TERMINAL:[5] 'pts/0'\nSTATUS:[1] '0'\nDBID:[10] '123'\nSESSIONID:[10] '123'\nUSERHOST:[24] 'testmachine.local'\nCLIENT ADDRESS:[0] ''\nACTION NUMBER:[2] '47'",
"original": "Thu Jan 28 18:27:48 2021 -05:00\nLENGTH : '2462'\nACTION :[2192] 'DECLARE\n link_failed boolean;\n\nBEGIN\n FOR f IN ( SELECT *\n FROM test_db\n where field1 not in ('teststring')\n and field1 = upper('teststring2')\n and test_db = upper('test.domain')\n ORDER BY field, test_db)\n LOOP\n TEST.create_job (\n job_name =\u003e f.owner || '.TESTSTRING',\n job_type =\u003e 'TESTSTRING',\n job_action =\u003e 'TESTSTRING '\n || ' TESTSTRING; '\n || 'TESTSTRING '\n || ' SELECT dummy into x from TEST@'\n || f.test3\n || ' ;'\n || ' TEST.put_line('''\n || f.test2\n || ' '\n || f.test\n || ' VALID !!!!!!!!!!!!!!!!!!'');'\n || 'END ; ');\n\n BEGIN\n TEST.run_job (f.owner || '.TESTSTRING ', TRUE);\n EXCEPTION\n WHEN OTHERS\n THEN\n link_failed:=true;\n TEST.put_line (\n f.owner\n || ' '\n || f.db_link\n || ' INVALID (ORA'\n || SQLCODE\n || ')');\n END;\n\n TEST.job (f.owner || ' . TESTSTRING ');\n\n if link_failed THEN\n TEST.put_line (\n f.owner\n || ' '\n || f.TEST\n || ' TESTSTRING - TEST (ORA'\n || SQLCODE\n || ')');\n insert into TEST.somestring\n values (f.owner, f.test, 'INVALID', sysdate);\n commit;\n else\n insert into TEST.somestring\n values (f.owner, f.test, 'VALID', sysdate);\n commit;\n end if;\n\n END LOOP;\nEND;'\nDATABASE USER:[1] '/'\nPRIVILEGE :[6] 'SYSDBA'\nCLIENT USER:[6] 'oracle'\nCLIENT TERMINAL:[5] 'pts/0'\nSTATUS:[1] '0'\nDBID:[10] '123'\nSESSIONID:[10] '123'\nUSERHOST:[24] 'testmachine.local'\nCLIENT ADDRESS:[0] ''\nACTION NUMBER:[2] '47'\n",
"outcome": "success",
"timezone": "-05:00",
"type": "access"
Expand Down Expand Up @@ -1292,6 +1292,113 @@
"user": {
"roles": "SYSDBA"
}
},
{
"@timestamp": "2021-05-14T03:20:32.000Z",
"client": {
"user": {
"id": "TEST_USER",
"name": "TEST_USR"
}
},
"ecs": {
"version": "8.4.0"
},
"event": {
"action": "database_audit",
"category": "database",
"kind": "event",
"original": "Thu May 13 23:20:32 2021 -04:00\nLENGTH: \"385\"\nSESSIONID:[10] \"12354\" ENTRYID:[1] \"1\" STATEMENT:[1] \"9\" USERID:[11] \"TEST_USER\" USERHOST:[25] \"test.local\" TERMINAL:[7] \"unknown\" ACTION:[3] \"103\" RETURNCODE:[1] \"0\" OBJ$CREATOR:[11] \"TEST_OBJ\" OBJ$NAME:[10] \"ATTRIBUTES\" SES$ACTIONS:[16] \"---------S------\" SES$TID:[6] \"157827\" OS$USERID:[8] \"test_id\" DBID:[10] \"12345\" CURRENT_USER:[11] \"TEST_USR\"\n",
"outcome": "success",
"timezone": "-04:00",
"type": "access"
},
"oracle": {
"database_audit": {
"action": "103",
"database": {
"id": "12345"
},
"entry": {
"id": 1
},
"length": 385,
"obj_creator": "TEST_OBJ",
"obj_name": "ATTRIBUTES",
"os_userid": "test_id",
"returncode": "0",
"ses_actions": "---------S------",
"ses_tid": "157827",
"session_id": "12354",
"statement": "9",
"terminal": "unknown"
}
},
"related": {
"hosts": [
"test.local"
],
"user": [
"TEST_USR"
]
},
"server": {
"address": "test.local",
"domain": "test.local"
},
"tags": [
"preserve_original_event"
]
},
{
"@timestamp": "2020-08-17T09:25:25.000Z",
"client": {
"user": {
"id": "TEST_USER"
}
},
"ecs": {
"version": "8.4.0"
},
"event": {
"action": "database_audit",
"category": "database",
"kind": "event",
"original": "Mon Aug 17 05:25:25 2020 -04:00\nLENGTH: \"361\"\nSESSIONID:[9] \"123456\" ENTRYID:[1] \"1\" STATEMENT:[1] \"1\" USERID:[14] \"TEST_USER\" USERHOST:[26] \"test.local\" TERMINAL:[7] \"unknown\" ACTION:[3] \"100\" RETURNCODE:[1] \"0\" COMMENT$TEXT:[99] \"TEST_COMMENT\" OS$USERID:[8] \"test_id\" DBID:[10] \"1123554\"",
"outcome": "success",
"timezone": "-04:00",
"type": "access"
},
"oracle": {
"database_audit": {
"action": "100",
"comment_text": "TEST_COMMENT",
"database": {
"id": "1123554"
},
"entry": {
"id": 1
},
"length": 361,
"os_userid": "test_id",
"returncode": "0",
"session_id": "123456",
"statement": "1",
"terminal": "unknown"
}
},
"related": {
"hosts": [
"test.local"
]
},
"server": {
"address": "test.local",
"domain": "test.local"
},
"tags": [
"preserve_original_event"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,28 @@ processors:
- set:
field: event.outcome
value: success
# Need to know which type of audit event it is, oracle_event_type is a temp field.
- set:
field: oracle_event_type
value: database
if: 'ctx.message.contains("LENGTH :")'
- set:
field: oracle_event_type
value: object
if: 'ctx.message.contains("LENGTH:")'
- set:
field: event.outcome
value: success
- rename:
field: message
target_field: event.original
ignore_missing: true
# First pattern for object, second for database audit events.
- grok:
field: event.original
patterns:
- "%{GREEDYDATA:tmp_timestamp}\\nLENGTH : '%{GREEDYDATA:LENGTH}'\\nACTION :\\[\\d+\\] (?m)%{GREEDYDATA:action}(DATABASE USER):\\S+ '%{FIELD:db_user}'\\n(?m)%{GREEDYDATA:audit}"
- "%{GREEDYDATA:tmp_timestamp}\\nLENGTH: \"%{GREEDYDATA:LENGTH}\"\\n%{GREEDYDATA:audit}"
pattern_definitions:
"FIELD": "[^']+"
- kv:
Expand All @@ -36,6 +50,14 @@ processors:
trim_value: " '"
trim_key: " "
prefix: oracle.database_audit.
if: ctx.oracle_event_type == "database"
- kv:
field: audit
field_split: "\" "
value_split: ":\\S\\d+\\S (?=\")"
strip_brackets: true
prefix: oracle.database_audit.
if: ctx.oracle_event_type == "object"
- grok:
field: log.file.path
patterns:
Expand Down Expand Up @@ -126,6 +148,38 @@ processors:
field: oracle.database_audit.client_user
target_field: client.user.name
ignore_missing: true
- rename:
field: oracle.database_audit.userid
target_field: client.user.id
ignore_missing: true
- rename:
field: oracle.database_audit.current_user
target_field: client.user.name
ignore_missing: true
- rename:
field: oracle.database_audit.comment$text
target_field: oracle.database_audit.comment_text
ignore_missing: true
- rename:
field: oracle.database_audit.obj$creator
target_field: oracle.database_audit.obj_creator
ignore_missing: true
- rename:
field: oracle.database_audit.obj$name
target_field: oracle.database_audit.obj_name
ignore_missing: true
- rename:
field: oracle.database_audit.os$userid
target_field: oracle.database_audit.os_userid
ignore_missing: true
- rename:
field: oracle.database_audit.ses$actions
target_field: oracle.database_audit.ses_actions
ignore_missing: true
- rename:
field: oracle.database_audit.ses$tid
target_field: oracle.database_audit.ses_tid
ignore_missing: true
- rename:
field: oracle.database_audit.client_address
target_field: client.address
Expand Down Expand Up @@ -183,6 +237,14 @@ processors:
field: oracle.database_audit.entry_id
target_field: oracle.database_audit.entry.id
ignore_missing: true
- rename:
field: oracle.database_audit.entryid
target_field: oracle.database_audit.entry.id
ignore_missing: true
- convert:
field: oracle.database_audit.entry.id
type: long
ignore_missing: true
- convert:
field: process.pid
type: long
Expand Down Expand Up @@ -226,6 +288,7 @@ processors:
field:
- tmp_timestamp
- audit
- oracle_event_type
ignore_missing: true
on_failure:
- set:
Expand Down
2 changes: 2 additions & 0 deletions packages/oracle/data_stream/database_audit/fields/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
name: client.domain
- external: ecs
name: client.user.name
- external: ecs
name: client.user.id
- external: ecs
name: client.ip
- external: ecs
Expand Down
51 changes: 50 additions & 1 deletion packages/oracle/data_stream/database_audit/fields/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
The privilege group related to the database user.

- name: entry.id
type: keyword
type: long
description: >
Indicates the current audit entry number, assigned to each audit trail record. The audit entry.id sequence number is shared between fine-grained audit records and regular audit records.

Expand Down Expand Up @@ -69,3 +69,52 @@
description: >
Refers to the total number of bytes used in this audit record. This number includes the trailing newline bytes (\n), if any, at the end of the audit record.

- name: comment_text
type: text
description: >
Additional comments about the related audit record.

- name: obj_creator
type: keyword
description: >
The owner of the object, equivalent field in DBA_AUDIT_Trail is OWNER.

- name: obj_name
type: keyword
description: >
The name of the object.

- name: os_userid
type: keyword
description: >
The related OS user.

- name: os_userid
type: keyword
description: >
The related OS user.

- name: returncode
type: keyword
description: >
Indicates if the audited action was successful. 0 indicates success. If the action fails, the return code lists the Oracle Database error number.

- name: ses_actions
type: keyword
description: >
Defines the type of action performed using 12 characters, each position indicates the result of an action. They are: ALTER, AUDIT, COMMENT, DELETE, GRANT, INDEX, INSERT, LOCK, RENAME, SELECT, UPDATE, and FLASHBACK.

- name: ses_tid
type: keyword
description: >
The ID of the object related to the audit event.

- name: statement
type: keyword
description: >
The statement ID related to the audit event.

- name: terminal
type: keyword
description: >-
The terminal identifier.
Loading
⌂ 换网址