forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com> Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
122 lines
10 KiB
HTML
122 lines
10 KiB
HTML
<a name="dds_api_0097"></a><a name="dds_api_0097"></a>
|
|
|
|
<h1 class="topictitle1">Setting SQL Audit</h1>
|
|
<div id="body0000001071476561"><div class="section" id="dds_api_0097__section4850156117316"><h4 class="sectiontitle">Function</h4><p id="dds_api_0097__p3631239417316">This API is used to set a policy for SQL audit logs.</p>
|
|
</div>
|
|
<div class="section" id="dds_api_0097__section28961517113719"><h4 class="sectiontitle">URI</h4><ul id="dds_api_0097__ul3084351717316"><li id="dds_api_0097__li915620217316">URI format<p id="dds_api_0097__p912862005412"><a name="dds_api_0097__li915620217316"></a><a name="li915620217316"></a>POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/auditlog-policy</p>
|
|
</li><li id="dds_api_0097__li15430535">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dds_api_0097__table4657088" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="dds_api_0097__row60083059"><th align="left" class="cellrowborder" valign="top" width="24%" id="mcps1.3.2.2.2.1.2.4.1.1"><p id="dds_api_0097__p34889605">Name</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="24.9%" id="mcps1.3.2.2.2.1.2.4.1.2"><p id="dds_api_0097__p7485743">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="51.1%" id="mcps1.3.2.2.2.1.2.4.1.3"><p id="dds_api_0097__p2775334615440">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dds_api_0097__row57385070"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="dds_api_0097__p732920567115">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.9%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="dds_api_0097__p532935613116">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.1%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="dds_api_0097__p4329756415">Specifies the project ID of a tenant in a region.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dds_api_0097__row2864326155157"><td class="cellrowborder" valign="top" width="24%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="dds_api_0097__p963319528116">instance_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="24.9%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="dds_api_0097__p1032910565114">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.1%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="dds_api_0097__p15330656516">Specifies the instance ID, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dds_api_0097__section3074340117316"><h4 class="sectiontitle">Requests</h4><ul id="dds_api_0097__ul5099287616954"><li id="dds_api_0097__li5628270116954">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dds_api_0097__table3678226816954" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="dds_api_0097__row1340482316954"><th align="left" class="cellrowborder" valign="top" width="17.169999999999998%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="dds_api_0097__p1204887716954">Name</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.75%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="dds_api_0097__p15184124818564">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="21.64%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="dds_api_0097__p3643495116954">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="43.44%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="dds_api_0097__p222501215320">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dds_api_0097__row794180116954"><td class="cellrowborder" valign="top" width="17.169999999999998%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dds_api_0097__p1549614164493">keep_days</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.75%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dds_api_0097__p107333911419">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.64%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dds_api_0097__p18748396418">Integer</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.44%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dds_api_0097__p0256113412491">Specifies the number of days for storing audit logs. The value can be 0 or ranges from 7 to 732.</p>
|
|
<ul id="dds_api_0097__ul122569342493"><li id="dds_api_0097__li225663418497"><strong id="dds_api_0097__b1868614685311">0</strong>: indicates that SQL audit is disabled.</li><li id="dds_api_0097__li22561734114915"><strong id="dds_api_0097__b1918762914543">7</strong> to <strong id="dds_api_0097__b15825834185418">732</strong>: indicates the retention days for audit logs after SQL audit is enabled.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="dds_api_0097__row8551715205814"><td class="cellrowborder" valign="top" width="17.169999999999998%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dds_api_0097__p18744391445">reserve_auditlogs</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.75%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dds_api_0097__p18743391446">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.64%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dds_api_0097__p374439545">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.44%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dds_api_0097__p414064310115">This parameter is valid only when SQL audit is disabled.</p>
|
|
<ul id="dds_api_0097__ul01405431219"><li id="dds_api_0097__li314044320114"><strong id="dds_api_0097__b1965001612211">true</strong> (default value): indicates that historical audit logs are retained when SQL audit is disabled.</li><li id="dds_api_0097__li9141124314113"><strong id="dds_api_0097__b1799514200213">false</strong>: indicates that existing historical audit logs are deleted when SQL audit is disabled.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="dds_api_0097__row4819194332716"><td class="cellrowborder" valign="top" width="17.169999999999998%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dds_api_0097__p429919714541">audit_scope</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.75%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dds_api_0097__p12819194310278">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.64%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dds_api_0097__p1481911435278">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.44%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dds_api_0097__p1681410073613">This parameter is valid only when the audit log policy is enabled. If this parameter is left blank or set to <strong id="dds_api_0097__b69621746181116">all</strong>, all audit log policies are enabled by default.</p>
|
|
<p id="dds_api_0097__p14650829175520">Audit scope:</p>
|
|
<p id="dds_api_0097__p61891936155517">Enter the database or collection name. Use commas (,) to separate multiple databases or collections. If the name contains a comma (,), add a dollar sign ($) before the comma to distinguish it from the separators.</p>
|
|
<p id="dds_api_0097__p13819043142718">Enter a maximum of 1024 characters. The value cannot contain spaces or the following special characters "[]{}():? The dollar sign ($) can be used only in escape mode.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dds_api_0097__row5407134612273"><td class="cellrowborder" valign="top" width="17.169999999999998%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="dds_api_0097__p1435011171543">audit_types</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.75%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="dds_api_0097__p7408146202715">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.64%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="dds_api_0097__p1408144612273">Array of strings</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.44%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="dds_api_0097__p198071038123110">This parameter is valid only when the audit log policy is enabled. If this parameter is left blank, all audit log policies are enabled by default.</p>
|
|
<p id="dds_api_0097__p857215012403">Specifies the audit type. The value is <strong id="dds_api_0097__b6170185020122">auth</strong>, <strong id="dds_api_0097__b1252193871616">insert</strong>, <strong id="dds_api_0097__b3986639141612">delete</strong>, <strong id="dds_api_0097__b1724019465165">update</strong>, <strong id="dds_api_0097__b448019487166">query</strong>, or <strong id="dds_api_0097__b143931927135">command</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="dds_api_0097__ul1041877316954"><li id="dds_api_0097__li2666010016954">Request example<div class="p" id="dds_api_0097__p1847217618548"><a name="dds_api_0097__li2666010016954"></a><a name="li2666010016954"></a>POST https://dds.eu-de.otc.t-systems.com/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/5cecca4c20e04146862651b8d385f26ain02/auditlog-policy<ul id="dds_api_0097__ul1727315175414"><li id="dds_api_0097__li327325165419">Enabling or updating the audit log policy<pre class="codeblock" id="dds_api_0097__codeblock7273256541">{
|
|
"keep_days": 7,
|
|
"audit_scope": "all",
|
|
"audit_types": [
|
|
"insert"
|
|
]
|
|
}</pre>
|
|
</li><li id="dds_api_0097__li1027314510545">Disabling the policy for SQL audit logs:<pre class="codeblock" id="dds_api_0097__codeblock22731852547">{
|
|
"keep_days": 0,
|
|
"reserve_auditlogs": false
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dds_api_0097__section16467022161012"><h4 class="sectiontitle">Responses</h4><div class="p" id="dds_api_0097__p44677221101">Response example<pre class="codeblock" id="dds_api_0097__codeblock1467112212108">{}</pre>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dds_api_0097__section5382712154838"><h4 class="sectiontitle">Status Code</h4><p id="dds_api_0097__dds_api_0018_p16131712193312">Status Code:200.</p>
|
|
<p id="dds_api_0097__dds_api_0018_p480617135329">For more information, see <a href="dds_status_code.html">Status Code</a>.</p>
|
|
</div>
|
|
<div class="section" id="dds_api_0097__section6522193710339"><h4 class="sectiontitle">Error Code</h4><p id="dds_api_0097__dds_api_0018_p20466124120334">For more information, see <a href="dds_error_code.html">Error Code</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dds_api_0092.html">Log Information Queries</a></div>
|
|
</div>
|
|
</div>
|
|
|