doc-exports/docs/fg/umn/functiongraph_01_1841.html
Chen, Junjie dac566cf2f FG UMN 20230725 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2024-04-03 10:30:56 +00:00

54 lines
9.5 KiB
HTML

<a name="functiongraph_01_1841"></a><a name="functiongraph_01_1841"></a>
<h1 class="topictitle1">Configuring a Log Group and Log Stream</h1>
<div id="body32001227"><div class="note" id="functiongraph_01_1841__en-us_topic_0000001525506617_note192252912371"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p172392963711">This feature is supported only by FunctionGraph V2.</p>
</div></div>
<div class="section" id="functiongraph_01_1841__en-us_topic_0000001525506617_section8760134211306"><h4 class="sectiontitle">Introduction</h4><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p1087211123816">You can bind a log group and log stream to a function to store its invocation logs. By default, the logs are stored in the log stream automatically created for the function. For details, see <a href="functiongraph_01_1834.html#functiongraph_01_1834__en-us_topic_0000001251924344_section15548615132812">Using LTS to Manage Function Logs</a>.</p>
</div>
<div class="section" id="functiongraph_01_1841__en-us_topic_0000001525506617_section197112582305"><h4 class="sectiontitle">Prerequisites</h4><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p475215364183">You have created a log group and log stream on the LTS console.</p>
</div>
<div class="section" id="functiongraph_01_1841__en-us_topic_0000001525506617_section338271419316"><h4 class="sectiontitle">Procedure</h4><ol id="functiongraph_01_1841__en-us_topic_0000001525506617_ol9811413615"><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li1492244763210">Log in to the FunctionGraph console. In the navigation pane, choose <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_en-us_topic_0000001251907924_b033610517502">Functions</strong> &gt; <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_en-us_topic_0000001251907924_b183361950502">Function List</strong>.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li16939810113319">Click the function to be configured to go to the function details page.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li371511346209">Choose <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b1375182771">Configuration</strong> &gt; <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b55171841716">Log</strong>, and configure log collection according to <a href="#functiongraph_01_1841__en-us_topic_0000001525506617_table71231511153518">Table 1</a>.
<div class="tablenoborder"><a name="functiongraph_01_1841__en-us_topic_0000001525506617_table71231511153518"></a><a name="en-us_topic_0000001525506617_table71231511153518"></a><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_1841__en-us_topic_0000001525506617_table71231511153518" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Log configuration parameters</caption><thead align="left"><tr id="functiongraph_01_1841__en-us_topic_0000001525506617_row3124211173513"><th align="left" class="cellrowborder" valign="top" width="30.59%" id="mcps1.3.4.2.3.4.2.3.1.1"><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p112411119351">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="69.41000000000001%" id="mcps1.3.4.2.3.4.2.3.1.2"><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p4124161110356">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="functiongraph_01_1841__en-us_topic_0000001525506617_row191241611183516"><td class="cellrowborder" valign="top" width="30.59%" headers="mcps1.3.4.2.3.4.2.3.1.1 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p812431115351">Collect Logs</p>
</td>
<td class="cellrowborder" valign="top" width="69.41000000000001%" headers="mcps1.3.4.2.3.4.2.3.1.2 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p1112412112350">Enabled by default in FunctionGraph V2. This feature is unavailable for FunctionGraph V1.</p>
</td>
</tr>
<tr id="functiongraph_01_1841__en-us_topic_0000001525506617_row11124171113510"><td class="cellrowborder" valign="top" width="30.59%" headers="mcps1.3.4.2.3.4.2.3.1.1 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p1112431123519">Log Group</p>
</td>
<td class="cellrowborder" valign="top" width="69.41000000000001%" headers="mcps1.3.4.2.3.4.2.3.1.2 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p2098127112915">Select a log group for the function. The default log group <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b4455883319">functiongraph.log.group.</strong><em id="functiongraph_01_1841__en-us_topic_0000001525506617_i205012001345">xxx</em> cannot be selected.</p>
<p id="functiongraph_01_1841__en-us_topic_0000001525506617_p631819593166">By default, the log group (starting with <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b1134316397549">functiongraph</strong>) automatically generated by FunctionGraph is selected.</p>
</td>
</tr>
<tr id="functiongraph_01_1841__en-us_topic_0000001525506617_row7124191116359"><td class="cellrowborder" valign="top" width="30.59%" headers="mcps1.3.4.2.3.4.2.3.1.1 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p191248117355">Log Stream</p>
</td>
<td class="cellrowborder" valign="top" width="69.41000000000001%" headers="mcps1.3.4.2.3.4.2.3.1.2 "><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p0486134654719">Select a log stream in the specified log group.</p>
<p id="functiongraph_01_1841__en-us_topic_0000001525506617_p9340722202111">By default, the log stream (starting with the function name) automatically generated for the function is selected.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li3799161520619">Click <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b199441442121018">Save</strong>.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li1641634418618">After the function is invoked, <a href="#functiongraph_01_1841__en-us_topic_0000001525506617_section68074783519">view logs</a> in the specified log group and log stream.<div class="note" id="functiongraph_01_1841__en-us_topic_0000001525506617_note8604145424011"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p860595494011">You can change the log stream if needed.</p>
</div></div>
</li></ol>
</div>
<div class="section" id="functiongraph_01_1841__en-us_topic_0000001525506617_section68074783519"><a name="functiongraph_01_1841__en-us_topic_0000001525506617_section68074783519"></a><a name="en-us_topic_0000001525506617_section68074783519"></a><h4 class="sectiontitle">Viewing Function Logs</h4><p id="functiongraph_01_1841__en-us_topic_0000001525506617_p1280114743512">View function logs in the specified log group and log stream.</p>
<ol id="functiongraph_01_1841__en-us_topic_0000001525506617_ol48064713516"><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li43131042155819">Return to the FunctionGraph console. In the navigation pane, choose <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b207798097091518">Functions</strong> &gt; <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b124979086091518">Function List</strong>.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li7819477357">Click the function to be configured to go to the function details page.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li181247203512">Choose <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b1698323114569">Monitoring</strong> &gt; <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b0983431185618">Logs</strong> and view the function logs.<ul id="functiongraph_01_1841__en-us_topic_0000001525506617_ul138144712354"><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li19811147123514">As shown in <a href="#functiongraph_01_1841__en-us_topic_0000001525506617_fig3273153215525">Figure 1</a>, logs of the function are generated in the specified log group and log stream.</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li18164710359">If no custom log group and log stream are specified, the default log group (starting with <strong id="functiongraph_01_1841__en-us_topic_0000001525506617_b19874194815564">functiongraph</strong>) and log stream are displayed.<div class="fignone" id="functiongraph_01_1841__en-us_topic_0000001525506617_fig3273153215525"><a name="functiongraph_01_1841__en-us_topic_0000001525506617_fig3273153215525"></a><a name="en-us_topic_0000001525506617_fig3273153215525"></a><span class="figcap"><b>Figure 1 </b>Viewing function logs</span><br><span><img id="functiongraph_01_1841__en-us_topic_0000001525506617_image12749328524" src="en-us_image_0000001679118141.png"></span></div>
</li><li id="functiongraph_01_1841__en-us_topic_0000001525506617_li1886732412585">The following figure shows two successful requests. The request at the bottom took 13.100 ms, including the cold start time. The request at the top took only 1.671 ms, because no cold start was involved.<div class="fignone" id="functiongraph_01_1841__en-us_topic_0000001525506617_fig1948417401568"><span class="figcap"><b>Figure 2 </b>Logs</span><br><span><img id="functiongraph_01_1841__en-us_topic_0000001525506617_image7485540115615" src="en-us_image_0000001679199937.png"></span></div>
</li></ul>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_01_0300.html">Configuring Functions</a></div>
</div>
</div>