Files
doc-exports/docs/cfw/api-ref/AddLogConfig.html
qiaoli 9776db0ee8 First version of the CFW API
Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qiaoli <qiaoli@huawei.com>
Co-committed-by: qiaoli <qiaoli@huawei.com>
2025-01-21 07:59:01 +00:00

255 lines
19 KiB
HTML

<a name="AddLogConfig"></a><a name="AddLogConfig"></a>
<h1 class="topictitle1">Adding Log Configurations</h1>
<div id="body1708331107508"><div class="section" id="AddLogConfig__section11505121720331"><h4 class="sectiontitle">Function</h4><p id="AddLogConfig__p125051917183318">This API is used to add log configurations.</p>
</div>
<div class="section" id="AddLogConfig__section10506817163320"><h4 class="sectiontitle">URI</h4><p id="AddLogConfig__p2506517123320">POST /v1/{project_id}/cfw/logs/configuration</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__table1050621723312" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path Parameters</caption><thead align="left"><tr id="AddLogConfig__row150671793316"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.1"><p id="AddLogConfig__p8506121733311">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.2"><p id="AddLogConfig__p95074178339">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.3"><p id="AddLogConfig__p1250721713312">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.2.3.2.5.1.4"><p id="AddLogConfig__p55071317163314">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row14506141712338"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="AddLogConfig__p75071617173317">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="AddLogConfig__p450720178334">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="AddLogConfig__p9507717173311">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="AddLogConfig__p14507317133318">Project ID, which can be obtained by calling an API or from the console. For details, see <a href="cfw_02_0015.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__table195071917143310" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Query Parameters</caption><thead align="left"><tr id="AddLogConfig__row150701715333"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.4.2.5.1.1"><p id="AddLogConfig__p150818171332">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.4.2.5.1.2"><p id="AddLogConfig__p650811711333">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.4.2.5.1.3"><p id="AddLogConfig__p11508131712333">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.2.4.2.5.1.4"><p id="AddLogConfig__p9508517163315">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row2507131753319"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.1 "><p id="AddLogConfig__p15508617143317">fw_instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.2 "><p id="AddLogConfig__p950811172331">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.3 "><p id="AddLogConfig__p2508171763310">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.4.2.5.1.4 "><p id="AddLogConfig__p3508917163319">Firewall ID, which can be obtained by referring to <a href="cfw_02_0028.html">Obtaining a Firewall ID</a>.</p>
</td>
</tr>
<tr id="AddLogConfig__row65075172333"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.1 "><p id="AddLogConfig__p8508191711331">enterprise_project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.2 "><p id="AddLogConfig__p145081217153316">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.4.2.5.1.3 "><p id="AddLogConfig__p45092172337">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.4.2.5.1.4 "><p id="AddLogConfig__p25091173338">Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to <a href="cfw_02_0027.html">Obtaining an Enterprise Project ID</a>. If the enterprise project function is not enabled, the value is <strong id="AddLogConfig__b11509161717339">0</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="AddLogConfig__section1450991783315"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__HeaderParameter" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Request header parameters</caption><thead align="left"><tr id="AddLogConfig__row18509191703312"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.1"><p id="AddLogConfig__p1350921733318">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.2"><p id="AddLogConfig__p9509111712335">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.3"><p id="AddLogConfig__p25091178338">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.3.2.2.5.1.4"><p id="AddLogConfig__p17510181723316">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row175092017153314"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="AddLogConfig__p55101517143312">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="AddLogConfig__p9510201718337">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="AddLogConfig__p175100176334">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="AddLogConfig__p4510191773316">User token. You can obtain the token by referring to <a href="cfw_02_0029.html">Obtaining a User Token</a>.</p>
</td>
</tr>
<tr id="AddLogConfig__row15154534113320"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="AddLogConfig__p16987185572214">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="AddLogConfig__p1453216872313">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="AddLogConfig__p598785514223">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="AddLogConfig__p1821149193417">Content type. It can only be set to application/json.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__request_LogConfigDto" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Request body parameters</caption><thead align="left"><tr id="AddLogConfig__row1551051713331"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.3.2.5.1.1"><p id="AddLogConfig__p17511101716338">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.3.2.5.1.2"><p id="AddLogConfig__p05111517153318">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.3.2.5.1.3"><p id="AddLogConfig__p14511151711333">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.3.3.2.5.1.4"><p id="AddLogConfig__p10511111733311">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row125100178338"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p5511191733315">fw_instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p185111117153314">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p85125175331">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p115121017183318">Firewall ID, which can be obtained by referring to <a href="cfw_02_0028.html">Obtaining a Firewall ID</a>.</p>
</td>
</tr>
<tr id="AddLogConfig__row15510101716334"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p20512111717332">lts_enable</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p251251712334">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p951221743311">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p75121817133318">Whether to enable LTS: <strong id="AddLogConfig__b1951212179331">1</strong> (yes), <strong id="AddLogConfig__b951213178333">0</strong> (no).</p>
</td>
</tr>
<tr id="AddLogConfig__row25101917163318"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p8512151713316">lts_log_group_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p1951261716331">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p155121117163311">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p135121717163320">Log Tank Service (LTS) log group ID, which can be obtained by calling the API for querying all the log groups of an account in LTS. Find the value in <strong id="AddLogConfig__b4512617133313">log_groups.log_group_id</strong> (The period [.] is used to separate different levels of objects).</p>
</td>
</tr>
<tr id="AddLogConfig__row65102175331"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p8512817173317">lts_attack_log_stream_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p751381715331">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p1151361718332">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p65131717143318">Attack log stream ID, which can be obtained by calling the API for querying all the log streams in a specified log group in LTS. Find the value in <strong id="AddLogConfig__b18513121763316">log_streams.log_stream_id</strong> (The period [.] is used to separate different levels of objects).</p>
</td>
</tr>
<tr id="AddLogConfig__row15104174332"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p115131517143311">lts_attack_log_stream_enable</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p25131817103313">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p7513517103310">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p851311173331">Whether to enable the attack log stream: <strong id="AddLogConfig__b1151391715339">1</strong> (yes), <strong id="AddLogConfig__b651391718337">0</strong> (no).</p>
</td>
</tr>
<tr id="AddLogConfig__row7510111733317"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p051351773310">lts_access_log_stream_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p751315171335">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p251341710333">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p3513161714333">Access control log stream ID, which can be obtained by calling the API for querying all the log streams in a specified log group in LTS. Find the value in <strong id="AddLogConfig__b19513121711330">log_streams.log_stream_id</strong> (The period [.] is used to separate different levels of objects).</p>
</td>
</tr>
<tr id="AddLogConfig__row0511161703318"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p16513201710331">lts_access_log_stream_enable</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p115141717143316">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p125141717153318">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p3514111719335">Whether to enable the access control stream: <strong id="AddLogConfig__b25141317183319">1</strong> (yes), <strong id="AddLogConfig__b951451773318">0</strong> (no).</p>
</td>
</tr>
<tr id="AddLogConfig__row25112173334"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p95142017153320">lts_flow_log_stream_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p19514017183312">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p2514151713317">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p5514617173316">Traffic log ID, which can be obtained by calling the API for querying all the log streams in a specified log group in LTS. Find the value in <strong id="AddLogConfig__b45141717163319">log_streams.log_stream_id</strong> (The period [.] is used to separate different levels of objects).</p>
</td>
</tr>
<tr id="AddLogConfig__row15511121703317"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.1 "><p id="AddLogConfig__p11514417173311">lts_flow_log_stream_enable</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.2 "><p id="AddLogConfig__p1051410174335">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.3.2.5.1.3 "><p id="AddLogConfig__p35148179335">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.3.2.5.1.4 "><p id="AddLogConfig__p115141917143318">Whether to enable the traffic log function: <strong id="AddLogConfig__b1051411174333">1</strong> (yes), <strong id="AddLogConfig__b14514517193311">0</strong> (no).</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="AddLogConfig__section951551773318"><h4 class="sectiontitle">Response Parameters</h4><p id="AddLogConfig__p1515171783311"><strong id="AddLogConfig__b105152017143313">Status code: 200</strong></p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__response_AddLogConfigResponseBody" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Response body parameters</caption><thead align="left"><tr id="AddLogConfig__row051541711337"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.4.1.1"><p id="AddLogConfig__p6515101773315">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.4.1.2"><p id="AddLogConfig__p125151117173314">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.4.3.2.4.1.3"><p id="AddLogConfig__p12515201714334">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row951561793317"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.4.1.1 "><p id="AddLogConfig__p9515161733315">data</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.4.1.2 "><p id="AddLogConfig__p2515191719334">String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.3.2.4.1.3 "><p id="AddLogConfig__p1051611703312">Return value for adding log configurations. The value is the firewall ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="AddLogConfig__section165169176338"><h4 class="sectiontitle">Example Requests</h4><p id="AddLogConfig__p151651714330">Add log stream configurations for firewall 4d6c860a-0338-49e8-ac64-fcaeb4182ba5 in project 408972e72dcd4c1a9b033e955802a36b. The LTS group ID is 20282428-a8f9-4e75-8246-165e64cf8ba8. The access control log stream, traffic log stream, attack log stream, and LTS are disabled.</p>
<pre class="screen" id="AddLogConfig__screen8516017103318">https://{Endpoint}/v1/408972e72dcd4c1a9b033e955802a36b/cfw/logs/configuration?fw_instance_id=4d6c860a-0338-49e8-ac64-fcaeb4182ba5&amp;enterprise_project_id=default
{
"fw_instance_id" : "4d6c860a-0338-49e8-ac64-fcaeb4182ba5",
"lts_enable" : 0,
"lts_log_group_id" : "20282428-a8f9-4e75-8246-165e64cf8ba8",
"lts_attack_log_stream_enable" : 0,
"lts_access_log_stream_enable" : 0,
"lts_flow_log_stream_enable" : 0
}</pre>
</div>
<div class="section" id="AddLogConfig__section75161175333"><h4 class="sectiontitle">Example Responses</h4><p id="AddLogConfig__p65171417183316"><strong id="AddLogConfig__b165172173334">Status code: 200</strong></p>
<p id="AddLogConfig__p4517131723314">Return value for adding log configurations.</p>
<pre class="screen" id="AddLogConfig__screen2517121733313">{
"data" : "4d6c860a-0338-49e8-ac64-fcaeb4182ba5"
}</pre>
</div>
<div class="section" id="AddLogConfig__section1764011717336"><h4 class="sectiontitle">Status Codes</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="AddLogConfig__status_code" frame="border" border="1" rules="all"><thead align="left"><tr id="AddLogConfig__row95261517133312"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.7.2.1.3.1.1"><p id="AddLogConfig__p146408171332">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85%" id="mcps1.3.7.2.1.3.1.2"><p id="AddLogConfig__p1464081783313">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="AddLogConfig__row17526171723313"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="AddLogConfig__p9640101714338">200</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="AddLogConfig__p9640131753313">Return value for adding log configurations.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="AddLogConfig__section15640517193314"><h4 class="sectiontitle">Error Codes</h4><p id="AddLogConfig__p13640417123314">See <a href="ErrorCode.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="topic_300000008.html">Log Management</a></div>
</div>
</div>