Oracle Audit Vault and Database Firewall Developers Guide
Oracle Audit Vault and Database Firewall Developers Guide
Oracle Audit Vault and Database Firewall Developers Guide
Firewall
Developer's Guide
Release 20
E93410-06
May 2021
Oracle Audit Vault and Database Firewall Developer's Guide, Release 20
E93410-06
Contributors: Sumanth Vishwaraj, Rajesh Tammana, Mahesh Rao, Prabhu Sahoo, Sourav Basu, Vipin Samar
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government
end users are "commercial computer software" or "commercial computer software documentation" pursuant
to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such,
the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works,
and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs
embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle
computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the
license contained in the applicable contract. The terms governing the U.S. Government’s use of Oracle cloud
services are defined by the applicable contract for such services. No other rights are granted to the U.S.
Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not
be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Audience xiii
Documentation Accessibility xiii
Diversity and Inclusion xiii
Related Documents xiv
Conventions xiv
Translation xiv
iii
1.5.2 Flow of Control Inside the Audit Collection Plug-in 1-9
1.5.3 Collection Concepts 1-10
1.5.3.1 Collection Thread 1-10
1.5.3.2 Collection Phase 1-10
1.5.3.3 Mapping 1-11
1.5.3.4 Checkpoint of a Trail 1-11
1.5.3.5 Recovery Phase Of Data Collection 1-11
1.5.3.6 Audit Trail Clean-Up 1-12
1.6 General Procedure for Writing Audit Collection Plug-ins 1-12
iv
3.6 CSV File Collection Plug-ins 3-30
3.6.1 Requirements for CSV File Collection Plug-ins 3-31
3.6.2 Example Audit Trail for a CSV File Collection Plug-in 3-31
3.6.3 Creating the CSV File Audit Collection Mapper File 3-33
3.7 JSON REST Collection Plug-ins 3-38
3.7.1 Requirements for JSON REST Collection Plug-ins 3-38
3.7.2 Example Audit Trail for a JSON REST Collections Plug-in 3-39
3.7.3 Creating the JSON REST Audit Collection Mapper File 3-41
3.8 Target Collection Attributes 3-46
3.9 Preprocessing Audit Data 3-47
v
4.5.14 Using Exceptions in Collection Plug-ins 4-22
4.6 Java-Based Collection Plug-in Utility APIs 4-23
4.6.1 About Connection to Database Sources Using ConnectionManager API 4-23
4.6.2 Example of Using the ConnectionManager API to Connect to Database
Sources 4-24
4.6.3 Using the Windows Event Log Access API 4-26
4.6.4 Using Windows EventMetaData API 4-29
4.6.5 Using the AVLogger API to Log Messages 4-30
4.6.6 Using the Oracle XML Developer's Kit to Parse XML Files 4-31
4.7 Using an Audit Trail Cleanup with Java-Based Collection Plug-ins 4-31
4.8 Java-Based Collection Plug-in Security Considerations 4-32
B Schemas
B.1 Sample Schema for a plugin-manifest.xml file B-1
vi
B.2 Database Table Collection Plug-in Mapper File B-4
B.3 Schema For XML File Collection Plug-in Mapper File B-6
B.4 Schema For JSON File Collection Plug-in Mapper File B-7
B.5 Schema For CSV File Collection Plug-in Mapper File B-8
B.6 Schema For JSON REST Collection Plug-in Mapper File B-9
B.7 Schema For REST Collector Plug-in Mapper File B-12
B.8 Schema For Name Pattern Collection Plug-in Mapper File B-14
B.9 Schema For JSON Collector Plug-in Mapper File B-16
B.10 Schema For EZCollector Plug-in Mapper File B-17
C Example Code
C.1 Database Table Collection Plug-in Example C-1
C.1.1 Database Table Collection Plug-in Mapper File C-1
C.1.2 Database Table Collection Plug-in Manifest File C-5
C.2 XML File Collection Plug-in Examples C-6
C.2.1 XML File Collection Plug-In Mapper File C-7
C.2.2 XML File Collection Plug-In Manifest File C-10
C.3 JSON File Collection Plug-in Example C-12
C.3.1 JSON File Collection Plug-In Mapper File C-12
C.3.2 JSON File Collection Plug-In Manifest File C-15
C.4 CSV File Collection Plug-in Example C-16
C.4.1 CSV File Collection Plug-In Mapper File C-16
C.4.2 CSV File Collection Plug-In Manifest File C-20
C.5 JSON REST Collection Plug-in Example C-21
C.5.1 JSON REST Collection Plug-In Mapper File C-21
C.5.2 JSON REST Collection Plug-In Manifest File C-25
C.6 Java-Based Collection Plug-in Example C-26
C.6.1 Java Collection Plug-in Code C-26
C.6.2 Java Based Collection Plug-in Manifest File C-37
Glossary
vii
Index
viii
List of Examples
2-1 General Directory Structure 2-3
2-2 Directory Structure For Collection Plug-In 2-4
2-3 Directory Structure for Java-Based Collection Plug-in 2-5
3-1 Sample XML Audit Record 3-14
3-2 Audit.xml: Sample XML Audit Record 3-20
3-3 test_template.xsl 3-21
3-4 Transformed Audit Record file 3-22
3-5 Sample JSON Audit Record 3-25
3-6 Sample CSV Audit Record 3-32
3-7 Sample JSON Audit Record 3-40
4-1 Creating a SampleAuditEventCollector Class 4-7
4-2 Initializing a Java-Based Collection Plug-in 4-10
4-3 Using the ConnectionManager Utility to Connect and Retrieve Audit Records From a
Database 4-11
4-4 Fetching ResultSets and Setting Checkpoints 4-12
4-5 Using hasNext to Fetch Records 4-13
4-6 Transforming EventTime from Source Time Zone to UTC 4-14
4-7 Mapping Source Event Names to Audit Vault Event Names 4-14
4-8 Mapping Source Event Ids to Source Event Names 4-15
4-9 Mapping Source ID to Target Type 4-16
4-10 Transforming Source Values to Oracle Audit Vault EventStatus Values 4-17
4-11 Returning Values that Do Not Need Transformation 4-17
4-12 Changing an Oracle Audit Vault and Database Firewall Attribute 4-18
4-13 Changing a Custom Attribute 4-19
4-14 Creating an Extension Field 4-19
4-15 Creating Large Fields 4-20
4-16 Creating Markers 4-21
4-17 Calling Close and Releasing Resources 4-22
4-18 Using the Connection Manager to Handle Connection Pooling 4-24
4-19 Using the AVLogger API 4-30
B-1 Sample plugin-manifest.xsd file B-1
B-2 Database Table Collection Plug-in Mapper Schema B-4
B-3 XML file collection plug-in Mapper Schema B-6
B-4 JSON file collection plug-in Mapper Schema B-7
B-5 CSV file collection plug-in Mapper Schema B-8
ix
B-6 JSON REST collection plug-in Mapper Schema B-10
B-7 REST Collector Plug-in Mapper File B-12
B-8 Name Pattern Collection Plug-in Mapper File B-15
B-9 JSON Collector Plug-in Mapper File B-16
B-10 EZCollector Plug-in Mapper File B-17
C-1 Sample XML Mapper File for a Database Table Collection Plug-in C-2
C-2 Sample Manifest File for a Database Table Collection Plug-in C-5
C-3 Sample XML File Collection Plug-in Mapper File C-7
C-4 Sample Manifest File for an XML File Collection Plug-in C-10
C-5 Sample JSON File Collection Plug-in Mapper File C-12
C-6 Sample Manifest File for a JSON File Collection Plug-in C-15
C-7 Sample CSV File Collection Plug-in Mapper File C-17
C-8 Sample Manifest File for a CSV File Collection Plug-in C-20
C-9 Sample JSON REST Collection Plug-in Mapper File C-22
C-10 Sample Manifest File for a JSON REST Collection Plug-in C-25
C-11 SampleEventCollectorFactory.java C-26
C-12 SampleEventCollector.java C-27
C-13 Java-Based Manifest File C-37
x
List of Figures
1-1 Flow of Collection for Oracle Audit Vault Collection Agents 1-9
4-1 Classes and Interfaces from AuditService, CollectorContext, and Class AVLogger 4-4
4-2 Classes and Interfaces from Collection Framework Used in Collection Plug-in 4-5
4-3 Structure of Windows Event Logs 4-27
4-4 EventMetaData_Classes 4-29
xi
List of Tables
3-1 AUD Audit Table Data Fields and Mappings 3-4
3-2 Audit Data Fields in XML Audit Records and Mappings 3-13
3-3 Audit Data Fields in JSON Audit Records and Mappings 3-24
3-4 Audit Data Fields in CSV Audit Records and Mappings 3-32
3-5 Audit Data Fields in JSON Audit Records and Mappings 3-40
D-1 JDBC Drivers and Connecting URLs D-2
xii
Preface
Oracle Audit Vault and Database Firewall Developer's Guide explains how to develop
Audit Collection Plug-ins for Oracle Audit Vault and Database Firewall.
• Audience
• Documentation Accessibility
• Diversity and Inclusion
• Related Documents
• Conventions
• Translation
This topic contains translation (or localization) information for Oracle AVDF User
Interface and Documentation.
Audience
Oracle Audit Vault and Database Firewall Developer's Guide is intended for
developers who want to develop Audit Collection Plug-ins.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the
Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
xiii
Preface
Related Documents
See Oracle Audit Vault and Database Firewall 20.1 Books.
For the latest version of the Oracle documentation, including this guide, visit
http://www.oracle.com/technetwork/documentation/index.html
My Oracle Support
You can find information about security patches, certifications, and the support
knowledge base by visiting My Oracle Support:
https://support.oracle.com/
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements
associated with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables
for which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs,
code in examples, text that appears on the screen, or text that you
enter.
Translation
This topic contains translation (or localization) information for Oracle AVDF User
Interface and Documentation.
xiv
Preface
The Web based User Interface or the Audit Vault Server console is translated and
made available in the following languages. This includes the User Interface, error
messages, and help text.
• French
• German
• Italian
• Japanese
• Korean
• Spanish
• Portuguese - Brazil
• Chinese - Traditional
• Chinese - Simplified
Oracle AVDF Documentation is available in the following languages:
• English
• Japanese
xv
Changes in This Release for Oracle Audit Vault and Database Firewall
xvi
1
What is Oracle Audit Vault and Database
Firewall
Learn about Oracle Audit Vault and Database Firewall software (Oracle AVDF), and
about collection plug-ins.
• Overview of Oracle Audit Vault and Database Firewall
Learn about Oracle Audit Vault and Database Firewall components, and what
each component does.
• How Oracle Audit Vault Server and Agent Work
Audit Collection Plug-ins retrieve audit data in the form of audit trails, which are
sequences of audit records.
• Types of Audit Collection Plug-Ins
Learn what audit collection plug-ins are, which audit collection plug-ins you should
use for your audit trails, and what Java-based collection plug-ins you can use with
Oracle Database Vault.
• Oracle Audit Vault Events and Fields
Oracle Audit Vault monitors the stream of events that occur in target systems.
• The Collection Process
Learn how the Oracle Audit Vault collection process works.
• General Procedure for Writing Audit Collection Plug-ins
To ensure that you develop audit collection plug-ins correctly, follow this
procedure.
1-1
Chapter 1
How Oracle Audit Vault Server and Agent Work
Oracle Audit Vault and Database Firewall ships with several prepackaged collection
plug-ins, which are software programs that know how to access and interpret audit
data from target systems of various types. Collection plug-ins collect audit data from
an audit trail generated by a target system and store it in an Audit Vault Server
repository. Each collection plug-in is specific to a particular type of trail from a
particular type of target. These collection plug-ins collect data from databases such
as Oracle, SQL Server, Sybase ASE, and DB2.
See Also:
Oracle Audit Vault and Database Firewall Administrator's Guide
1-2
Chapter 1
Types of Audit Collection Plug-Ins
1-3
Chapter 1
Oracle Audit Vault Events and Fields
To describe the audit data being collected, you create an XML file, called a mapper
file, for the collection plug-in to use. Oracle Audit Vault Server uses this file to access
and interpret the audit records being collected. You do not need to write code for this
type of plug-in.
There is also a Java-based type of collection plug-in, which uses a Java API. You
can design your own Java-based collection plug-in, or you can use one that is
prepackaged with Oracle Audit Vault and Database Firewall.
1-4
Chapter 1
Oracle Audit Vault Events and Fields
1-5
Chapter 1
Oracle Audit Vault Events and Fields
See Also:
Core Fields for a complete list of core fields.
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
• Actions and Target Types
When you build collection plug-ins, you can use the target types and actions that
Oracle Audit Vault can detect.
1-6
Chapter 1
Oracle Audit Vault Events and Fields
1-7
Chapter 1
The Collection Process
• Map to the values if possible. For example, if TABLE exists in the list as a
TargetType, do not add an audit record with the TargetType of DATABASE TABLE.
Finally, if you think a field in the audit record of a target merits becoming a core field,
then Oracle recommends that you contact Oracle, so that this field can be reviewed
and added to the model appropriately.
Related Topics
• Actions and Target Types
When you build collection plug-ins, you can use the target types and actions that
Oracle Audit Vault can detect.
Flow of Development
1. You, the developer, create a collection plug-in and provide it to the user.
2. Your user deploys the plug-in into the Oracle Audit Vault Server. The act of
deploying a plug-in into the server creates a new version of the Oracle Audit Vault
Agent. This new agent contains collector code from the collection plug-in.
3. Your user then deploys the new Agent onto the host where it needs to run.
From then on, the user can start collecting audit trails supported by the collector
code.
4. Your User starts collecting audit trails supported by the collector code.
Flow of Collection
After the user starts collection, the flow of collection proceeds as shown in this
diagram.
1-8
Chapter 1
The Collection Process
Figure 1-1 Flow of Collection for Oracle Audit Vault Collection Agents
Agent
AV
Start Server
Collection
Agent Thread 1
Source · Agent Framework
· Collection Framework
2
Start
Management 5
Collector Collector Commands
Thread Thread
Audit
Trails Collection Collection
Framework ... Framework
3 Collector Collector
Collect
Trail
Flow of Collection
1. The Oracle Audit Vault Server commands the Agent Framework to create a thread
to collect a specific audit trail.
2. The new thread created by the agent collects a specific audit trail, and then turns
over control of the thread to the Collection Framework.
3. Within the thread, the Collection Framework connects to the Oracle Audit Vault
Server, and queries for configuration information for the audit trail being collected.
Additionally, it requests information for the last checkpoint set for that trail. The
checkpoint is stored in the Oracle Audit Vault Server in a checkpoint table.
4. With the information it now has, the Collection Framework refers to the plug-in
manifest file for the correct Java class to start within the correct collection plug-in.
It passes the configuration information to this class, and submits a request to
initialize itself.
5. After the the collector has initialized itself, the Collection Framework loops
repeatedly. Within each loop, the Collection Framework does the following:
• Asks the collector for any additional audit records in the audit trail.
1-9
Chapter 1
The Collection Process
The collector transforms (by mapping) any further audit records into the form
of audit records as specified in the mapper file, and hands them to the
Collection Framework through the Collection API.
• The Agent sends the checkpoint information and other metric data received
from the collection plug-in to the Audit Vault Server. The Audit Vault Server
stores this information in a checkpoint table.
6. If the Audit Vault Server sends commands to the Collection Framework, such as
a shutdown command, the Collection Framework passes them to the collector to
act on. If the Collection Framework receives a STOP command from the Oracle
Audit Vault Server, it notifies the collector to stop sending records. It then exits the
collection thread, and shuts itself down.
1-10
Chapter 1
The Collection Process
The collection plug-in must also acquire information about the character set of the
target records, the encoding used, and issues related to the time stamps. This is done
to make these things coordinate with Audit Vault Server requirements.
Related Topics
• Mapping
The mappings required from targets to Audit Vault Server depends on the fields in
the target records.
1.5.3.3 Mapping
The mappings required from targets to Audit Vault Server depends on the fields in the
target records.
These types of mapping are required for the Audit Vault Server:
• Event Mapping: Maps a target-specific event to an Audit Vault Event.
• Field Mapping: Maps the various field of the target records to Audit Vault Fields.
• Value Mapping: Maps various field values collected into a set of normalized values
for each field (for example, 0 and 1 may be mapped to FALSE and TRUE for a
specific field).
• Complex Mapping: Complex mappings are used when there are no simple
mappings from one target field to an Audit Vault Field, or one target audit event to
one Audit Vault Event.
Complex mappings can require additional data from the target, or require
additional programming code in the collection plug-in.
1-11
Chapter 1
General Procedure for Writing Audit Collection Plug-ins
records and then stopped, then the checkpoint occurs immediately after the last record
that it collected.
Resuming collection immediately after the checkpoint ensures that the collection plug-
in does not miss any records. To avoid collecting duplicate records during recovery, the
collection plug-in checks the Marker field of each record.
The collection plug-in should not collect and pass on to the agent any records that
occurred before the last checkpoint. However, the agent automatically filters out
records committed after the last checkpoint, and recollected when the collection plug-
in restarts. Collection plug-ins built using this SDK write the EventTimeUTC field into a
file with the extension .atc. A script can subsequently read this file, and delete audit
records as appropriate.
Related Topics
• Audit Collection Plug-ins
Learn about Audit Collection Plug-ins, and how to create them for Oracle Audit
Vault.
1-12
Chapter 1
General Procedure for Writing Audit Collection Plug-ins
Note:
Do not create version-dependent target types. Version-dependent target
types are different target types written to use for different versions of
the same software. If you create version-dependent target types, then
Oracle Audit Vault and Database Firewall is unable to collect from the
target after it is upgraded to a different version.
For example, suppose that you create the version-dependent target
types SQL Server 2000 and SQL Server 2005 and a collection plug-in
that collects the audit trail from a SQL Server 2000 target. If you upgrade
that target to SQL Server 2005, then Oracle Audit Vault agent cannot
collect its audit trail.
3. Understand the events that your target type writes and their fields.
Use appropriate existing events and fields when you write your plug-in (for
examples of existing events and fields. If the events or fields you need are not
available, you can use extension fields. Oracle, from time to time, evaluates the
set of fields that Audit Vault supports, and may add new fields if they apply to a
broad set of target types. If you believe your fields satisfy this criterion, please
contact Oracle Support.
4. Decide which type of collection plug-in to write.
5. Set up the development environment.
6. Learn more about the type of plug-in you are creating.
Refer to "Java-Based Audit Trail Collection Plug-ins" for information about Java-
based plug-ins
7. Determine the following for your collection plug-in:
• How to connect to the target.
• How to interrogate the target to learn what you must know.
• Which platforms your plug-in will support.
8. Decide whether your plug-in will support audit trail cleanup.
9. Set up the collection plug-in parameters.
For Java-based plug-ins, write the relevant code.
10. Create a plug-in manifest file to describe the collection plug-in.
13. If the plug-in works, then make it available to the Oracle Audit Vault administrator
to deploy in the development environment, using the command-line commands.
1-13
Chapter 1
General Procedure for Writing Audit Collection Plug-ins
See Also:
Related Topics
• Java-Based Audit Trail Collection Plug-ins
Oracle Audit Vault and Database Firewall provides a set of Java-based audit trial
collection plug-in, which enable you to create custom plug-ins.
1-14
2
Setting Up Your Development Environment
Learn about the process of setting up the Oracle Audit Vault Server development
environment.
• Before You Set Up the Development Environment
To develop Audit Collection Plug-ins, you must first set up the development
environment. This setup provides a consistent environment for developing and
testing the collection plug-ins.
• Setting Up the Development Environment
To set up your development environment, you must first download the Oracle
Audit Vault and Database Firewall SDK, and then set up the operating system
environment.
• Audit Collection Plug-in Directory Structure
Learn about the Oracle Audit Vault collection plug-in directory structure, the
development environment, and how to stage plug-in manifest.xml files.
Related Topics
• Determining Which Audit Collection Plug-in Type to Create
The audit collection plug-in that you use depends on the type of audit trail that you
are collecting for Oracle Audit Vault and Database Firewall.
See Also:
Oracle Audit Vault and Database Firewall Installation Guide for more
information on installation of Oracle Audit Vault and Database Firewall.
2-1
Chapter 2
Setting Up the Development Environment
Related Topics
• Audit Collection Plug-in Directory Structure
Learn about the Oracle Audit Vault collection plug-in directory structure, the
development environment, and how to stage plug-in manifest.xml files.
2-2
Chapter 2
Audit Collection Plug-in Directory Structure
STAGE_DIR_ROOT
plugin-manifest.xml
jars
mycoll.jar
myjdbc-lib.jar
config
mycoll.properties
bin
mycoll.exe
patches
p3653288_GENERIC.zip
2-3
Chapter 2
Audit Collection Plug-in Directory Structure
Because the agent is supported on multiple platforms, you should build the non-
Java binaries on all platforms that the agent supports. In addition, the collector
process locates and loads the appropriate binary based on the execution platform,
so use a similar naming convention.
• patches: Holds any OPatch patches for target-specified event attributes that the
collector needs to function. If your collector adds new event attributes that are
needed during run-time, then contact Oracle Support. Oracle Support will provide
you with a patch that adds these events into the Audit Vault Server repository. This
approval process is necessary to avoid collisions with other event attribute names
across multiple plug-ins. After you have obtained these patches, place them in
the patches directory. Then they will automatically be applied to the server during
collection plug-in deployment.
Related Topics
• Description of Plug-in Manifest File
The plugin-manifest.xml file is a core XML file that describes the collection
plug-in.
STAGE_DIR_ROOT
plugin-manifest.xml
templates
mycoll-template.xml
config
mycoll.properties
patches
p3653288_GENERIC.zip
Related Topics
• Description of Plug-in Manifest File
The plugin-manifest.xml file is a core XML file that describes the collection
plug-in.
2-4
Chapter 2
Audit Collection Plug-in Directory Structure
STAGE_DIR_ROOT
plugin-manifest.xml
jars
mycoll.jar
myjdbc-lib.jar
config
mycoll.properties
bin
mycoll.exe
patches
p3653288_GENERIC.zip
See Also:
2-5
3
Audit Collection Plug-ins
Learn about Audit Collection Plug-ins, and how to create them for Oracle Audit Vault.
• About Audit Collection Plug-ins
Find out about the different types of collection plug-ins: What they do, how they
collect audit trails, and where to find out more about them.
• About Mapper Files
Mapper files are XML files that mainly contain information about which target fields
you must collect from the audit trail, and how these target fields map to Oracle
Audit Vault Server fields.
• Database Table Collection Plug-ins
To use Oracle Audit Vault to collect audit data from the table type of trail, you can
use database table collection plug-ins
• XML File Collection Plug-ins
Learn how to use Oracle AVDF XML file collection plug-ins to collect audit data
from an XML file type of trail.
• JSON File Collection Plug-ins
Learn how to use Oracle AVDF JSON file collection plug-ins to collect audit data
from a JSON file type of trail.
• CSV File Collection Plug-ins
Learn how to use Oracle AVDF CSV file collection plug-ins to collect audit data
from a CSV file type of trail.
• JSON REST Collection Plug-ins
Learn how to use Oracle AVDF JSON collection plug-ins to collect audit data from
a JSON type of trail.
• Target Collection Attributes
Before you can use Oracle AVDF plug-ins to collect from the audit trail, you must
define collection attributes.
• Preprocessing Audit Data
Learn about the requirements to use Oracle AVDF collection plug-ins.
3-1
Chapter 3
About Mapper Files
This process does not require any coding. Audit Vault contains all the code necessary
to interpret Mapper files and use them to collect the audit data from the audit trail
appropriately.
Collection plug-ins support two types of audit trails:
• Database Table: database table collection plug-ins can collect audit data from an
audit table, using the information from the Mapper file.
• XML File: XML file collection plug-ins can collect audit data from XML audit files
present in a single directory, using the information from the Mapper file.
To use the collection plug-in for Database tables or XML file trails, you perform the
following steps:
1. Create an XML Mapper file for a target audit trail. This chapter discusses Mapper
files in general and focuses on their creation.
2. Create a plugin-manifest file for this target type.
3. Create the collection plug-in by packaging the mapper file and plugin-manifest file.
You can now deploy this collection plug-in at the Audit Vault Server and use it to collect
audit data after adding the target and any necessary collection attributes for this target.
See Also:
3-2
Chapter 3
Database Table Collection Plug-ins
• Event time timestamp format, where the audit trail type is XML file.
Package the mapper files as part of the collection plug-in. Place mapper files in the
templates folder during the plug-in packaging process.
Related Topics
• Database Table Collection Plug-ins
To use Oracle Audit Vault to collect audit data from the table type of trail, you can
use database table collection plug-ins
• XML File Collection Plug-ins
Learn how to use Oracle AVDF XML file collection plug-ins to collect audit data
from an XML file type of trail.
• Audit Collection Plug-In Directory Structure
Learn about the structure of a stage directory for a collection plug-in for Oracle
Audit Vault and Database Firewall.
3-3
Chapter 3
Database Table Collection Plug-ins
Data Requirements for Table Collection Plug-Ins to Oracle Audit Vault and
Database Firewall
• Audit data must be stored in a single database table.
• The target system has a user with privileges to read the audit data stored in this
table.
• The columns in the audit tables can be mapped to various Audit Vault core fields
and large fields.
Also single or multiple fields can be mapped to extension and marker fields. Fields
mapped to Audit Vault core fields, extension fields, and marker fields must be of
String data type or convertible to String. They cannot be of large data type, such
as a CLOB. Columns having CLOB data type should use large Audit Vault fields,
such as CommandText or CommandParam.
• The audit trail must contain fields which map to the CommandClass Audit Vault core
fields.
The value of the CommandClass core field must not be null. If it is null, then the
record is treated as an invalid record, so you must provide the proper mapping.
• The audit file must have a field that can be mapped to the UserName core field. If a
record has its UserName field as null, then the record is treated as invalid.
• The collection plug-in can collect the text of any command issued, as well as
any parameters passed to the command, in large fields. No other fields can be
mapped to large fields in Audit Vault and Database Firewall.
• The audit trail must contain a single column or group of columns that uniquely
identify each audit record.
• The audit trail must contain a field of type Timestamp that is monotonically
increasing, that is, the value of the field increases with every new audit record
inserted into the trail. This field must mapped to the EventTimeUTC core field in
the mapper file. If, for any audit record, this field value becomes null, the collector
treats this as an abnormal condition and shuts down.
Related Topics
• Schemas
Oracle AVDF uses these schemas for plug-in manifest files and collection plug-ins.
Target Field Data Type Audit Vault Server Field Map to Field
Type
USER_ID varchar UserName core field
3-4
Chapter 3
Database Table Collection Plug-ins
Table 3-1 (Cont.) AUD Audit Table Data Fields and Mappings
Target Field Data Type Audit Vault Server Field Map to Field
Type
OS_USER_ID varchar OSUserName core field
ACTION int CommandClass core field
STATUS int EventStatus core field
EVENT_TIME timestamp EventTimeUTC core field
OBJ_NAME varchar TargetObject core field
OBJ_CREATOR varchar TargetOwner core field
USER_HOST varchar ClientHostName core field
SQL_TEXT clob CommandText core field
SQL_BIND clob CommandParam core field
TERMINAL varchar TerminalName extension field
DB_ID varchar extension field extension field
INSTANCE varchar extension field extension field
PROCESS int extension field extension field
SESSION_ID int marker field marker field
ENTRY_ID int marker field marker field
Not all of the target fields map to core fields. The target fields that do not map to
core fields map to extension fields, or to designated marker fields, which test the
uniqueness of an audit record.
See Also:
3-5
Chapter 3
Database Table Collection Plug-ins
<AVTableCollectorTemplate securedTargetType="DBSOURCE"
minSecuredTargetVersion="10.2.0"
maxSecuredTargetVersion="11.0" version="1.0" >
<TableName>AUD</TableName>
You must provide the TableName of the audit table. This is a mandatory field.
The TableName field in this file must match the trail location in the Add Audit Trail
screen.
Note:
The collector checks if the trail location matches the TableName specified
in the mapper file and does not start if they do not match.
The collector chooses the appropriate mapper file in the
templates folder by validating the target collection attribute
av.collector.securedtargetversion version and if it is within the
range specified in the top level element minSecuredTargetVersion and
maxSecuredTargetVersion attributes.
For example, if the target collection attribute
av.collector.securedtargetversion = 11.1.0.0, then the collector
picks a mapper file that has a top level element in a range within the
specified version:
<AVTableCollectorTemplate securedTargetType="Oracle
Database" minSecuredTargetVersion="10.2.0"
maxSecuredTargetVersion="12.3" version="1.0">
This enables multiple versions of the same plug in (different mapper files
inside the templates folder) to address different target versions.
<ConnectionInfo>
3-6
Chapter 3
Database Table Collection Plug-ins
<DataSource>platform.jdbc.dbsource.DBSourceDataSource</
DataSource>
</ConnectionInfo>
You must provide the full name for the datasource class implementing
javax.sql.DataSource interface. This is a mandatory field.
• Field Mapping Information
<FieldMappingInfo>
<CoreFields>
CoreFields provides mapping from target fields to core fields of Audit Vault
Server. The data type of target fields specified must belong to either a SQL
string data type or a data type that can convert to a String.
The following elements contain core fields.
<Map>
<Name>EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
</Map>
3-7
Chapter 3
Database Table Collection Plug-ins
<Map>
<Name>USER_ID</Name>
<MapTo>UserName</MapTo>
</Map>
UserName represents the user who performs the action. If the mapping is not
provided, Audit Data Collection still starts successfully, but every audit record
will be treated as invalid.
<Map>
<Name>OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<Name>ACTION</Name>
<MapTo>CommandClass</MapTo>
</Map>
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
<ValueTransformation from="30" to="LOGON"/>
<ValueTransformation from="34" to="LOGOFF"/>
<ValueTransformation from="35" to="ACQUIRE"/>
</Transformation>
</Map>
3-8
Chapter 3
Database Table Collection Plug-ins
so. If this is not possible, then use a value that appropriately reflects the action
that generated the audit event.
<Map>
<Name> OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
</Map>
<Map>
<Name>TERMINAL</Name>
<MapTo>TerminalName</MapTo>
</Map>
<Map>
<Name>USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>STATUS</Name>
<MapTo>EventStatus</MapTo>
<Transformation>
<ValueTransformation from="0" to="FAILURE"/>
<ValueTransformation from="1" to="SUCCESS"/>
<ValueTransformation from="2" to="UNKNOWN"/>
</Transformation>
</Map>
</CoreFields>
<LargeFields>
<Map>
<Name>SQL_TEXT</Name>
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>COMMAND_PARAMETER</Name>
<MapTo>CommandParam</MapTo>
3-9
Chapter 3
Database Table Collection Plug-ins
</Map>
</LargeFields>
LargeFields are target fields mapped to large fields in the Audit Vault Server,
such as CommandText or CommandParam. The specified target fields must be of
SQL data type CLOB or String, or be convertible to String.
– Extension Field
<ExtensionField>
<Name>DB_ID</Name>
<Name>INSTANCE</Name>
<Name>PROCESS</Name>
</ExtensionField>
<ExtensionField>
<ComplexName>
<Name>column_name</Name>
<RegExp>exp</RegExp>
</ComplexName>
</ExtensionField>
<MarkerField>
<Name>SESSION_ID</Name>
<Name>ENTRY_ID</Name>
</MarkerField>
The MarkerField contains a list of target field names that uniquely identify
each audit record. The target fields specified must be of SQL data type String
or convertible to String. MarkerField is mandatory.
– End Tags
3-10
Chapter 3
XML File Collection Plug-ins
The field tags must be properly closed in order for the file to be valid. The
following are examples of field end tags:
</FieldMappingInfo>
</AVTableCollectorTemplate>
See Also:
• Core Fields
• Actions and Target Types
• Large Fields
• Extension Field
• Marker Field
3-11
Chapter 3
XML File Collection Plug-ins
XML File Audit Record File Requirements for Oracle Audit Vault and Database
Firewall
• The audit trail must be stored in one or more XML files in a single directory path.
• The user must have read permission on the directory containing the XML audit
files.
• XML files in this directory must be valid, well-formed XML documents, within the
constraints of the XML 1.0 specification.
• The file and record start elements must be as specified in the mapper file.
• All the audit record elements should be at the same level in Audit XML files.
• All the audit record elements in Audit XML files must be the same.
• Under every audit record element, all the field elements must be at the same level
and one level below the audit record start element.
• The XML audit file must have an element value that can be mapped to the
CommandClass core field. If a record has its CommandClass field as null, then the
record is treated as invalid.
• The XML audit file must have an element value that can be mapped to the
UserName core field. If a record has its UserName field as null, then the record
is treated as invalid.
• In the XML file, each audit record must have a timestamp as one of its element
values.
The value of the timestamp element must be monotonically increasing, that is, the
value of the field increases with every new audit record inserted into the trail. The
timestamp value should be strictly Not Null. Timestamp format must be according
to SimpleDateFormat Java class.
This field must mapped to the EventTimeUTC core field in the mapper file. If
mapping for event time is not specified in the mapper file, then the collection
plug-in shuts down. If the field value for the event time in audit records is found
null, then the collection plug-in takes the time of the record last sent from the same
XML audit file.
• The audit trail must contain a single element value or group of element values in
the audit record that uniquely identify each audit record in XML Audit files.
• Common information shared by all audit records in XML file should be present in
the beginning of the XML file, under the file start element, at the same level as the
audit record elements.
• If an audit data target produces audit files with multiple XML formats, then the user
must provide a separate mapper file for each audit file format having a different
start element.
3-12
Chapter 3
XML File Collection Plug-ins
• XML files in this directory should be of the same locale and encoding as the agent,
as described in the examples below:
– Valid: The user has an agent in a Chinese locale (env). XML files are also
generated in a Chinese locale with same encoding (for example, ZHS16GBK).
This setup is valid.
– Invalid: The user has an agent in a German locale (env). XML files are
generated/moved from some other computer, which are Chinese encoded.
The collectors fail to start because of an encoding mismatch, as well as a
locale mismatch, in this case. This setup is invalid.
Table 3-2 Audit Data Fields in XML Audit Records and Mappings
3-13
Chapter 3
XML File Collection Plug-ins
Standards for Collection Plug-in Mappings in Mapper Files for Oracle Audit Vault
and Database Firewall
• Top-Level Element
<AVXMLCollectorTemplate securedTargetType="XMLSOURCE"
maxSecuredTargetVersion="11.0" version="1.0">
The AVXMLCollectorTemplate is the top level element and has these mandatory
attributes: securedTargetType, maxSecuredTargetVersion, and version. The
minSecuredTargetVersion attribute is optional.
3-14
Chapter 3
XML File Collection Plug-ins
<HeaderInfo>
<StartTag>Audit</StartTag>
</HeaderInfo>
<RecordInfo>
<StartTag>AuditRecord</StartTag>
</RecordInfo>
RecordInfo provides the starting element of audit records in XML audit files.
RecordInfo is mandatory.
StartTag is the starting element of each audit record in XML audit files.
• Field Mapping Information
<FieldMappingInfo>
– Core Fields
<CoreFields>
3-15
Chapter 3
XML File Collection Plug-ins
CoreFields provides mapping from target fields to core fields of Audit Vault
Server. Target fields specified in core field mappings must be of SQL data
type, either a string or a data type that can convert to string.
The following elements contain core fields.
<Map>
<Name>EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd HH:mm:ss.SSS</TimestampPattern>
</Map>
<Map>
<Name>USER_ID</Name>
<MapTo>UserName</MapTo>
</Map>
UserName represents the user who performed the action. If the mapping is not
provided, Audit Data Collection still starts successfully, but every audit record
is treated as invalid.
<Map>
<Name>OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<Name>ACTION</Name>
<MapTo>CommandClass</MapTo>
</Map>
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
3-16
Chapter 3
XML File Collection Plug-ins
<Map>
<Name>OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
</Map>
<Map>
<Name>USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>TERMINAL</Name>
<MapTo>TerminalName</MapTo>
</Map>
<Map>
<Name>OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>STATUS</Name>
<MapTo>EventStatus</MapTo>
<Transformation>
<ValueTransformation from="0" to="FAILURE"/>
<ValueTransformation from="1" to="SUCCESS"/>
<ValueTransformation from="2" to="UNKNOWN"/>
</Transformation>
</Map>
</CoreFields>
<LargeFields>
<Map>
<Name>SQL_TEXT</Name>
3-17
Chapter 3
XML File Collection Plug-ins
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>COMMAND_PARAMETER</Name>
<MapTo>CommandParam</MapTo>
</Map>
</LargeFields>
LargeFields are target fields mapped to large fields in the Audit Vault Server.
The specified target fields must be of SQL data type CLOB or String, or be
convertible to String.
– Extension Fields
<ExtensionField>
<Name>DB_ID</Name>
<Name>INSTANCE</Name>
<Name>PROCESS</Name>
</ExtensionField>
<MarkerField>
<Name>SESSION_ID</Name>
<Name>ENTRY_ID</Name>
</MarkerField>
MarkerField contains a list of target fields that uniquely identify each audit
record. The target fields specified must be of SQL data type CLOB or String, or
be convertible to String. MarkerField is mandatory.
See Also:
3-18
Chapter 3
XML File Collection Plug-ins
<XslTransformation>
<XslFile>test_template.xsl</XslFile>
3-19
Chapter 3
XML File Collection Plug-ins
<SourceFileStartTag>AUDIT</SourceFileStartTag>
</XslTransformation>
2. Provide the XSL file and place it in the templates folder of the plugin directory.
3. You can also make calls to Java functions from within the XSL file. To do this,
place the jar file created in the jars folder of the plugin directory.
Related Topics
• Creating the XML File Audit Collection Mapper File
To create an XML file collection plug-in mapper file, you must describe the
collection plug-in mappings in this mapper file in accordance with Oracle Audit
Vault and Database Firewall standards.
• Sample Non-Standard XML Audit Data Record
See how to transform an XML data record to the proper XML format required for
an XML file collection plug-in.
• Creating an XSL File for Transformation
To create an XSL transformation file that defines transformation rules you must
create a version that can transform the source audit records that your system
creates, and place it in the templates folder of the plugin.
</AUDIT>
3-20
Chapter 3
XML File Collection Plug-ins
The Audit.xml transformed audit record file does not appear in your folder. It is just an
example showing the result of transforming the Audit.xml file into the required XML
format, using the XSL transformation file in the test_template.xsl example.
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output indent="yes" />
<xsl:template match="/">
<ROOT_DEST>
<xsl:for-each select="AUDIT/AUDIT_RECORD">
<Record_Dest>
<USER><xsl:value-of select="@USER"/></USER>
<PRIV_USER><xsl:value-of select="@PRIV_USER"/></
PRIV_USER>
<OS_LOGIN><xsl:value-of select="@OS_LOGIN"/></OS_LOGIN>
<PROXY_USER><xsl:value-of select="@PROXY_USER"/></
PROXY_USER>
<HOST><xsl:value-of select="@HOST"/></HOST>
<IP><xsl:value-of select="@IP"/></IP>
<DB><xsl:value-of select="@DB"/></DB>
<SQLTEXT><xsl:value-of select="@SQLTEXT"/></SQLTEXT>
<CONNECTION_ID><xsl:value-of select=
"@CONNECTION_ID"/></CONNECTION_ID>
<STATUS><xsl:value-of select="@STATUS"/></STATUS>
<TIMESTAMP><xsl:value-of select="@TIMESTAMP"/></
TIMESTAMP>
<NAME><xsl:value-of select="@NAME"/></NAME>
<SERVER_ID><xsl:value-of select="@SERVER_ID"/></
SERVER_ID>
<VERSION><xsl:value-of select="@VERSION" /></VERSION>
<STARTUP_OPTIONS><xsl:value-of select="@STARTUP_OPTIONS"/> </
STARTUP_OPTIONS>
<OS_VERSION><xsl:value-of select="@OS_VERSION"/></
OS_VERSION>
<MYSQL_VERSION><xsl:value-of select="@MYSQL_VERSION"/>
</MYSQL_VERSION>
</Record_Dest>
</xsl:for-each>
</ROOT_DEST>
</xsl:template>
</xsl:stylesheet>
3-21
Chapter 3
XML File Collection Plug-ins
<ROOT_DEST>
<Record_Dest>
<USER></USER>
<PRIV_USER></PRIV_USER>
<OS_LOGIN></OS_LOGIN>
<PROXY_USER></PROXY_USER>
<HOST></HOST>
<IP></IP>
<DB></DB>
<SQLTEXT></SQLTEXT>
<CONNECTION_ID></CONNECTION_ID>
<STATUS></STATUS>
<TIMESTAMP>2013-06-07T08:27:53</TIMESTAMP>
<NAME>Audit</NAME>
<SERVER_ID>0</SERVER_ID>
<VERSION>1</VERSION>
<STARTUP_OPTIONS>C:/Program Files/MySQL/MySQL Server 5.6/
bin\mysqld
--defaults-file=C:\ProgramData\MySQL\MySQL Server
5.6\my.ini</STARTUP_OPTIONS>
<OS_VERSION>x86_64-Win64</OS_VERSION>
<MYSQL_VERSION>5.6.11-enterprise-commercial-advanced</
MYSQL_VERSION>
</Record_Dest>
<Record_Dest>
<USER>root</USER>
<PRIV_USER>root</PRIV_USER>
<OS_LOGIN></OS_LOGIN>
<PROXY_USER></PROXY_USER>
<HOST>localhost</HOST>
<IP>127.0.0.1</IP>
<DB></DB>
<SQLTEXT></SQLTEXT>
<CONNECTION_ID>1</CONNECTION_ID>
<STATUS>0</STATUS>
<TIMESTAMP>2013-06-07T08:30:46</TIMESTAMP>
<NAME>Connect</NAME>
<SERVER_ID></SERVER_ID>
<VERSION></VERSION>
<STARTUP_OPTIONS></STARTUP_OPTIONS>
<OS_VERSION></OS_VERSION>
<MYSQL_VERSION></MYSQL_VERSION>
</Record_Dest>
<Record_Dest>
<USER></USER>
<PRIV_USER></PRIV_USER>
<OS_LOGIN></OS_LOGIN>
<PROXY_USER></PROXY_USER>
<HOST></HOST>
<IP></IP>
<DB></DB>
<SQLTEXT>CREATE USER 'admin'@'localhost' IDENTIFIED BY
'welcome_1'</SQLTEXT>
3-22
Chapter 3
JSON File Collection Plug-ins
<CONNECTION_ID>1</CONNECTION_ID>
<STATUS>0</STATUS>
<TIMESTAMP>2013-06-07T08:31:21</TIMESTAMP>
<NAME>Query</NAME>
<SERVER_ID></SERVER_ID>
<VERSION></VERSION>
<STARTUP_OPTIONS></STARTUP_OPTIONS>
<OS_VERSION></OS_VERSION>
<MYSQL_VERSION></MYSQL_VERSION>
</Record_Dest>
</ROOT_DEST>
JSON File Audit Record File Requirements for Oracle Audit Vault and Database
Firewall
• The audit trail must be stored in one or more JSON files in a single directory path.
• The user must have read permission on the directory containing the JSON audit
files.
• JSON files in this directory must be valid, well-formed JSON documents, within the
constraints of the JSON specification.
3-23
Chapter 3
JSON File Collection Plug-ins
• The file and record start elements must be as specified in the mapper file.
• The JSON audit file must have a field whose JSONPath can be mapped to the
CommandClass core field. If a record has its CommandClass field as null, then the
record is treated as invalid.
• In the JSON file, each audit record must have a timestamp as one of its element
values.
The value of the timestamp element must be monotonically increasing, that is, the
value of the field increases with every new audit record inserted into the trail. The
timestamp value should be strictly Not Null. Timestamp format must be according
to SimpleDateFormat Java class.
This field must mapped to the EventTimeUTC core field in the mapper file. If
mapping for event time is not specified in the mapper file, then the collection
plug-in shuts down. If the field value for the event time in audit records is found
null, then the collection plug-in takes the time of the record last sent from the same
JSON audit file.
• The audit trail must contain a single element value or group of element values in
the audit record that uniquely identify each audit record in JSON Audit files.
• If an audit data target produces audit files with multiple JSON formats, then the
user must provide a separate mapper file for each audit file format having a
different start element.
• JSON files in this directory should be of the same locale and encoding as the
agent, as described in the examples below:
– Valid: The user has an agent in a Chinese locale (env). JSON files are also
generated in a Chinese locale with same encoding (for example, ZHS16GBK).
This setup is valid.
– Invalid: The user has an agent in a German locale (env). JSON files are
generated/moved from some other computer, which are Chinese encoded.
The collectors fail to start because of an encoding mismatch, as well as a
locale mismatch, in this case. This setup is invalid.
Table 3-3 Audit Data Fields in JSON Audit Records and Mappings
3-24
Chapter 3
JSON File Collection Plug-ins
Table 3-3 (Cont.) Audit Data Fields in JSON Audit Records and Mappings
{
"ITEMS":[
{
"SESSION_ID":123,
"AUDIT_TYPE":1,
"USER_ID":"scott",
"OS_USER_ID":"usr1",
"ACTION":"select",
"STATUS":0,
"EVENT_TIME":"2020-11-28 12:23:59.166",
"OBJ_NAME":"emp",
"OBJ_CREATOR":"scott",
"TERMINAL":"t1",
"DB_ID":136,
"ENTRY_ID":1
},
{
"SESSION_ID":123,
"AUDIT_TYPE":1,
"USER_ID":"scott",
"OS_USER_ID":"usr1",
"ACTION":"delete",
"STATUS":0,
"EVENT_TIME":"2020-11-28 12:24:22.177",
"OBJ_NAME":"emp",
"OBJ_CREATOR":"scott",
3-25
Chapter 3
JSON File Collection Plug-ins
"TERMINAL":"t1",
"DB_ID":136,
"ENTRY_ID":2
}
]
}
Standards for Collection Plug-in Mappings in Mapper Files for Oracle Audit Vault
and Database Firewall
• Top-Level Element
<AVJSONCollectorTemplate securedTargetType="JSONSOURCE"
maxSecuredTargetVersion="11.0"
version="1.0">
The AVJSONCollectorTemplate is the top level element and has these mandatory
attributes: securedTargetType, maxSecuredTargetVersion, and version. The
minSecuredTargetVersion attribute is optional.
The accepted format for the minSecuredTargetVersion,
maxSecuredTargetVersion, and version attributes uses numbers, separated by
dots, such as 12.2,10.3.2, 11.2.3.0.
• Header Information
<HeaderInfo>
<StartTag>ITEMS</StartTag>
</HeaderInfo>
<RecordInfo>
<StartTag>SESSION_ID</StartTag>
</RecordInfo>
RecordInfo provides the starting element of audit records in JSON audit files.
RecordInfo is mandatory.
3-26
Chapter 3
JSON File Collection Plug-ins
StartTag is the starting element of each audit record in JSON audit files. If the
JSON file has one fully formed JSON record per line, then the HeaderInfo and
RecordInfo also have the same start tag, which is the first element of the JSON
record.
• Field Mapping Information
<FieldMappingInfo>
– Core Fields
<CoreFields>
CoreFields provides mapping from target fields to core fields of Audit Vault
Server. Target fields specified in core field mappings must be of SQL data
type, either a string or a data type that can convert to string.
The following elements contain core fields.
<Map>
<Name>$.EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd HH:mm:ss.SSS</TimestampPattern>
</Map>
3-27
Chapter 3
JSON File Collection Plug-ins
<Map>
<Name>$.USER_ID</Name>
<MapTo>UserName</MapTo>
</Map>
UserName represents the user who performed the action. If the mapping is not
provided, Audit Data Collection still starts successfully, but every audit record
is treated as invalid.
<Map>
<Name>$.OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<Name>$.ACTION</Name>
<MapTo>CommandClass</MapTo>
</Map>
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
<ValueTransformation from="30" to="LOGON"/>
<ValueTransformation from="34" to="LOGOFF"/>
<ValueTransformation from="35" to="ACQUIRE"/>
</Transformation>
<Map>
<Name>$.OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
</Map>
3-28
Chapter 3
JSON File Collection Plug-ins
<Map>
<Name>$.USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>$.TERMINAL</Name>
<MapTo>TerminalName</MapTo>
</Map>
<Map>
<Name>$.OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>$.STATUS</Name>
<MapTo>EventStatus</MapTo>
<Transformation>
<ValueTransformation from="0" to="FAILURE"/>
<ValueTransformation from="1" to="SUCCESS"/>
<ValueTransformation from="2" to="UNKNOWN"/>
</Transformation>
</Map>
</CoreFields>
<LargeFields>
<Map>
<Name>$.SQL_TEXT</Name>
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>$.COMMAND_PARAMETER</Name>
<MapTo>CommandParam</MapTo>
</Map>
</LargeFields>
LargeFields are target fields mapped to large fields in the Audit Vault Server.
The specified target fields must be of SQL data type CLOB or String, or be
convertible to String.
– Extension Fields
<ExtensionField>
<Name>$.DB_ID</Name>
<Name>$.INSTANCE</Name>
<Name>$.PROCESS</Name>
3-29
Chapter 3
CSV File Collection Plug-ins
</ExtensionField>
<MarkerField>
<Name>$.SESSION_ID</Name>
<Name>$.ENTRY_ID</Name>
</MarkerField>
MarkerField contains a list of target fields that uniquely identify each audit
record. The target fields specified must be of SQL data type CLOB or String, or
be convertible to String. MarkerField is mandatory.
See Also:
3-30
Chapter 3
CSV File Collection Plug-ins
CSV File Audit Record File Requirements for Oracle Audit Vault and Database
Firewall
• The audit trail must be stored in one or more CSV files in a single directory path.
• The user must have read permission on the directory containing the CSV audit
files.
• CSV files in this directory must be valid, well formed CSV documents, with COMMA
as the field delimiter.
• If a record has its CommandClass field as null, then the record is treated as invalid.
• In the CSV file, each audit record must have a timestamp as one of its element
values.
The value of the timestamp element must be monotonically increasing, that is, the
value of the field increases with every new audit record inserted into the trail. The
timestamp value should be strictly Not Null. Timestamp format must be according
to SimpleDateFormat Java class.
This field must mapped to the EventTimeUTC core field in the mapper file. If
mapping for event time is not specified in the mapper file, then the collection
plug-in shuts down.
• CSV files in this directory should be of the same locale and encoding as the agent,
as described in the examples below:
– Valid: The user has an agent in a Chinese locale (env). CSV files are also
generated in a Chinese locale with same encoding (for example, ZHS16GBK).
This setup is valid.
– Invalid: The user has an agent in a German locale (env). CSV files are
generated/moved from some other computer, which are Chinese encoded.
The collectors fail to start because of an encoding mismatch, as well as a
locale mismatch, in this case. This setup is invalid.
3-31
Chapter 3
CSV File Collection Plug-ins
Table 3-4 Audit Data Fields in CSV Audit Records and Mappings
5678,createUser,2020-10-01T16:11:23.661+0530,127.0.0.1,1234,admin,user1,
0,0,not applicable,1234,"insert into foo.bar","foobar",111
5679,dropUser,2020-10-02T16:11:23.661+0530,127.0.0.1,1234,admin,user2,0,
0,not applicable,1234,"delete from foo.bar","foobar",222
5680,createCollection,2020-10-03T16:11:23.661+0530,127.0.0.1,1234,admin,
collection1,100,18,authentication failed,1234,"insert into
foo.bar","foobar",333
5681,dropCollection,2020-10-04T16:11:23.661+0530,127.0.0.1,1234,admin,co
llection2,200,13,not authorized to perform operation,1234,"delete from
foo.bar","foobar",444
3-32
Chapter 3
CSV File Collection Plug-ins
Standards for Collection Plug-in Mappings in Mapper Files for Oracle Audit Vault
and Database Firewall
• Top-Level Element
<AVCSVCollectorTemplate securedTargetType="CSVSOURCE"
maxSecuredTargetVersion="11.0"
version="1.0">
The AVCSVCollectorTemplate is the top level element and has these mandatory
attributes: securedTargetType, maxSecuredTargetVersion, and version. The
minSecuredTargetVersion attribute is optional.
The accepted format for the minSecuredTargetVersion,
maxSecuredTargetVersion, and version attributes uses numbers, separated by
dots, such as 12.2,10.3.2, 11.2.3.0.
• Header Information
<HeaderInfo>
<StartTag>CSV</StartTag>
</HeaderInfo>
<RecordInfo>
<StartTag>CSV</StartTag>
</RecordInfo>
<FieldMappingInfo>
3-33
Chapter 3
CSV File Collection Plug-ins
Field mappings include <Map> elements, which contain <Name> elements that hold
target field names, and <MapTo> elements that hold Audit Value field names that
targets are mapped to.
In CSV Plugin Mapper file, the Name element must contain the index of the field in
the CSV file. In our sample, below are the index corresponding to each field:
There should be no many-to-one mappings from target fields to Audit Vault Server
fields. For example, the following is invalid:
– Core Fields
<CoreFields>
CoreFields provides mapping from target fields to core fields of Audit Vault
Server. Target fields specified in core field mappings must either be a string or
a data type that can be converted to string.
The following elements contain core fields.
<Map>
<Name>2</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</
3-34
Chapter 3
CSV File Collection Plug-ins
TimestampPattern>
</Map>
<Map>
<Name>5</Name>
<MapTo>UserName</MapTo>
</Map>
UserName represents the user who performed the action. If the mapping is not
provided, Audit Data Collection still starts successfully, but every audit record
is treated as invalid.
<Map>
<Name>1</Name>
<MapTo>CommandClass</MapTo>
</Map>
<Transformation>
<ValueTransformation from="createUser"
to="CREATE" />
<ValueTransformation from="createCollection"
to="CREATE" />
<ValueTransformation from="authenticate"
to="AUTHENTICATE" />
<ValueTransformation from="dropCollection"
to="DROP" />
<ValueTransformation from="dropUser" to="DROP" />
</Transformation>
3-35
Chapter 3
CSV File Collection Plug-ins
<Map>
<Name>1</Name>
<MapTo>TargetObject</MapTo>
<Transformation>
<FieldTransformation from="createUser" to="6" />
<FieldTransformation from="createCollection"
to="6" />
<FieldTransformation from="authenticate" to="6" />
<FieldTransformation from="dropCollection"
to="6" />
<FieldTransformation from="dropUser" to="6" />
</Transformation>
</Map>
<Map>
<Name>1</Name>
<MapTo>TargetType</MapTo>
<Transformation>
<ValueTransformation from="createUser"
to="USER" />
<ValueTransformation from="createCollection"
to="COLLECTION" />
<ValueTransformation from="authenticate"
to="USER" />
<ValueTransformation from="dropCollection"
to="COLLECTION" />
<ValueTransformation from="dropUser" to="USER" />
</Transformation>
</Map>
<Map>
<Name>3</Name>
<MapTo>ClientIP</MapTo>
</Map>
<Map>
<Name>7</Name>
<MapTo>EventStatus</MapTo>
<!-- Specifying value transformation for Status
source field value.
Mandatory: EventStatus value transformation.
There are three possible values for EventStatus:
SUCCESS, FAILURE, UNKNOWN -->
<Transformation>
<ValueTransformation from="0" to="FAILURE" />
<ValueTransformation from="100" to="SUCCESS" />
<ValueTransformation from="200" to="UNKNOWN" />
3-36
Chapter 3
CSV File Collection Plug-ins
</Transformation>
</Map>
<LargeFields>
<Map>
<Name>11</Name>
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>12</Name>
<MapTo>CommandParam</MapTo>
</Map>
</LargeFields>
LargeFields are target fields mapped to large fields in the Audit Vault Server.
The specified target fields must be of type String or convertible to String.
– Extension Fields
<ExtensionField>
<ComplexName>
<Name>10</Name>
<DisplayName>sessionid</DisplayName>
</ComplexName>
<ComplexName>
<Name>13</Name>
<DisplayName>entryid</DisplayName>
</ComplexName>
</ExtensionField>
<MarkerField>
<Name>10</Name>
<Name>13</Name>
</MarkerField>
MarkerField contains a list of target fields that uniquely identify each audit
record.
3-37
Chapter 3
JSON REST Collection Plug-ins
See Also:
JSON Audit Record File Requirements for Oracle Audit Vault and Database
Firewall
• The audit trail must be stored in one or more JSON files in a single directory path.
3-38
Chapter 3
JSON REST Collection Plug-ins
• The user must have read permission on the directory containing the JSON audit
files.
• JSON files in this directory must be valid, well-formed JSON documents, within the
constraints of the JSON specification.
• The file and record start elements must be as specified in the mapper file.
• The JSON audit file must have a field whose JSONPath can be mapped to the
CommandClass core field. If a record has its CommandClass field as null, then the
record is treated as invalid.
• In the JSON file, each audit record must have a timestamp as one of its element
values.
The value of the timestamp element must be monotonically increasing, that is, the
value of the field increases with every new audit record inserted into the trail. The
timestamp value should be strictly Not Null. Timestamp format must be according
to SimpleDateFormat Java class.
This field must mapped to the EventTimeUTC core field in the mapper file. If
mapping for event time is not specified in the mapper file, then the collection
plug-in shuts down. If the field value for the event time in audit records is found
null, then the collection plug-in takes the time of the record last sent from the same
JSON audit file.
• The audit trail must contain a single element value or group of element values in
the audit record that uniquely identify each audit record in JSON audit files.
• If an audit data target produces audit files with multiple JSON formats, then the
user must provide a separate mapper file for each audit file format having a
different start element.
• JSON files in this directory should be of the same locale and encoding as the
agent, as described in the examples below:
– Valid: The user has an agent in a Chinese locale (env). JSON REST files
are also generated in a Chinese locale with same encoding (for example,
ZHS16GBK). This setup is valid.
– Invalid: The user has an agent in a German locale (env). JSON REST files
are generated/moved from some other computer, which are Chinese encoded.
The collectors fail to start because of an encoding mismatch, as well as a
locale mismatch, in this case. This setup is invalid.
3-39
Chapter 3
JSON REST Collection Plug-ins
Table 3-5 Audit Data Fields in JSON Audit Records and Mappings
{
"ITEMS":[
{
"SESSION_ID":123,
"AUDIT_TYPE":1,
"USER_ID":"scott",
"OS_USER_ID":"usr1",
"ACTION":"select",
"STATUS":0,
"EVENT_TIME":"2020-11-28 12:23:59.166",
"OBJ_NAME":"emp",
"OBJ_CREATOR":"scott",
"TERMINAL":"t1",
"DB_ID":136,
"ENTRY_ID":1
},
{
"SESSION_ID":123,
"AUDIT_TYPE":1,
"USER_ID":"scott",
"OS_USER_ID":"usr1",
"ACTION":"delete",
"STATUS":0,
3-40
Chapter 3
JSON REST Collection Plug-ins
"EVENT_TIME":"2020-11-28 12:24:22.177",
"OBJ_NAME":"emp",
"OBJ_CREATOR":"scott",
"TERMINAL":"t1",
"DB_ID":136,
"ENTRY_ID":2
}
]
}
Standards for Collection Plug-in Mappings in Mapper Files for Oracle Audit Vault
and Database Firewall
• Top-Level Element
<AVJSONCollectorTemplate securedTargetType="JSONSOURCE"
maxSecuredTargetVersion="11.0"
version="1.0">
The AVJSONCollectorTemplate is the top level element and has these mandatory
attributes: securedTargetType, maxSecuredTargetVersion, and version. The
minSecuredTargetVersion attribute is optional.
The accepted format for the minSecuredTargetVersion,
maxSecuredTargetVersion, and version attributes uses numbers, separated by
dots, such as 12.2,10.3.2, 11.2.3.0.
• Header Information
<HeaderInfo>
<StartTag>ITEMS</StartTag>
</HeaderInfo>
<RecordInfo>
<StartTag>SESSION_ID</StartTag>
</RecordInfo>
3-41
Chapter 3
JSON REST Collection Plug-ins
RecordInfo provides the starting element of audit records in JSON audit files.
RecordInfo is mandatory.
StartTag is the starting element of each audit record in JSON audit files. If the
JSON file has one fully formed JSON record per line, then the HeaderInfo and
RecordInfo also have the same start tag, which is the first element of the JSON
record.
• Service Details
<ServiceDetails>
Example code:
<!-- Query format for providing the start time and end time query
parameters -->
<QueryFormat>{startTime}/{endTime}</QueryFormat>
<!-- Timestamp format for start time and end time -->
<TimeFormat>yyyy-MM-dd hh:mm:ss.SSS</TimeFormat>
<NextLink>
<!-- Next link start tag -->
<NextLinkStartTag>next</NextLinkStartTag>
<!-- Next link pattern -->
<NextLinkPattern>$.next.$ref</NextLinkPattern>
</NextLink>
<!-- Authentication mechanism for REST Service -->
<RESTAuthentication>
<!-- Username and password based Basic Authentication -->
<BasicAuth/>
</RESTAuthentication>
</ServiceDetails>
Here is the explanation of the fields. All the fields are mandatory.
Service Details provides information about REST service corresponding to the
audit trail.
Query Format describes the format of the REST query for providing the start time
and end time query parameters.
Time Format describes timestamp format for start time and end time.
Next Link Start Tag provides the next link start tag of the REST URL.
Next Link Pattern provides JSON path expression of the next link of the REST
URL.
REST Authentication describes the authentication mechanism used to connect to
the target.
BasicAuth indicates the authentication mechanism is Basic Authentication.
• Field Mapping Information
<FieldMappingInfo>
3-42
Chapter 3
JSON REST Collection Plug-ins
– Core Fields
<CoreFields>
CoreFields provides mapping from target fields to core fields of Audit Vault
Server. Target fields specified in core field mappings must be of SQL data
type, either a string or a data type that can convert to string.
The following elements contain core fields.
<Map>
<Name>$.EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd HH:mm:ss.SSS</TimestampPattern>
</Map>
<Map>
<Name>$.USER_ID</Name>
<MapTo>UserName</MapTo>
3-43
Chapter 3
JSON REST Collection Plug-ins
</Map>
UserName represents the user who performed the action. If the mapping is not
provided, Audit Data Collection still starts successfully, but every audit record
is treated as invalid.
<Map>
<Name>$.OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<Name>$.ACTION</Name>
<MapTo>CommandClass</MapTo>
</Map>
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
<ValueTransformation from="30" to="LOGON"/>
<ValueTransformation from="34" to="LOGOFF"/>
<ValueTransformation from="35" to="ACQUIRE"/>
</Transformation>
<Map>
<Name>$.OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
</Map>
<Map>
<Name>$.USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>$.TERMINAL</Name>
<MapTo>TerminalName</MapTo>
3-44
Chapter 3
JSON REST Collection Plug-ins
</Map>
<Map>
<Name>$.OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>$.STATUS</Name>
<MapTo>EventStatus</MapTo>
<Transformation>
<ValueTransformation from="0" to="FAILURE"/>
<ValueTransformation from="1" to="SUCCESS"/>
<ValueTransformation from="2" to="UNKNOWN"/>
</Transformation>
</Map>
</CoreFields>
<LargeFields>
<Map>
<Name>$.SQL_TEXT</Name>
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>$.COMMAND_PARAMETER</Name>
<MapTo>CommandParam</MapTo>
</Map>
</LargeFields>
LargeFields are target fields mapped to large fields in the Audit Vault Server.
The specified target fields must be of SQL data type CLOB or String, or be
convertible to String.
– Extension Fields
<ExtensionField>
<Name>$.DB_ID</Name>
<Name>$.INSTANCE</Name>
<Name>$.PROCESS</Name>
</ExtensionField>
3-45
Chapter 3
Target Collection Attributes
– Marker Fields
<MarkerField>
<Name>$.SESSION_ID</Name>
<Name>$.ENTRY_ID</Name>
</MarkerField>
MarkerField contains a list of target fields that uniquely identify each audit
record. The target fields specified must be of SQL data type CLOB or String, or
be convertible to String. MarkerField is mandatory.
See Also:
3-46
Chapter 3
Preprocessing Audit Data
Vault Server by adjusting the time zones. This attribute is not needed for an XML
file collection plug-in if the event time itself contains the time zone information. An
example of this setting is as follows:
av.collector.TimeZoneOffset = +5:30
• av.collector.enableArchivedTime (Optional): This attribute is applicable only
for Oracle table trail. It is set to true by default. When enableArchivedTime is set
to true and if INIT_CLEANUP procedure is called for the trail, then the last archived
timestamp in dbms_audit_mgmt package is updated to the current checkpoint time
based on the ATC interval time. When set to false, the last archived timestamp for
the trail is not updated in the target database. In that case, the user must ensure
that the audit records with timestamps less than the checkpoint time should not be
purged from the audit table. The user can view the Audit Vault Server database
checkpoint table in AVSYS schema to verify the checkpoint time of the trail until the
records have been collected. If you want to change the attribute value, then the
trail must be restarted after the attribute has been updated.
3-47
4
Java-Based Audit Trail Collection Plug-ins
Oracle Audit Vault and Database Firewall provides a set of Java-based audit trial
collection plug-in, which enable you to create custom plug-ins.
• About Java-Based Collection Plug-ins
For situations where a template-based collection plug-in cannot easily handle audit
data, you can use Java-based collection plug-ins
• JDK Requirement for Using the Java-Based Collection Plug-in
To use a Java-based collection plug-in with Oracle Audit Vault and Database
Firewall, you must have the JDK to compile and test your code.
• About the Flow of Control Inside the Java-Based Collection Plug-in
Learn how Oracle Audit Vault accesses an audit trail, maps the trail to Oracle Audit
Vault events, starts the correct Java-based collection plug-in, and creates audit
records.
• Useful Classes and Interfaces in the Collection Framework
Learn about Oracle Audit Vault Java-based collection plug-in classes and
interfaces that can be particularly useful for your own collections
• How to Create a Java-Based Collection Plug-in
Review the tasks required to create and use Java-based collection plug-ins for
Oracle AVDF.
• Java-Based Collection Plug-in Utility APIs
In addition to the Collection Framework, the Oracle Audit Vault API includes Java
utility APIs that make the task of writing a collector easier.
• Using an Audit Trail Cleanup with Java-Based Collection Plug-ins
Learn how you can enable audit trail clean-up on the source after Oracle Audit
Vault and Database Firewall has archived an audit trail.
• Java-Based Collection Plug-in Security Considerations
Oracle strongly recommends that you review security guidelines before developing
Java-based collection plug-ins.
4-1
Chapter 4
JDK Requirement for Using the Java-Based Collection Plug-in
4-2
Chapter 4
Useful Classes and Interfaces in the Collection Framework
6. The collection plug-in can periodically send Checkpoint and metric information to
the Collection Framework. The collection plug-in can do so in the same flow when
it has the control, for example when the Collection Framework calls hasNext().
7. If the Oracle Audit Vault Server sends commands to the Collection Framework, the
Collection Framework passes them to the collection plug-in to act on.
If the Collection Framework receives a STOP command from the Audit Vault Server,
it notifies the collection plug-in to stop sending record. Then it exits the collection
thread and shuts itself down.
If the Collection Framework receives a RECONFIGURE command from the
Audit Vault Server, it notifies the collection plug-in to set an attribute using
setAttribute().
Related Topics
• Collection Thread
Learn about how Oracle Audit Vault collection threads are run.
• Collection Phase
The collection phase is the phase in which Audit Vault collects audit trail records.
• Checkpoint of a Trail
A Checkpoint, or a checkpoint of a trail, is the point up to which audit records
were committed to the Oracle Audit Vault Server.
• Mapping
The mappings required from targets to Audit Vault Server depends on the fields in
the target records.
4-3
Chapter 4
Useful Classes and Interfaces in the Collection Framework
2
<<Interface>>
AuditService
+ void setCheckpoint(Timestamp
checkPoint)
+ boolean
setMetric(StringmetricName, String
metricValue)
1
<<Interface>>
CollectorContext
+ Timestamp getCheckpoint()
+ Timestamp getMaxEventTime()
+ String getSecuredTargetUser()
+ char[] getSecuredTargetPassword()
+ String getSecuredTargetLocation()
+ String getPluginPath()
+ String getSecuredTargetName()
+ String getTrailType()
+ String getTrailLocation()
+ AVLogger getLogger()
+ AuditService getAuditService()
+ String getAttribute(String
attributeName)
3
<<Class>>
AVLogger
The following diagram shows the various classes and interfaces in the Collection
Framework that you need to know about to write a Java-based collection plug-in.
4-4
Chapter 4
How to Create a Java-Based Collection Plug-in
5 7
<<Abstract Class>> <<Class>>
AuditEventCollector SampleEventCollector
2
4 6
<<Interface>> <<Class>>
AuditEventCollectorFactory SampleEventCollectorFactory
+ AuditEventCollector + AuditEventCollector
createAuditCollection(CollectorContext createAuditCollection(CollectorContext
trailContext) throws <<Implements>> trailContext) throws
AuditEventCollectorException AuditEventCollectorException
4-5
Chapter 4
How to Create a Java-Based Collection Plug-in
4-6
Chapter 4
How to Create a Java-Based Collection Plug-in
Implementing Oracle Audit Vault and Database Firewall involves writing Java
classes that implement the AuditEventCollectorFactory interface, and that extend
the AuditEventCollector class, which are part of the Audit Vault Collection
Framework. The same Java class can both extend the AuditEventCollector
class. and implement the AuditEventCollectorFactory interface. Alternately, you
can choose to write two separate classes.The sample consists of two classes,
SampleEventCollectorFactory which implements the AuditEventCollectorFactory
interface and SampleEventCollector which extends from the AuditEventCollector
class.
Related Topics
• Example Audit Trail for a Database Table Collection Plug-in
This example audit trail shows the details of audit trail. This example file is used in
other locations to demonstrate the creation and structure of a sample mapper file
for Oracle Audit Vault and Database Firewall.
• Java Collection Plug-in Code
This examples shows a complete Java-based collection plug-in.
4-7
Chapter 4
How to Create a Java-Based Collection Plug-in
When the Oracle Audit Vault administrator registers the source, you can require the
Oracle Audit Vault administrator to provide the required information, in the form of
source attributes. Oracle Audit Vault stores these attributes in the Oracle Audit Vault
Server repository, and provides them to the collector code on startup.
Some collection plug-ins do not need to connect to the source and in these cases, the
Collection Framework may return null for these methods.
Related Topics
• Additional Source or Trail Attributes
You can retreive other attributes that you find the Oracle Audit Vault and Database
Firewall collector needs by passing the attribute name to the getAttribute
method.
4-8
Chapter 4
How to Create a Java-Based Collection Plug-in
Related Topics
• Additional Source or Trail Attributes
You can retreive other attributes that you find the Oracle Audit Vault and Database
Firewall collector needs by passing the attribute name to the getAttribute
method.
For example, suppose that a source required SourceVersion to collect audit data. In
that scenario, to obtain the value of SourceVersion. the collector for the source calls
collectorContext.getAttribute('SourceVersion').
4-9
Chapter 4
How to Create a Java-Based Collection Plug-in
If the attribute is present, then the getAttribute method returns the attribute value as
a String. Otherwise, the method returns null.
If the collector receives a null or an invalid value for any mandatory attribute,
then it must throw an AuditEventCollectorException exception from the
initializeCollector method. After throwing an exception, the Collection Framework
shuts down.
Related Topics
• Changing Oracle AVDF Attributes at Run Time
If you are an administrator, then you can change the attributes that a Java-based
collector plug-in uses during Oracle AVDF audit trail collection.
4-10
Chapter 4
How to Create a Java-Based Collection Plug-in
Related Topics
• Using the AVLogger API to Log Messages
To log errors, warnings, informational, and debug messages into the Oracle Audit
Vault and Database Firewall logs, you can use the AVLogger API.
• Example of Using the ConnectionManager API to Connect to Database Sources
See how to use the ConnectionManager API to manage Oracle Audit Vault and
Database Firewall Java compnent connections to databases.
The range that is fetched starts from the point that was just finished to nearly the
current time. The next fetch is performed when the current ResultSet is exhausted
The collection plug-in sets the checkpoint whenever one ResultSet finishes
processing, but before the next one starts. The timing of this is important. When
4-11
Chapter 4
How to Create a Java-Based Collection Plug-in
a collection plug-in sets the checkpoint with Timestamp t, the collection plug-in
must ensure that all records with an event time less than t are already sent to
Collection Framework. However, because ResultSet does not give records in any
particular order, setting the checkpoint before the end of a ResultSet can be incorrect.
Additionally, the collection plug-in does not use the current time as the upper bound
of the range, but rather uses the current time minus the delta time. Using this time
method allows for possible delays between generating the event, and inserting the
event into the table. When the collection plug-in runs the query, all events up to
the upper bound are fetched in the ResultSet to honor the checkpoint contract. The
5-second delay time (the delta) ensures that all of the records, up to the upper bound,
are already in the table.
Example 4-4 Fetching ResultSets and Setting Checkpoints
This example shows how collectors should obtain the Connection from
ConnectionManager whenever they need one.
try {
m_connection = m_connectionManager.getConnection();
} catch (AuditException ex) {
throw new AuditEventCollectorException(
ErrorCodes.FAILED_TO_GET_CONNECTION_TO_DB, null, ex);
}
4-12
Chapter 4
How to Create a Java-Based Collection Plug-in
m_preparedStatement.setTimestamp(1, m_nextCheckpoint);
} else {
query = "select * from AUD where EVENT_TIME > ? and
EVENT_TIME <= ?";
m_preparedStatement = m_connection.prepareStatement(query);
m_preparedStatement.setTimestamp(1, m_previousCheckpoint);
m_preparedStatement.setTimestamp(2, m_nextCheckpoint);
}
m_resultSet = m_preparedStatement.executeQuery();
} catch (SQLException ex) {
throw new AuditEventCollectorException(
ErrorCodes.ERROR_GETTING_DATA_FROM_SOURCE,
new Object[] { query }, ex);
}
m_logger.logDebugMethodExited();
}
4-13
Chapter 4
How to Create a Java-Based Collection Plug-in
4-14
Chapter 4
How to Create a Java-Based Collection Plug-in
eventNameMap.put(1, "CREATE");
eventNameMap.put(2, "INSERT");
eventNameMap.put(3, "SELECT");
eventNameMap.put(4, "CREATE");
eventNameMap.put(15, "ALTER");
eventNameMap.put(30, "AUDIT");
eventNameMap.put(34, "CREATE");
eventNameMap.put(35, "ALTER");
eventNameMap.put(51, "CREATE");
eventNameMap.put(52, "CREATE");
}
Related Topics
• Oracle Audit Vault and Database Firewall Fields
Oracle Audit Vault and Database Firewall values consist of core fields, large fields,
marker fields, and extension fields.
static {
targetTypeMap.put(1, "OBJECT:CREATED:TABLE");
targetTypeMap.put(2, "INSERT INTO TABLE");
targetTypeMap.put(3, "SELECT FROM TABLE");
targetTypeMap.put(4, "OBJECT:CREATED:TABLE");
targetTypeMap.put(15, "OBJECT:ALTERED:TABLE");
targetTypeMap.put(30, "AUDIT OBJECT");
targetTypeMap.put(34, "OBJECT:CREATED:DATABASE");
4-15
Chapter 4
How to Create a Java-Based Collection Plug-in
targetTypeMap.put(35, "OBJECT:ALTERED:DATABASE");
targetTypeMap.put(51, "OBJECT:CREATED:USER");
targetTypeMap.put(52, "OBJECT:CREATED:ROLE");
}
static {
targetTypeMap.put(1, "TABLE");
targetTypeMap.put(2, "TABLE");
targetTypeMap.put(3, "TABLE");
targetTypeMap.put(4, "CLUSTER");
targetTypeMap.put(15, "TABLE");
targetTypeMap.put(30, "OBJECT");
targetTypeMap.put(34, "DATABASE");
targetTypeMap.put(35, "DATABASE");
targetTypeMap.put(51, "USER");
targetTypeMap.put(52, "ROLE");
}
4-16
Chapter 4
How to Create a Java-Based Collection Plug-in
}
}
4-17
Chapter 4
How to Create a Java-Based Collection Plug-in
In the following example, the collection plug-in receives and handles a new time zone
offset to use in converting the EventTime to Coordinated Universal Time (UTC) time
zone for all subsequent events.
Example 4-12 Changing an Oracle Audit Vault and Database Firewall Attribute
4-18
Chapter 4
How to Create a Java-Based Collection Plug-in
As with Oracle Audit Vault and Database Firewall (Oracle AVDF) attributes, you can
also change custom attributes at runtime.
If you want to change custom attributes, then you must implement the following
methods to validate the custom attributes before you can use custom attributes in
the setAttribute method.
<field_name>=<field_value>;
4-19
Chapter 4
How to Create a Java-Based Collection Plug-in
";");
sb.append("PROCESS=" + m_resultSet.getString("PROCESS"));
return sb.toString();
} catch (SQLException ex) {
throw new AuditEventCollectorException(
ErrorCodes.ERROR_GETTING_DATA_FROM_SOURCE, null, ex);
}
}
Note:
The Reader is only valid as long as the Connection to the source is alive.
You must design the collection plug-in to keep the connection to the source alive until
all events using readers have been sent to the Audit Vault Server.
If the collector wants to reset the Connection to the source, it must do so immediately
after setting the checkpoint. This is because the Collection Framework sends batches
of records, and then sets the checkpoint. The time the ckeckpoint is sent is the only
time that the collector knows that all records are flushed to Oracle Audit Vault Server.
Note that there are other occasions that records are sent to the Oracle Audit Vault
Server, but this is the only one with a checkpoint.
If the Reader instance cannot be obtained directly, then the collector must create and
return a Reader.
4-20
Chapter 4
How to Create a Java-Based Collection Plug-in
4-21
Chapter 4
How to Create a Java-Based Collection Plug-in
This method should not result in any exceptions errors. In case of an exception, it
should log an error message, as shown in the following example.
Example 4-17 Calling Close and Releasing Resources
The setAttribute method can throw the SetAttributeException exception when the
method cannot set a new attribute. Upon receiving this exception, it is possible that the
Collection Framework does not stop the collector (see an example in "Changing Audit
Vault and Database Firewall Attributes at Run Time").
The rest of the methods except the close method throw
AuditEventCollectorException. This exception must be thrown only if an
unrecoverable condition has occurred. Upon receiving this exception, the Collection
Framework stops the collector. Before stopping the collector, the Collection Framework
calls close method. See the previous sections for sample code to create and throw
these exceptions.
Related Topics
• Changing Oracle AVDF Attributes at Run Time
If you are an administrator, then you can change the attributes that a Java-based
collector plug-in uses during Oracle AVDF audit trail collection.
4-22
Chapter 4
Java-Based Collection Plug-in Utility APIs
4-23
Chapter 4
Java-Based Collection Plug-in Utility APIs
• INACTIVE_CONNECTION_TIMEOUT=1800
• INITIAL_POOL_SIZE=0
• VALIDATE_CONNECTION_ON_BORROW=true
//Connection Manager
ConnectionManager cManager = null;
try {
/*
* Connection Pool Properties.
* Set the pool properties such as URL
* Initial pool size, Min pool size, etc.
* The set of supported connection pool properties are
* documented in the Oracle UCP documentation
*/
Properties pProps = new Properties();
pProps.put(URL, "jdbc:oracle:thin:@hostname:port:sid");
/*
* Connection Properties
*
* Set the connection properties here.
* The set of connection properties that can be set
* depends on the driver. To enable SSL using the
* the oracle jdbc driver, you need to set the following
* Properties cProps = new Properties();
* String walletLoc = "/path/to/walletdirectory/cwallet.sso";
*
cProps.setProperty("oracle.net.authentication_services","(TCPS)");
* cProps.setProperty("javax.net.ssl.trustStore", walletLoc);
4-24
Chapter 4
Java-Based Collection Plug-in Utility APIs
* cProps.setProperty("oracle.net.ssl_server_dn_match", "true") ;
* cProps.setProperty("javax.net.ssl.trustStoreType","SSO");
* cProps.setProperty("javax.net.ssl.keyStore", walletLoc);
* cProps.setProperty("javax.net.ssl.keyStoreType","SSO");
*/
Properties cProps = new Properties();
String username;
char[] passwd;
Connection conn = null;
/* Do something */
...
} catch (Exception e) {
/* Take appropriate action here */
} finally {
if (cManager != null) {
try {
cManager.destroy();
} catch (AuditException ae) {
/* Take appropriate action here */
}
}
4-25
Chapter 4
Java-Based Collection Plug-in Utility APIs
The ConnectionManager API is designed so that a caller can acquire and release
database connections using different user credentials at any point in time. For
example, a caller can acquire a connection using alice's database credentials, and
then later on acquire a connection with robert's database credentials using the same
connection manager.
Note:
Ensure that the caller does not do the following:
• Keep a reference to the connection locally (through an instance or class
variable).
• Hold on to the connection for a long time.
These requirements enable the connection pool to automatically recover
connections that have the following behaviors:
• They have exceeded the TIME_TO_LIVE time limit.
• They have abandoned connections, that is, connections that have not
been in use for a while.
• There are connections that have been borrowed too many times. This
requirement ensures that they to avoid resource leaks.
Related Topics
• Initializing the Java-Based Collection Plug-in
Use these examples to understand how to initialize a Java-based collection plug-
in, and how to start audit events collection with Oracle Audit Vault and Database
Firewall.
4-26
Chapter 4
Java-Based Collection Plug-in Utility APIs
<<extends>>
<<Class>>
<<Class>> EventLogRecord
OutsideRange
+ Long getLength()
+ static Operator getInstance() + Long getReserved()
+ Long getRecordNumber()
+ Date getTimeGenerated()
+ Date getTimeWritten()
+ Long getEventId()
<<Class>> + Long getEventType()
InRange + Long getNumStrings()
+ String [] getEventDataValues()
+ static Operator getInstance() + Long getEventCategory()
+ Long getReservedFlags()
+ Long getClosingRecordNumber()
+ String getSourceName()
+ String getComputerName()
+ String getUserSid()
The EventLogRecord class contains one record in the event log. The EventLogReader
class helps to fetch event log records one by one. Operator classes help filter the
event log records. An operator works on a particular field of event log record and
determines whether the record is to be filtered based on the value of the field. For
example, you can use the Equals operator to filter all event log records where the
value of the field does not equal the value specified. The InRange and OutsideRange
operators are ternary operators. The rest are binary operators.
To collect event log records, follow these steps:
1. Create the EventLogReader instance.
For example, to open the application event log:
4-27
Chapter 4
Java-Based Collection Plug-in Utility APIs
To open other event logs such security or system event logs, use the overloaded
method openLog(String log). For example, to open a security event log:
To open an application event log from a specific record number, use the
openLog(int startRecNum) overloaded method. For example, to open an
application event log from audit record number 1234:
To open security or system event logs from a specific record number, use the
overloaded method, openLog(String log, int startRecNum). For example, to
open a security event log from record number 4321:
eventLogReader.addFilter(EventLogReader.SOURCE_NAME,
Equals.getInstance(), "MSSQL$SQLEXPRESS");
m_eventLogReader.addFilter(EventLogReader.TIME_GENERATED,
GreaterThan.getInstance(), m_lowerBoundTime);
m_eventLogReader.addFilter(EventLogReader.TIME_GENERATED,
LessThan.getInstance(), m_upperBoundTime);
if(eventLogReader.hasNext()) {
EventLogRecord record =
(EventLogRecord)eventLogReader.next();
Long eventID = record.getEventId();
String userID = record.getUserSid();
String hostName = record.getComputerName();
...
}
4-28
Chapter 4
Java-Based Collection Plug-in Utility APIs
When the collector is stopped, use the following code to close down the
EventLogReader instance:
eventLogReader.closeLog();
Related Topics
• Closing the Java-Based Collection Plug-in
See how you can close a Java-based collection plug-in for Oracle Audit Vault and
Database Firewall.
<<Class>> <<Class>>
EventMetaDataReader EventMetaDataRecord
4-29
Chapter 4
Java-Based Collection Plug-in Utility APIs
4. Obtain metadata from the list, and obtain event data names from it.
import oracle.av.platform.common.util.AVLogger;
import oracle.av.platform.common.exception.AuditException;
import oracle.av.platform.common.AuditErrorCodes;
4-30
Chapter 4
Using an Audit Trail Cleanup with Java-Based Collection Plug-ins
}
}
}
Related Topics
• Initializing the Java-Based Collection Plug-in
Use these examples to understand how to initialize a Java-based collection plug-
in, and how to start audit events collection with Oracle Audit Vault and Database
Firewall.
4.6.6 Using the Oracle XML Developer's Kit to Parse XML Files
If you are developing collections, then you can use the Oracle XML Developer's Kit to
parse XML files and extract audit records from them.
The Oracle XML Developer's Kit is included. and available to use to develop
collections.
See Also:
Oracle XML Developer's Kit Programmer's Guide for detailed information.
• securedTargetType=Oracle
• SecuredTargetName=orcl
• TrailType=TABLE
4-31
Chapter 4
Java-Based Collection Plug-in Security Considerations
• TrailName=sys.aud$
• 2016-04-15 10:26:53.7 (This time stamp represents the last checkpoint for these
settings.)
The target clean-up utility can parse the checkpoint from the atc file and purge audit
records till this timestamp from audit trail.
For example, Oracle Database sources provide a target cleanup utility, in the
DMBS_AUDIT_MGMT PL/SQL package. The Oracle Database prepackaged collection
plug-ins integrate with the DMBS_AUDIT_MGMT package, which enables audit trail
cleanup operations on the source.
4-32
5
Packaging Audit Collection Plug-ins
Learn about the steps you need to perform to package collection plug-ins.
• Flow of Packaging
Review the flow of packaging audit trails with Oracle Audit Vault and Database
Firewall.
• Creating a plugin_manifest.xml File for Shipping
After you have created packaging for your audit trails, you are in a position to
create a plugin-manifest.xml file for Oracle Audit Vault and Database Firewall.
• External Dependencies
In the packaging process, external dependencies are files that are needed
during runtime, but that can be unavailable when you package Oracle Audit Vault
collection plug-ins.
• Creating New Versions of Your Audit Collection Plug-ins
If you create new versions of the collection plug-ins, then you can easily plug them
in to replace existing versions without difficulty in Oracle Audit Vault and Database
Firewall.
• Description of Plug-in Manifest File
The plugin-manifest.xml file is a core XML file that describes the collection
plug-in.
• avpack Tool
The avpack tool is a command-line based tool written in Java that packages the
various collection plug-in objects such as code files, configuration files, and so on.
5-1
Chapter 5
Creating a plugin_manifest.xml File for Shipping
See Also:
5-2
Chapter 5
Creating New Versions of Your Audit Collection Plug-ins
During deployment, avpack checks to see if the file foo.jar is present in the $OH/av/
dropins folder on the Oracle Audit Vault Server. If the file is missing, then avpack
fails to deploy the collection plug-in. Instead, it issues a message stating that external
dependencies are not being met.
To resolve the issue, the user must acquire the file, and make it available in
the $OH/av/dropins folder. After the external dependency is provided, avpack can
deploy the collection plug-in successfully.
Collection plug-ins are cumulative in nature. All necessary files are created and
updated.
To remove or undeploy collection plug-ins, use the avcli tool and the UNDEPLOY
PLUGIN commands. These commands are atomic; that is, they are all or nothing
transaction, which helps maintain a high degree of system stability.
Related Topics
• Oracle Audit Vault and Database Firewall Administrator's Guide
• Oracle Audit Vault and Database Firewall Administrator's Guide
• The plugin element represents the plug-in object with these attributes:
– Name: A descriptive name for the collection plug-in.
– version: The version should be updated along with each update to the
collection plug-in, and should monotonically increase based on some ordering
scheme. For instance, AVDF uses a versioning scheme comprising of five
digits, delimited by periods: majr.minr.minr.patch.hotfix.
– provider: The name of the provider. Typically, this name is the company or
organization.
5-3
Chapter 5
Description of Plug-in Manifest File
5-4
Chapter 5
avpack Tool
-
oracle.av.platform.agent.collfwk.ezcollector.xml.XMLFileCollect
or for XML file collection plug-ins.
oracle.av.platform.agent.collfwk.ezcollector.json.MultiJSONFile
CollectorFactory for JSON file collection plug-ins which reads from
JSON files having one fully formed JSON per line.
oracle.av.platform.agent.collfwk.ezcollector.json.JSONFileColle
ctorFactory for JSON file collection plug-ins which reads from JSON files
having only one fully formed JSON per file, and this single JSON contains
an array of JSON records.
To handle audit trails of different source versions of the same source type,
you can optionally set the srcVersion attribute.
– eventPatch: This is an optional field containing any event patches that must
be applied as part of the collection plug-in deployment. These patches are in
the eventPatch element with the name attribute as the file name and an order
attribute that indicates the order to apply the patches.
Events attributes to be added are extended through patches generated by
Oracle Audit Vault and Database Firewall Development. Partner developers
can request specific events and attributes or both, to be added to the Oracle
Audit Vault Event dictionary. If the core development team determines that a
request is justified, it may issue a patch. You can bundle these patches with
the collection plug-in for application during plug-in deployment.
See Also:
Prerequisites
You must complete the following prerequsites for using the avtool:
• Install and package (run) the avpack plug-in tool on the same platform on which
the agent will run.
The packaged avpack plug-in for Linux can be used for all platforms, but the
packaged avpack plug-in for Windows can only be used for Windows platforms.
• Place collection plug-in artifacts following the recommended directory structure.
Then, you can use avpack to generate a collection plug-in package.
5-5
Chapter 5
avpack Tool
File Path
You can stage the collection plug-in files in any directory that is accessible by the
avpack tool. The avpack tool validates the directory structure, and then parses and
verifies the plugin-manifest.xml file. The tool also performs some basic verifications,
such as verifying that all the files specified in the plugin-manifest.xml are staged in
their corresponding directories, and so on.
Syntax
Options
Each option must be prefixed with a minus sign (-).
Option Description
-stagedir The directory under which the collection
plug-in artifacts are staged. Contents of this
directory will be archived in the generated
plug-in archive.
-o The name for the generated plug-in archive
file. It should end with a .zip extension.
(for example, myplugin.zip).
-l (Optional) Sets the log level to the level
specified. Supported log levels: INFO,
WARNING, ERROR, and DEBUG. Default log
level is INFO.
-h (Optional) Display help for the avpack tool.
Usage Notes
You use the plugin-manifest.xml file to specify the key files that the collection plug-in
must have to run. The avpack utility checks for the existence of these files, but zips
everything contained in stagedir, so you do not need to list every file unless you want
it to be verified by avpack.
After validation is complete, the tool packages the files into a .zip plug-in package
suitable for deployment with Oracle Audit Vault and Database Firewall.
Related Topics
• Audit Collection Plug-in Directory Structure
Learn about the Oracle Audit Vault collection plug-in directory structure, the
development environment, and how to stage plug-in manifest.xml files.
5-6
6
Testing Audit Collection Plug-ins
Find out about the testing you can do for your collection plug-ins.
Be sure to analyze your database and audit trails for other issues that require testing.
• Requirements for Testing Audit Collection Plug-ins
To prepare for testing, deploy the Audit Vault Server and an Audit Vault Agent, and
check your systems and audit trails.
• Typical Audit Collection Plug-in Testing Processes
A typical audit collection testing process for collections plug-ins should look like
this.
• Deploying an Oracle Audit Vault Agent
See how you register an agent, create an agent home, install the agent, and start
the agent.
• Redeploying the Oracle Audit Vault Agent
While testing the collection plug-in, it can be necessary to redeploy the agent for
various reasons.
6-1
Chapter 6
Typical Audit Collection Plug-in Testing Processes
a. Deploy the collection plug-in in the generated .zip archive that you created
earlier in your test Oracle Audit Vault Server environment.
b. Redeploy the agent (containing the updated plug-in artifacts) into your test
Oracle Audit Vault agent environment.
c. Register the source using the AVCLI utility.
d. Issue an AVCLI START COLLECTION command to start gathering records from
the audit trail supported by this collection plug-in.
e. Validate the process, by looking at the data reports through the AVDF
Console, to ensure that:
- Records in the source are now in the Oracle Audit Vault Server.
- The data makes sense.
- Fields are correctly mapped.
- Values are valid.
f. Issue an AVCLI STOP COLLECTION command.
g. Undeploy the collection plug-in..
h. Redeploy the agent as described in Step 1b.
2. Perform failure testing to see what happens when various things go wrong.
Some examples of failure are network failure, a source shutting down in the middle
of collection, a power outage, and malformed input data. In all cases, the collection
plug-in should not crash, and should be able to recover gracefully, continuing
collection from where it left off. The guarantee you need to provide is that each
audit record is sent to the Audit Vault Server once, and exactly once, regardless of
failure.
3. Analyze performance by checking how many of these components the collection
plug-in uses:
• The CPU
• The memory
• The disk I/O
• The network I/O
4. Check the performance under stress.
Some examples of stress are thirty days of continuous use, heavy event volume,
or collection of trails for multiple sources at the same time, both on the same host,
and on multiple hosts.
5. Perform security testing (for example, see if you can inject HTML or SQL).
6. Perform internationalization testing. Test the ability to handle data in multiple input
languages.
7. If bugs are found, fix them and then repeat these steps.
6-2
Chapter 6
Deploying an Oracle Audit Vault Agent
See Also:
Related Topics
• STOP COLLECTION FOR TARGET
• Packaging Audit Collection Plug-ins
Learn about the steps you need to perform to package collection plug-ins.
• Redeploying the Oracle Audit Vault Agent
While testing the collection plug-in, it can be necessary to redeploy the agent for
various reasons.
5. Start the agent using -key option. When prompted, enter the activation key that
was provided by the Audit Vault Administrator. As you type it, this key is not
displayed.
Subsequently, starting the agent does not require the user to provide the activation
key. The agent can be started using the following command:
$ $AGENT_HOME/bin/agentctl start
6-3
Chapter 6
Redeploying the Oracle Audit Vault Agent
It can take several seconds before the agent comes to a complete stop, and the agent
process is shut down.
Activation is a one-time activity. You do not have to do it again.
You can stop the agent at any time by using the following command:
$ $AGENT_HOME/bin/agentctl stop
Related Topics
• REGISTER HOST
Note:
The agent automatically determines if it is an upgrade or a new install
depending on the destination directory provided to the java -jar agent.jar
command.
6-4
A
Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
• Oracle Audit Vault and Database Firewall Fields
Oracle Audit Vault and Database Firewall values consist of core fields, large fields,
marker fields, and extension fields.
• Actions and Target Types
When you build collection plug-ins, you can use the target types and actions that
Oracle Audit Vault can detect.
A-1
Appendix A
Oracle Audit Vault and Database Firewall Fields
UserName: Required: The user who performed the action in the application or
system that generated the audit record. If this field contains NULL, then the audit record
is invalid.
CommandClass: Required: The action performed in the event (for example, SELECT
or DELETE). If this field contains NULL, then the audit record is invalid.
OSUserName: The user who logged into the operating system that generated the
audit record. If the user logged into the operating system as JOHN but performed the
action as SCOTT, then this field contains JOHN and the User Name field contains SCOTT.
TargetType: The type of the target object on which the action was performed. For
example, if the user selected from a table, then the target type is TABLE.
TargetObject: The name of the object on which the action was performed. For
example, if the user selected from a table, then the Target Object field contains the
name of the table.
TargetOwner: The name of the owner of the target on which the action was
performed. For example, if the user had selected from a table owned by user JOHN,
then the Target Owner field contains the user name JOHN.
ClientIP: The IP address of the host (Host Name) from where the user initiated the
action.
ClientId: Client identifier of the user whose actions were audited.
ClientHostName: The host computer from where the user initiated the action. For
example, if the user performed the action from an application on a server, then this
field contains the name of the server.
TerminalName: Name of the UNIX terminal that was the source of the event.
EventName: The name of the event as is from the audit trail.
EventStatus: The status of the event. There are three possible values for
EventStatus: SUCCESS, FAILURE, and UNKNOWN.
A-2
Appendix A
Actions and Target Types
• CommandText: Contains the text of the command that caused the event, which
can be a SQL statement, a PL/SQL statement, and so on. This is also a core field.
• CommandParam: Contains the parameters of the command that caused the
event. This is also a core field.
A-3
Appendix A
Actions and Target Types
A.2.1 Actions
The Action field describes the nature of user activity that triggers generation of an
audit record. It is similar to the verb part of a sentence; it describes the activity.
Purpose
Describes the nature of user activity that triggers generation of an audit record. .
Oracle Audit Vault and Database Firewall strongly recommends mapping audit events
to an appropriate value for the Action field, if the user activity semantically maps to it.
Permitted Actions
Oracle Audit Vault Server is currently aware of the following actions:
ABORT
ACCESS
ACQUIRE
ALTER
ANALYZE
APPLY
ARCHIVE
ASSIGN
ASSOCIATE
AUDIT
AUTHENTICATE
AUTHORIZE
BACKUP
BIND
BLOCK
CACHE
CALCULATE
CALL
CANCEL
CLOSE
COMMIT
COMMUNICATE
COMPARE
CONFIGURE
CONNECT
CONTROL
CONVERT
COPY
CREATE
DDL
DEADLOCK
DELETE
DEMOTE
DENY
DENY
DISABLE
DISASSOCIATE
DISCONNECT
A-4
Appendix A
Actions and Target Types
DML
DROP
ENABLE
EXCEED
EXECUTE
EXPIRE
EXPORT
FAIL
FILTER
FINISH
GET
GRANT
IMPORT
INHERIT
INITIALIZE
INSERT
INSTALL
INVALID
INVALIDATE
LOAD
LOCK
LOGIN
LOGOUT
MIGRATE
MOUNT
MOVE
NOAUDIT
NOTIFY
NOTIFY
OPEN
PAUSE
PROMOTE
PROXY
PUBLISH
QUARANTINE
RAISE
READ
RECEIVE
RECOVER
REDO
REFRESH
REGISTER
RELEASE
REMOTE CALL
RENAME
RENEW
REQUEST
RESET
RESTORE
RESUME
RETRIEVE
REVOKE
ROLLBACK
ROLLFORWARD
SAVEPOINT
A-5
Appendix A
Actions and Target Types
SEARCH
SELECT
SEND
SET
START
STOP
SUBMIT
SUBSCRIBE
SUSPEND
SYNCHRONIZE
TRANSACTION MANAGEMENT
TRUNCATE
UNDO
UNINSTALL
UNKNOWN
UNLOCK
UNMOUNT
UNREGISTER
UNSUBSCRIBE
UPDATE
VALIDATE
VIOLATE
WAIT
WRITE
Purpose
Describes the type of object on which a user action operates.
Oracle Audit Vault and Database Firewall strongly recommends mapping audit events
to an appropriate value for the TargetType field, if the user activity semantically maps
to it.
Permitted Objects
Oracle Audit Vault Server is currently aware of the following target types:
ALL TRIGGERS
APP ROLE
APPLICATION
ASSEMBLY
AUTHORIZATION
BROKER QUEING
BUFFERPOOL
CHECKPOINT
CLUSTER
CONNECTION
CONTEXT
CONTROL FILE
DATABASE
A-6
Appendix A
Actions and Target Types
DATABASE LINK
DBA_RECYCLEBIN
DEFAULT
DIMENSION
DIRECTORY
EDITION
EVALUATION
EVENT MONITOR
EXPRESSION
FLASHBACK
FLASHBACK ARCHIVE
FUNCTION
INDEX
INDEXES
INDEXTYPE
INSTANCE
JAVA
LIBRARY
MATERIALIZED VIEW
MATERIALIZED VIEW LOG
MESSAGE
METHOD
MINING MODEL
NODE
NODEGROUP
OBJECT
OPERATOR
OUTLINE
PACKAGE
PACKAGE BODY
PRIVILEGE
PROCEDURE
PROFILE
PUBLIC DATABASE LINK
PUBLIC SYNONYM
RESOURCE COST
RESTORE POINT
REVOKE
REWRITE EQUIVALENCE
ROLE
ROLLBACK SEG
RULE
SAVEPOINT
SAVEPOINT
SCHEMA
SEQUENCE
SESSION
STATISTICS
SUBSCRIPTION
SUMMARY
SYNONYM
SYSTEM
TABLE
TABLE OR SCHEMA POLICY
TABLESPACE
A-7
Appendix A
Actions and Target Types
TAPE
TRACE
TRANSACTION
TRIGGER
TYPE
TYPE BODY
UNKNOWN
USER
USER LOGON
USER OR PROGRAM UNIT LABEL
USER_RECYCLEBIN
VIEW
A-8
B
Schemas
Oracle AVDF uses these schemas for plug-in manifest files and collection plug-ins.
• Sample Schema for a plugin-manifest.xml file
To validate any plugin-manifest.xml file that you author, Oracle recommends
that you use the sample schema for a plugin-manifest.xml file.
• Database Table Collection Plug-in Mapper File
See an example of an Oracle Audit Vault and Database Firewall database table
collection plug-in mapper file.
• Schema For XML File Collection Plug-in Mapper File
See how to set up a schema for an XML file collection plug-in mapper file for
Oracle Audit Vault and Database Firewall.
• Schema For JSON File Collection Plug-in Mapper File
See how to set up a schema for a JSON file collection plug-in mapper file for
Oracle Audit Vault and Database Firewall.
• Schema For CSV File Collection Plug-in Mapper File
See how to set up a schema for a CSV file collection plug-in mapper file for Oracle
Audit Vault and Database Firewall.
• Schema For JSON REST Collection Plug-in Mapper File
See how to set up a schema for a JSON REST collection plug-in mapper file for
Oracle Audit Vault and Database Firewall.
• Schema For REST Collector Plug-in Mapper File
See how to set up a schema for a REST collector plug-in mapper file for Oracle
Audit Vault and Database Firewall.
• Schema For Name Pattern Collection Plug-in Mapper File
See how to set up a schema for a name pattern collection plug-in mapper file for
Oracle Audit Vault and Database Firewall.
• Schema For JSON Collector Plug-in Mapper File
See how to set up a schema for JSON collector plug-in mapper file for Oracle
Audit Vault and Database Firewall.
• Schema For EZCollector Plug-in Mapper File
See how to set up a schema for an EZCollector plug-in mapper file for Oracle
Audit Vault and Database Firewall.
B-1
Appendix B
Sample Schema for a plugin-manifest.xml file
xmlns="http://foobar.example.com/av/plugin"
targetNamespace="http://foobar.example.com/av/plugin"
elementFormDefault="qualified">
<xs:element name="plugin">
<xs:complexType>
<xs:sequence>
<xs:element name="targetVersion">
<xs:complexType>
<xs:attribute name="min" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="extensionSet">
<xs:complexType>
<xs:sequence>
<xs:element name="extensionPoint">
<xs:complexType>
<xs:sequence>
<xs:element name="fileList">
<xs:complexType>
<xs:sequence>
<xs:element name="jars" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="templates" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="bin" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="config" minOccurs="0" maxOccurs="1">
B-2
Appendix B
Sample Schema for a plugin-manifest.xml file
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="shell" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="patch" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unresolved-external" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="include">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="permission" type="xs:string"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="securedTargetTypeInfo">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="trailInfo">
<xs:complexType>
B-3
Appendix B
Database Table Collection Plug-in Mapper File
<xs:sequence>
<xs:element name="trailType" type="xs:string" />
<xs:element minOccurs="0" name="trailLocation" type="xs:string" />
<xs:element maxOccurs="unbounded" name="className">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="securedTargetVersion" type="xs:decimal"
use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="unbounded" name="eventPatch">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="order" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attribute name="version" type="xs:string" use="required" />
<xs:attribute name="provider-name" type="xs:string" use="required" />
<xs:attribute name="copyright" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:schema>
Related Topics
• Example Code
Learn from examples the different types of collection plug-ins, including database
tables, XML files, and Java-based file collection plug-ins.
• Staging a plugin-manifest.xml File
You must stage the plugin-manifest.xml file directly under the STAGE_DIR_ROOT
directory.
<?xml version="1.0"?>
<!--
B-4
Appendix B
Database Table Collection Plug-in Mapper File
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
-->
B-5
Appendix B
Schema For XML File Collection Plug-in Mapper File
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd"/>
B-6
Appendix B
Schema For JSON File Collection Plug-in Mapper File
</xsd:complexType>
</xsd:element>
<!-- Secured Target to AV server fields Mapping for Core, Large,
Extension fields and Marker-->
<xsd:element name="FieldMappingInfo" type="FieldMappingInfoType"
minOccurs="1" maxOccurs="1"/>
<!-- Event Filter. This is optional. If it is not used, all the audit
events will be collected-->
<xsd:element name="EventFilter" type="EventFilterType" minOccurs="0"
maxOccurs="1"/>
</xsd:all>
<!-- Secured Target Type-->
<xsd:attribute name="securedTargetType" type="xsd:string" use="required"/>
<!-- Max Secured Target version supported by the template-->
<xsd:attribute name="maxSecuredTargetVersion" type="xsd:string"
use="required"/>
<!-- Min Secured Target version supported by the template-->
<xsd:attribute name="minSecuredTargetVersion" type="xsd:string"/>
<!-- Template file version-->
<xsd:attribute name="version" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://foobar.example.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd"/>
B-7
Appendix B
Schema For CSV File Collection Plug-in Mapper File
maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="RecordInfo" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:all>
<!-- start tag of xml audit record in XML audit file-->
<xsd:element name="StartTag" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<!-- Secured Target to AV server fields Mapping for Core, Large,
Extension fields and Marker-->
<xsd:element name="FieldMappingInfo" type="FieldMappingInfoType"
minOccurs="1" maxOccurs="1"/>
<!-- Event Filter. This is optional. If it is not used, all the audit
events will be collected-->
<xsd:element name="EventFilter" type="EventFilterType" minOccurs="0"
maxOccurs="1"/>
</xsd:all>
<!-- Secured Target Type-->
<xsd:attribute name="securedTargetType" type="xsd:string" use="required"/>
<!-- Max Secured Target version supported by the template-->
<xsd:attribute name="maxSecuredTargetVersion" type="xsd:string"
use="required"/>
<!-- Min Secured Target version supported by the template-->
<xsd:attribute name="minSecuredTargetVersion" type="xsd:string"/>
<!-- Template file version-->
<xsd:attribute name="version" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://foobar.example.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd"/>
B-8
Appendix B
Schema For JSON REST Collection Plug-in Mapper File
B-9
Appendix B
Schema For JSON REST Collection Plug-in Mapper File
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://foobar.example.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd" />
B-10
Appendix B
Schema For JSON REST Collection Plug-in Mapper File
B-11
Appendix B
Schema For REST Collector Plug-in Mapper File
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd" />
B-12
Appendix B
Schema For REST Collector Plug-in Mapper File
B-13
Appendix B
Schema For Name Pattern Collection Plug-in Mapper File
B-14
Appendix B
Schema For Name Pattern Collection Plug-in Mapper File
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:complexType name="NameFormatDateType">
<xsd:all>
<xsd:element name="Format" type="DateFormatValues" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Inc" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="NameFormatNumberType">
<xsd:all>
<xsd:element name="Format" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Inc" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="NameFormat">
<xsd:choice>
<xsd:element name="DateFormat" type="NameFormatDateType"/>
<xsd:element name="NumberFormat" type="NameFormatNumberType"/>
<xsd:element name="StringFormat" type="xsd:string"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="NamePatternType">
<xsd:choice>
<xsd:element name="RollNamePattern">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"
maxOccurs="1000"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="IncrementNamePattern">
B-15
Appendix B
Schema For JSON Collector Plug-in Mapper File
<xsd:complexType>
<xsd:all>
<!-- Type and Format of the pattern Type Date, Format yyyy_MM_dd
-->
<xsd:element name="NamePrefix" type="NameFormat" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Name" type="NameFormat" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="NameSuffix" type="NameFormat" minOccurs="1"
maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:schema>
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="ezCollectorTemplate_schema.xsd"/>
B-16
Appendix B
Schema For EZCollector Plug-in Mapper File
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--Existing Set of Core Fields-->
<xsd:simpleType name="CoreFieldValues">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="EventTimeUTC"/>
<xsd:enumeration value="UserName"/>
<xsd:enumeration value="OSUserName"/>
<xsd:enumeration value="CommandClass"/>
<xsd:enumeration value="TargetObject"/>
<xsd:enumeration value="ClientHostName"/>
<xsd:enumeration value="ClientIP"/>
B-17
Appendix B
Schema For EZCollector Plug-in Mapper File
<xsd:enumeration value="ClientProgramName"/>
<xsd:enumeration value="TargetOwner"/>
<xsd:enumeration value="ErrorId"/>
<xsd:enumeration value="ErrorMessage"/>
<xsd:enumeration value="EventStatus"/>
<xsd:enumeration value="EventName"/>
<xsd:enumeration value="TargetType"/>
<xsd:enumeration value="TerminalName"/>
<xsd:enumeration value="ClientId"/>
</xsd:restriction>
</xsd:simpleType>
<!--FieldMappingInfo-->
<xsd:complexType name="FieldMappingInfoType">
<xsd:all>
<!-- Core Field Mapping-->
<xsd:element name="CoreFields" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Map" minOccurs="1" maxOccurs ="14">
<xsd:complexType>
<xsd:all>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="MapTo"
type="CoreFieldValues" />
B-18
Appendix B
Schema For EZCollector Plug-in Mapper File
<xsd:element name="TimestampPattern"
type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="Transformation"
type="TransformationType" minOccurs="0" maxOccurs="1" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Large Field Mapping -->
<xsd:element name="LargeFields" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Map" minOccurs="0" maxOccurs="2">
<xsd:complexType>
<xsd:all>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="MapTo" type="LargeFieldValues" />
<xsd:element name="Transformation"
type="TransformationType" minOccurs="0" maxOccurs="1" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- List of fields to be mapped to extensible fields-->
<xsd:element name="ExtensionField" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="0"
maxOccurs ="500" />
<xsd:element name="ComplexName" minOccurs="0" maxOccurs ="500" >
<xsd:complexType>
<xsd:all>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="RegExp" type="xsd:string" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- List of fields which uniquely identify each audit record-->
<xsd:element name="MarkerField" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"
maxOccurs="20"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
B-19
Appendix B
Schema For EZCollector Plug-in Mapper File
B-20
C
Example Code
Learn from examples the different types of collection plug-ins, including database
tables, XML files, and Java-based file collection plug-ins.
• Database Table Collection Plug-in Example
See examples of Oracle Audit Vault database table collection plug-in mapper files
and database table plug-in manifest files.
• XML File Collection Plug-in Examples
Learn about the plug-in mapper file and plug-in manifest file attributes and fields
for Oracle Audit Vault and Database Firewall.
• JSON File Collection Plug-in Example
Learn about the JSON plug-in mapper file and plug-in manifest file attributes and
fields for Oracle Audit Vault and Database Firewall.
• CSV File Collection Plug-in Example
Learn about the CSV plug-in mapper file and plug-in manifest file attributes and
fields for Oracle Audit Vault and Database Firewall.
• JSON REST Collection Plug-in Example
Learn about the JSON REST plug-in mapper file and plug-in manifest file
attributes and fields for Oracle Audit Vault and Database Firewall.
• Java-Based Collection Plug-in Example
Learn about the Java plug-in code and Java-based collection plug-in manifest file
packages and structure for Oracle Audit Vault and Database Firewall.
Mandatory Fields
These attributes and fields are mandatory:
C-1
Appendix C
Database Table Collection Plug-in Example
• securedTargetType
• maxSecuredTargetVersion
• version
• TableName
• Driver
• EventTimeUTC
• CommandClass transformations
• EventStatus transformations
• MarkerField
Optional Fields
Source names that map to Oracle Audit Vault Server fields are not mandatory.
However, if the information is not provided when data collection starts, then all audit
records are treated as invalid:
• UserName
• CommandClass
Example C-1 Sample XML Mapper File for a Database Table Collection Plug-in
<AVTableCollectorTemplate securedTargetType="DBSOURCE"
minSecuredTargetVersion="10.2.0"
maxSecuredTargetVersion="11.0" version="1.0" >
<!--Example Template for a database Collector-->
<!-- Attributes: securedTargetType,
maxSecuredTargetVersion,
and version are mandatory;
minSecuredTargetVersion attribute is optional
-->
<!-- Accepted Format for min/maxSecuredTargetVersion and
version attribute value is numbers separated by
dots (For example: 12.2,10.3.2, 11.2.3.0
etc..)-->
<!-- Audit Table Information -->
<!-- Name of Audit Table: Mandatory information -->
<TableName>dummy_auditTable</TableName>
<!-- Source Connection Information -->
<ConnectionInfo>
<DataSource>oracle.jdbc.pool.OracleDataSource</DataSource>
<!--Datasource class name for current secured target type:
Mandatory information -->
</ConnectionInfo>
<!-- This Gives Mapping Information of Source Fields to
various AV
Fields(core and large fields) -->
<!-- There should be no many-to-one mappings from source
fields to
AV Server fields -->
<FieldMappingInfo>
<!-- Mapping of Source Fields to Core Fields of AV
C-2
Appendix C
Database Table Collection Plug-in Example
server -->
<!-- Source fields specified in core field mappings must
be of SQL
Datatype: String OR convertible to String-->
<CoreFields>
<Map>
<!-- Mandatory: EventTime mapping information -->
<Name>EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
</Map>
<Map>
<!-- If UserName core field mapping is not provided,
Audit Data
Collection still starts successfully, but every audit
record
will be treated as invalid -->
<Name>USER_ID</Name>
<MapTo>UserName</MapTo>
</Map>
<Map>
<Name>OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<Name>ACTION</Name>
<MapTo>CommandClass</MapTo>
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
<ValueTransformation from="30" to="LOGON"/>
<ValueTransformation from="34" to="LOGOFF"/>
<ValueTransformation from="35" to="ACQUIRE"/>
</Transformation>
</Map>
<Map>
<Name>OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
C-3
Appendix C
Database Table Collection Plug-in Example
</Map>
<Map>
<Name>USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>STATUS</Name>
<MapTo>EventStatus</MapTo>
C-4
Appendix C
Database Table Collection Plug-in Example
<Name>TERMINAL</Name>
</ExtensionField>
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
<?xml version="1.0"?>
<plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/av/plugin plugin-
manifest.xsd"
xmlns="http://xmlns.oracle.com/av/plugin"
name="HRMS-Template"
id="com.oracle.av.plugin"
version="1.0"
provider-name="Oracle Corp."
copyright="Copyright Oracle Corp. 2011">
<extensionSet>
<extensionPoint type= "securedTargetType">
<!-- Tag: fileList: Lists all files that ship with the
plugin -->
C-5
Appendix C
XML File Collection Plug-in Examples
<fileList>
<jars></jars>
<templates>
<include file="DBSource-Mapper.xml"/>
</templates>
<bin></bin>
<config></config>
<shell></shell>
<patch></patch>
<unresolved-external>
</unresolved-external>
</fileList>
<!-- Tag: securedTargetTypeInfo: Contains secured
target type and
trail information -->
<securedTargetTypeInfo name="DBSOURCE"/>
C-6
Appendix C
XML File Collection Plug-in Examples
Mandatory Attributes and Fields for XML File Collection Plug-In Mapper Files
• securedTargetType
• maxSecuredTargetVersion
• version
• HeaderInfo
• RecordInfo
• EventTimeUTC
• CommandClass transformations
• EventStatus transformations
• MarkerField
<AVXMLCollectorTemplate securedTargetType="XMLSOURCE"
maxSecuredTargetVersion="11.0"
version="1.0">
<!--Example Template for XML template collector-->
<!-- Attributes: "securedTargetType",
"maxSecuredTargetVersion" and
"version" are mandatory attributes,
"minSecuredTargetVersion"
attribute is optional -->
<!-- Accepted Format for min/maxSecuredTargetVersion and
version
attribute value is numbers separated by dots (For
example:
12.2,10.3.2, 11.2.3.0 etc..)-->
<!-- Header Information like XML Header start tag -->
<HeaderInfo>
<!-- Mandatory: HeaderInfo-->
<!-- Value in this tag gives Root tag of the XML audit
file-->
C-7
Appendix C
XML File Collection Plug-in Examples
<StartTag>Audit</StartTag>
</HeaderInfo>
C-8
Appendix C
XML File Collection Plug-in Examples
<Transformation>
<ValueTransformation from="1" to="CREATE"/>
<ValueTransformation from="2" to="INSERT"/>
<ValueTransformation from="3" to="SELECT"/>
<ValueTransformation from="4" to="CREATE"/>
<ValueTransformation from="15" to="READ"/>
<ValueTransformation from="30" to="LOGON"/>
<ValueTransformation from="34" to="LOGOFF"/>
<ValueTransformation from="35" to="ACQUIRE"/>
</Transformation>
</Map>
<Map>
<Name> OBJ_NAME</Name>
<MapTo>TargetObject</MapTo>
</Map>
<Map>
<Name>USER_HOST</Name>
<MapTo>ClientHostName</MapTo>
</Map>
<Map>
<Name>OBJ_CREATOR</Name>
<MapTo>TargetOwner</MapTo>
</Map>
<Map>
<Name>STATUS</Name>
<MapTo>EventStatus</MapTo>
<!-- Specifying value transformation for Status source
field value.
Mandatory: EventStatus value transformation.
There are three possible values for EventStatus:
SUCCESS, FAILURE, UNKNOWN -->
<Transformation>
<ValueTransformation from="0" to="FAILURE"/>
<ValueTransformation from="1" to="SUCCESS"/>
<ValueTransformation from="2" to="UNKNOWN"/>
</Transformation>
</Map>
</CoreFields>
C-9
Appendix C
XML File Collection Plug-in Examples
</LargeFields>
<Name>SESSION_ID</Name>
<Name>ENTRY_ID</Name>
</MarkerField>
</FieldMappingInfo>
</AVXMLCollectorTemplate>
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
<?xml version="1.0"?>
<plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/av/plugin plugin-
manifest.xsd"
xmlns="http://xmlns.oracle.com/av/plugin"
name="Oracle-XML-Template"
id="com.oracle.av.plugin"
version="1.0"
C-10
Appendix C
XML File Collection Plug-in Examples
provider-name="Oracle Corp."
copyright="Copyright Oracle Corp. 2011">
<extensionSet>
<extensionPoint type= "securedTargetType">
<!-- fileList: Lists *all* the files that ship with the
plugin -->
<fileList>
<jars></jars>
<templates>
<include file="XMLSource-Mapper.xml"/>
</templates>
<bin></bin>
<config></config>
<shell></shell>
<patch></patch>
<unresolved-external></unresolved-external>
</fileList>
C-11
Appendix C
JSON File Collection Plug-in Example
Mandatory Attributes and Fields for JSON File Collection Plug-In Mapper Files
• securedTargetType
• maxSecuredTargetVersion
• version
• HeaderInfo
• RecordInfo
• EventTimeUTC
• CommandClass transformations
• EventStatus transformations
• MarkerField
C-12
Appendix C
JSON File Collection Plug-in Example
C-13
Appendix C
JSON File Collection Plug-in Example
C-14
Appendix C
JSON File Collection Plug-in Example
-->
<!-- Source fields specified in extension field mapping must be of
SQL Datatype:String OR convertible to String -->
<ExtensionField>
<Name>$.DB_ID</Name>
<Name>$.INSTANCE</Name>
<Name>$.PROCESS</Name>
<Name>$.TERMINAL</Name>
</ExtensionField>
<!-- This is group of source fields for uniquely identifying each
Audit Record Marker -->
<!-- Source fields specified to be used as Marker field mapping
must
be of SQL Datatype:String OR convertible to String -->
<!-- Mandatory: Source fields for MarkerField -->
<MarkerField>
<Name>$.SESSION_ID</Name>
<Name>$.ENTRY_ID</Name>
</MarkerField>
</FieldMappingInfo>
</AVJSONCollectorTemplate>
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
C-15
Appendix C
CSV File Collection Plug-in Example
Mandatory Attributes and Fields for CSV File Collection Plug-In Mapper Files
• securedTargetType
C-16
Appendix C
CSV File Collection Plug-in Example
• maxSecuredTargetVersion
• version
• HeaderInfo
• RecordInfo
• EventTimeUTC
• CommandClass transformations
• EventStatus transformations
• MarkerField
C-17
Appendix C
CSV File Collection Plug-in Example
<CoreFields>
<!-- In our CSV sample data, EVENT_TIME field has index 2 -->
<!-- Hence 2 is used in below EventTimeUTC mapping -->
<Map>
<Name>2</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</
TimestampPattern>
</Map>
<Map>
<!-- If UserName core field mapping is not provided, Audit
Data
Collection still starts successfully, but every audit record
will be treated as invalid -->
<Name>5</Name>
<MapTo>UserName</MapTo>
</Map>
<Map>
<!-- If source name, the ACTION field, for CommandClass
core field mapping is not provided, Audit Data Collection
still starts successfully, but all audit records are treated
as invalid -->
<Name>1</Name>
<MapTo>CommandClass</MapTo>
<!-- Mandatory: value transformations from source to Action
field value. Value of "to" Attribute is from AV Event set
-->
<Transformation>
<ValueTransformation from="createUser" to="CREATE" />
<ValueTransformation from="createCollection"
to="CREATE" />
<ValueTransformation from="authenticate"
to="AUTHENTICATE" />
<ValueTransformation from="dropCollection" to="DROP" />
<ValueTransformation from="dropUser" to="DROP" />
</Transformation>
</Map>
<Map>
<Name>1</Name>
<MapTo>TargetObject</MapTo>
<Transformation>
<FieldTransformation from="createUser" to="6" />
<FieldTransformation from="createCollection" to="6" />
<FieldTransformation from="authenticate" to="6" />
<FieldTransformation from="dropCollection" to="6" />
<FieldTransformation from="dropUser" to="6" />
</Transformation>
</Map>
C-18
Appendix C
CSV File Collection Plug-in Example
<Map>
<Name>1</Name>
<MapTo>TargetType</MapTo>
<Transformation>
<ValueTransformation from="createUser" to="USER" />
<ValueTransformation from="createCollection"
to="COLLECTION" />
<ValueTransformation from="authenticate" to="USER" />
<ValueTransformation from="dropCollection"
to="COLLECTION" />
<ValueTransformation from="dropUser" to="USER" />
</Transformation>
</Map>
<Map>
<Name>3</Name>
<MapTo>ClientIP</MapTo>
</Map>
<Map>
<Name>7</Name>
<MapTo>EventStatus</MapTo>
<!-- Specifying value transformation for Status source
field value.
Mandatory: EventStatus value transformation.
There are three possible values for EventStatus:
SUCCESS, FAILURE, UNKNOWN -->
<Transformation>
<ValueTransformation from="0" to="FAILURE" />
<ValueTransformation from="100" to="SUCCESS" />
<ValueTransformation from="200" to="UNKNOWN" />
</Transformation>
</Map>
</CoreFields>
<!-- Mapping of Source Fields to Large Fields of AV server i.e
fields
with huge content -->
<!-- Source fields specified in large field mappings must be of
SQL
Datatype:CLOB OR SQL Datatype:String OR convertible to String -->
<LargeFields>
<Map>
<Name>11</Name>
<MapTo>CommandText</MapTo>
</Map>
<Map>
<Name>12</Name>
<MapTo>CommandParam</MapTo>
</Map>
</LargeFields>
<!-- These Source fields will be collected in a single extension
field, all name-value pairs are separated by standard delimiter
-->
<!-- Source fields specified in extension field mapping must be of
SQL Datatype:String OR convertible to String -->
<ExtensionField>
C-19
Appendix C
CSV File Collection Plug-in Example
<ComplexName>
<Name>10</Name>
<DisplayName>sessionid</DisplayName>
</ComplexName>
<ComplexName>
<Name>13</Name>
<DisplayName>entryid</DisplayName>
</ComplexName>
</ExtensionField>
<!-- This is group of source fields for uniquely identifying each
Audit Record Marker -->
<!-- Source fields specified to be used as Marker field mapping
must
be of SQL Datatype:String OR convertible to String -->
<!-- Mandatory: Source fields for MarkerField -->
<MarkerField>
<Name>10</Name>
<Name>13</Name>
</MarkerField>
</FieldMappingInfo>
</AVCSVCollectorTemplate>
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
C-20
Appendix C
JSON REST Collection Plug-in Example
Mandatory Attributes and Fields for JSON REST Collection Plug-In Mapper Files
• securedTargetType
• maxSecuredTargetVersion
• version
• HeaderInfo
• RecordInfo
C-21
Appendix C
JSON REST Collection Plug-in Example
• EventTimeUTC
• CommandClass transformations
• EventStatus transformations
• MarkerField
• QueryFormat
• TimeFormat
• NextLinkStartTag
• NextLinkPattern
• RESTAuthentication
• BasicAuth
<!-- REST url corresponding to the the specific audit trail -->
<ResourceName>/audit_events/get_events/</ResourceName>
<!-- Header Information like JSON Header start tag -->
<HeaderInfo>
<!-- Mandatory: HeaderInfo-->
<!-- Value in this tag gives Root tag of the JSON audit file-->
<StartTag>ITEMS</StartTag>
</HeaderInfo>
<!-- Record Information like Record Start tag and conformation to
hold
original record -->
<RecordInfo>
<!-- Mandatory: RecordInfo -->
<!-- Provides starting tag of audit record in JSON audit file -->
<StartTag>SESSION_ID</StartTag>
</RecordInfo>
<!-- Details of the REST Service -->
C-22
Appendix C
JSON REST Collection Plug-in Example
<ServiceDetails>
<!-- Query format for providing the start time and end time query
parameters -->
<QueryFormat>{startTime}/{endTime}</QueryFormat>
<!-- Timestamp format for start time and end time -->
<TimeFormat>yyyy-MM-dd hh:mm:ss.SSS</TimeFormat>
<NextLink>
<!-- Next link start tag -->
<NextLinkStartTag>next</NextLinkStartTag>
<!-- Next link pattern -->
<NextLinkPattern>$.next.$ref</NextLinkPattern>
</NextLink>
<!-- Authentication mechanism for REST Service -->
<RESTAuthentication>
<!-- Username and password based Basic Authentication -->
<BasicAuth/>
</RESTAuthentication>
</ServiceDetails>
<!-- Gives Mapping Information of Source Fields to various AV Fields
(core and large fields) -->
<!-- Not Allowed: many-to-one mapping from source field to
AV Server fields -->
<FieldMappingInfo>
<!-- Mapping of Source Fields to Core Fields of AV server
Source fields specified in core field mappings must be of SQL
Datatype: String OR convertible to String -->
<CoreFields>
<Map>
<Name>$.EVENT_TIME</Name>
<MapTo>EventTimeUTC</MapTo>
<TimestampPattern>yyyy-MM-dd HH:mm:ss.SSS</TimestampPattern>
</Map>
<Map>
<!-- If UserName core field mapping is not provided, Audit
Data
Collection still starts successfully, but every audit record
will be treated as invalid -->
<Name>$.USER_ID</Name>
<MapTo>UserName</MapTo>
</Map>
<Map>
<Name>$.OS_USER_ID</Name>
<MapTo>OSUserName</MapTo>
</Map>
<Map>
<!-- If source name, the ACTION field, for CommandClass
core field mapping is not provided, Audit Data Collection
still starts successfully, but all audit records are treated
as invalid -->
<Name>$.ACTION</Name>
<MapTo>CommandClass</MapTo>
<!-- Mandatory: value transformations from source to Action
field value. Value of "to" Attribute is from AV Event set
-->
<Transformation>
C-23
Appendix C
JSON REST Collection Plug-in Example
C-24
Appendix C
JSON REST Collection Plug-in Example
-->
<!-- Source fields specified in extension field mapping must be of
SQL Datatype:String OR convertible to String -->
<ExtensionField>
<Name>$.DB_ID</Name>
<Name>$.INSTANCE</Name>
<Name>$.PROCESS</Name>
<Name>$.TERMINAL</Name>
</ExtensionField>
<!-- This is group of source fields for uniquely identifying each
Audit Record Marker -->
<!-- Source fields specified to be used as Marker field mapping
must
be of SQL Datatype:String OR convertible to String -->
<!-- Mandatory: Source fields for MarkerField -->
<MarkerField>
<Name>$.SESSION_ID</Name>
<Name>$.ENTRY_ID</Name>
</MarkerField>
</FieldMappingInfo>
</AVJSONCollectorTemplate>
Related Topics
• Audit Vault Server Fields
You can map Oracle Audit Vault and Database Firewall events and fields in your
collection plug-ins.
C-25
Appendix C
Java-Based Collection Plug-in Example
package oracle.av.plugin.sample.collector;
import oracle.av.platform.agent.collfwk.AuditEventCollector;
C-26
Appendix C
Java-Based Collection Plug-in Example
import oracle.av.platform.agent.collfwk.AuditEventCollectorException;
import oracle.av.platform.agent.collfwk.AuditEventCollectorFactory;
import oracle.av.platform.agent.collfwk.CollectorContext;
package oracle.av.plugin.sample.collector;
import java.io.Reader;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import oracle.av.platform.agent.collfwk.AuditEventCollector;
import oracle.av.platform.agent.collfwk.AuditEventCollectorException;
import oracle.av.platform.agent.collfwk.AuditService;
import oracle.av.platform.agent.collfwk.CollectorContext;
import oracle.av.platform.agent.collfwk.SetAttributeException;
import oracle.av.platform.common.ErrorCodes;
import oracle.av.platform.common.dao.ConnectionManager;
import oracle.av.platform.common.dao.ConnectionManagerImpl;
import oracle.av.platform.common.exception.AuditException;
import oracle.av.platform.common.util.AVLogger;
/**
* This collector collects events from AUD table and sends them to
Collection
* Framework. It connects to the Source database during initialization
and uses
* the same connection till close() is called. It maintains one
ResultSet
* containing events. Once the ResultSet gets exhausted, the Collector
sets a
* checkpoint and creates another ResultSet.
*
C-27
Appendix C
Java-Based Collection Plug-in Example
* @author myellu
*
*/
public class SampleEventCollector extends AuditEventCollector {
// This map contains mapping from the source event ids to Audit
Vault target
// types.
static {
targetTypeMap.put(1, "TABLE");
targetTypeMap.put(2, "TABLE");
targetTypeMap.put(3, "TABLE");
targetTypeMap.put(4, "CLUSTER");
targetTypeMap.put(15, "TABLE");
targetTypeMap.put(30, "OBJECT");
targetTypeMap.put(34, "DATABASE");
targetTypeMap.put(35, "DATABASE");
targetTypeMap.put(51, "USER");
targetTypeMap.put(52, "ROLE");
}
// This map contains mapping from the source event ids to Source
Event Names.
// This is necessary since source event ids do not describe the
Source Event.
private static final Map<Integer, String> sourceEventMap = new
HashMap<Integer,
String>();
static {
targetTypeMap.put(1, "OBJECT:CREATED:TABLE");
C-28
Appendix C
Java-Based Collection Plug-in Example
/**
* It connects to the database using the credentials and Connection
String
* from the CollectorContext.
*
* @throws AuditEventCollectorException
*/
private void connectToSource() throws AuditEventCollectorException {
m_logger.logDebugMethodEntered();
// Get connection information from collector context.
String user = m_collectorContext.getSecuredTargetUser();
String password = new
String(m_collectorContext.getSecuredTargetPassword());
String connectionString =
C-29
Appendix C
Java-Based Collection Plug-in Example
m_collectorContext.getSecuredTargetLocation();
// Create a ConnectionManager object.
try {
m_connectionManager = new
ConnectionManagerImpl(connectionString,
user, password.toCharArray());
m_connection = m_connectionManager.getConnection();
} catch (AuditException ex) {
throw new AuditEventCollectorException(
ErrorCodes.FAILED_CONNECT_TO_SOURCE,
new Object[] { connectionString }, ex);
}
m_logger.logDebugMethodExited();
}
/**
* converts the timone offset specified in String to a number of
* milliseconds.
*
*/
private long getTimeZoneOffsetInMs(String offset) {
if (offset == null)
return 0;
long timeZoneOffset;
/** process offset to get value in milliseconds */
int hour = Integer.parseInt(offset.substring(1, 3));
int min = Integer.parseInt(offset.substring(4, 6));
timeZoneOffset = (hour * 60 * 60 + min * 60) * 1000;
if (offset.charAt(0) == '-')
timeZoneOffset *= -1;
return timeZoneOffset;
}
/**
* Initializes the Collector with the values from CollectorContext.
It also
* connects to the database.
*/
public void initializeCollector(CollectorContext collectorContext)
throws AuditEventCollectorException {
m_collectorContext = collectorContext;
m_auditService = m_collectorContext.getAuditService();
m_previousCheckpoint = m_collectorContext.getCheckpoint();
m_logger = m_collectorContext.getLogger();
// Get the timone offset for the Source.
String offset = m_collectorContext.getAttribute("TimeZoneOffset");
if (offset != null) {
m_timeZoneOffset = getTimeZoneOffsetInMs(offset);
}
connectToSource();
fetchEvents();
}
/**
* Queries the Source to get audit events that occurred from previous
C-30
Appendix C
Java-Based Collection Plug-in Example
try {
m_connection = m_connectionManager.getConnection();
} catch (AuditException ex) {
throw new AuditEventCollectorException(
ErrorCodes.FAILED_TO_GET_CONNECTION_TO_DB, null, ex);
}
// Now we need to aim for the next checkpoint. We will query for
all
// events from previous checkpoint to the next checkpoint. So we
want to
// make sure that all the events with event time lesser than the
next
// checkpoint are already available in the table. However, the
events
// might take a small amount of time before they are present in
the table.
// Hence the next checkpoint we aim will be current time minus
C-31
Appendix C
Java-Based Collection Plug-in Example
delta time.
m_nextCheckpoint = new Timestamp(System.currentTimeMillis() -
DELAY);
String query = null;
try {
if (m_previousCheckpoint == null) {
query = "select * from AUD where EVENT_TIME <= ?";
m_preparedStatement = m_connection.prepareStatement(query);
m_preparedStatement.setTimestamp(1, m_nextCheckpoint);
} else {
query = "select * from AUD where EVENT_TIME > ? and
EVENT_TIME <= ?";
m_preparedStatement = m_connection.prepareStatement(query);
m_preparedStatement.setTimestamp(1, m_previousCheckpoint);
m_preparedStatement.setTimestamp(2, m_nextCheckpoint);
}
m_resultSet = m_preparedStatement.executeQuery();
} catch (SQLException ex) {
throw new AuditEventCollectorException(
ErrorCodes.ERROR_GETTING_DATA_FROM_SOURCE,
new Object[] { query }, ex);
}
m_logger.logDebugMethodExited();
}
/**
* If the result set is not exhausted this will return true. If it
has
* exhausted, it will query to get the events till the current time.
If it
* could get any events, it will return true, false otherwise.
*/
public boolean hasNext() throws AuditEventCollectorException {
boolean hasMore;
try {
if(m_resultSet == null) {
fetchEvents();
return m_resultSet.next();
}
hasMore = m_resultSet.next();
if (!hasMore) {
fetchEvents();
hasMore = m_resultSet.next();
}
} catch (SQLException ex) {
throw new AuditEventCollectorException(
ErrorCodes.ERROR_GETTING_DATA_FROM_SOURCE, null, ex);
}
return hasMore;
}
// All the getter methods make use of the ResultSet get methods and
return
// the value appropriately.
C-32
Appendix C
Java-Based Collection Plug-in Example
C-33
Appendix C
Java-Based Collection Plug-in Example
C-34
Appendix C
Java-Based Collection Plug-in Example
C-35
Appendix C
Java-Based Collection Plug-in Example
C-36
Appendix C
Java-Based Collection Plug-in Example
<plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/av/plugin plugin-
manifest.xsd"
xmlns="http://xmlns.oracle.com/av/plugin"
name="Sample Plugin"
id="com.oracle.av.plugin.sample"
version="12.1.0.0.0"
provider-name="Oracle Corp."
copyright="Copyright Oracle Corp. 2011">
<targetVersion min="12.1.0.0.0"/>
<extensionSet>
<extensionPoint type= "securedTargetType">
<!-- fileList: Lists *all* the files that ship with the plugin -->
<fileList>
<jars>
<include file="samplecollector.jar"/>
<!-- All your collector Java jar binaries go here -->
</jars>
<templates>
<bin>
<!-- All your collector native binaries go here -->
</bin>
<config>
<!-- Any configuration information (such as .properites files)
go here -->
</config>
<shell>
<!-- Any shell scripts that your collector relies on go here -->
</shell>
<patch>
<!-- Oracle provided patches go here -->
</patch>
<unresolved-external>
<!-- Any files belonging to the unresolved-external category here
C-37
Appendix C
Java-Based Collection Plug-in Example
-->
</unresolved-external>
</fileList>
<!-- securedTargetTypeInfo: Contains source type and trail
information
-->
<securedTargetTypeInfo name="Sample"/>
<!-- trailType: contains trail type, location , classname for
source type testSource -->
<trailInfo>
<trailType>TABLE</trailType>
<className
name="oracle.av.plugin.sample.collector.SampleEventCollectorFactory" />
</trailInfo >
</extensionPoint>
</extensionSet>
</plugin>
C-38
D
Bundled JDBC Drivers
Learn about the JDBC drivers that are bundled with the Oracle Audit Vault and
Database Firewall (Oracle AVDF) SDK.
• About Bundled JDBC Drivers
Learn about the five JDBC drivers that are bundled with Oracle Audit Vault and
Database Firewall.
• Connecting URLs
Use the correct Connection URL for the type of JDBC driver that you use with
Oracle Audit Vault and Database Firewall.
• DataSource Class
To enable a Java application to interact with the Oracle Audit Vault platform, use
this JDBC DataSource class.
D-1
Appendix D
Connecting URLs
jdbc:av:[sqlserver]://hostname: port;
[EncryptionMethod=encryptionmethod].
Use this url to register a Target, by entering it into the Target Location field, with the
Advanced mode selected.
Related Topics
• About Bundled JDBC Drivers
Learn about the five JDBC drivers that are bundled with Oracle Audit Vault and
Database Firewall.
• Creating a Database Table Mapper File
Learn how to create an Oracle Audit Vault XML mapper file for a database table
collection plug-in, and learn about each XML element and attribute used in this
type of mapper file.
See Also:
Target Connection Information block in "Creating a Database Table Mapping
File. Creating a Database Table Mapper File.
D-2
Appendix D
DataSource Class
D-3
Glossary
audit record
A record that represents a database event.
audit trail
A location of audit records on the secured target. For example:
• If the secured target writes audit records into files (called audit files), then the
directory path plus the file mask is an audit trail.
• If the source writes audit records into a database table (called an audit table),
then the name of the table is an audit trail.
• If the source writes some audit records into files of directory x, some into database
table y, and some into files of directory z, then the source has three different audit
trails: directory x plus the file mask, table y, and directory z plus the file mask.
checkpoint
The point in an audit trail after which a collection plug-in will start collecting audit
records. If the collection plug-in has collected no records from the audit trail, then
the checkpoint is immediately before the first record. If the collection plug-in started
Glossary-1
Glossary
collecting records and then stopped, then the checkpoint is immediately after the last
record that it collected.
collection plug-in
A plug-in that adds an audit trail collection capability to Oracle Audit Vault and
Database Firewall. It gets audit record semantics from a mapper file and reads audit
records from either an audit table or XML audit files.
core field
An Audit Vault Server field that has a corresponding field in audit records generated
by almost every source. That is, almost every collection plug-in maps a source audit
record field to each core field. Oracle Audit Vault and Database Firewall uses core
fields for filtering and reporting. The core fields are described and listed in "Core
Fields".
extension field
An Audit Vault Server field that is not a core field but must be stored in Oracle Audit
Vault Server.
large field
An Audit Vault Server field of the data type CLOB (described in Oracle Database SQL
Language Reference). A large field is either a Command Text field or a Command
Parameter field.
mapper file
An XML file that describes the audit records that a specific secured target writes into
either an audit table or XML audit files. The mapper file specifies the audit record
fields to collect from the source, how to map them to Audit Vault Server fields, and
which fields to use for recovery. A mapper file always specifies the secured target, the
maximum version of the source type that the mapper file supports, and the mapper file
version. A mapper file can also specify the minimum version of the source type that
it supports and an incremental field for calculating the checkpoint. The default for the
incremental field is the event time field.
Glossary-2
Glossary
Marker field
An audit record field that uniquely identifies the record within an audit trail. An
collection plug-in uses marker fields to avoid collecting duplicate records during
recovery.
plug-in
An application that adds a capability to another application (and usually cannot run
independently).
recovery
The phase of data collection where an collection plug-in that stopped and restarted
tries to reach its checkpoint. Resuming collection immediately after the checkpoint
ensures that the collector does not miss any records. To avoid collecting duplicate
records during recovery, the collector checks the Marker field of each record.
secured target
A secured target is a supported database or non-database product that you secure
using an Audit Vault Agent, a Database Firewall, or both.
Glossary-3
Index
A AVDF large fields, A-2
AVLogger API, 4-30
about Audit Collection Plug-ins, 3-1 avpack tool
about XML mapper files, 3-2 how to use, 5-5
Action fields, A-4
actions and target types, A-3
agents
C
deploying, 6-3 checkpoint
redeploying, 6-4 of a trail, 1-11
audit collection plug-in clean-up
packaging, 5-1 audit trail, 1-12
setting up development environment for, 2-1 closing Java-based collection plug-ins, 4-21
audit collection plug-ins CollectContext class, 4-8
types of, 1-3 collection concepts, 1-10
audit collection Plug-ins collection phase, 1-10
determining which to use, 1-4 collection plug-in
Audit Collection Plug-ins, 3-1 directory structure, 2-4
audit records, 1-5 Java-based
storing, 1-7 See Java-based collection plug-in, 1-4
audit trail, 1-2 upgrading (creating new versions), 5-3
clean-up, 1-12 collection plug-in directory structure, 2-2
audit trail cleanup collection plug-in example
Java-based collection plug-ins, 4-31 CSV, C-16
Audit Vault Agent Java file, C-26
deploying, 6-3 JSON, C-12
how it works, 1-2 JSON REST, C-21
Audit Vault and Database Firewall core fields, A-1 XML file, C-6
Audit Vault and Database Firewall fields, A-1 collection plug-in manifest file
Audit Vault and Database Firewall SDK CSV file, C-20
downloading, 2-2 JSON file, C-15
Audit Vault Server JSON REST, C-25
how it works, 1-2 XML file, C-10
Audit Vault Server events collection plug-in mapper file
about, 1-5 CSV file, C-16
Audit Vault Server fields JSON file, C-12
about, 1-5 JSON REST, C-21
AuditEventCollectorException exception, 4-22 XML file, C-7
AuditEventCollectorFactory, 4-7 collection plug-ins
av.collector.atcintervaltime, 3-46 what are they?, 1-3
av.collector.securedtargetversion (Mandatory), collection process
3-46 overview of the whole process, 1-8
av.collector.timezoneoffset (Mandatory), 3-46 collection thread, 1-10
avcli commands, 6-1 ConnectionManager API, 4-24
AVCLI commands, 3-46 creating a database table mapper file, 3-5
AVDF extension fields, A-3
Index-1
Index
creating the CSV file audit collection mapper file, EventMetaData API, 4-29
3-33 example
creating the JSON file audit collection mapper database table collection plug-in, C-1
file, 3-26 example audit trail for a CSV file collection plug-
creating the JSON REST audit collection mapper in, 3-31
file, 3-41 example audit trail for a database table collection
creating the XML file audit collection mapper file, plug-in, 3-4
3-14 example audit trail for a JSON file collection plug-
CSV file audit collection mapper file in, 3-24
creating, 3-33 example audit trail for a JSON REST collection
CSV file collection plug-in plug-in, 3-39
example audit trail for, 3-31 example audit trail for an xml file collection plug-
CSV file collection plug-in example, C-16 in, 3-13
CSV file collection plug-in manifest file, C-20 exceptions
CSV file collection plug-in mapper file, C-16 AuditEventCollectorException, 4-22
schema, B-8 SetAttributeException, 4-22
CSV file collection plug-ins, 3-30 types the collection plug-in can throw, 4-22
requirements for, 3-31 extension fields, A-3
external dependencies, 5-2
ezcollector plug-in mapper file
D schema, B-17
data collection
recovery phase, 1-11 F
database table collection plug-in example, C-1
database table collection plug-in manifest file, fields, large, 4-20
C-5 flow of control
database table collection plug-in mapper file, B-4, inside the collection plug-in, 1-9
C-1 flow of packaging, 5-1
database table collection plug-ins, 3-3
requirements, 3-3
database table mapper file
G
creating, 3-5 general procedure
deploy plugin command, 5-3 for writing collection plug-is, 1-12
deploying an Oracle Audit Vault Agent, 6-3
development environment, 2-2
directory structure, 2-3, 2-4 H
Java-based collection plug-in, 2-4 handling large fields, 4-20
plugin-manifest.xml file staging, 2-5
requirements, 2-1
setting up, 2-2 I
directory structure
initializing the collector plug-in, 4-10
collection plug-in, 2-2
collection plug-ins, 2-2
general, 2-3 J
Java-based audit collection plug-in
E directory structure, 2-4
writing, 4-1
errors
Java-Based Collection Plug-in, 4-2
exception to use, 4-22
Java-based collection plug-ins
unrecoverable condition, 4-22
about, 4-1
event logs
about creating, 4-6
Java-based collection plug-ins, 4-26
audit trail cleanup, 4-31
Windows, 4-26
classes and interfaces, useful, 4-3
Event Time to UTC, 4-14
closing, 4-21
EventLog API, 4-26
Index-2
Index
Index-3
Index
T
target, 1-2
Index-4