Release Notes
Announcements
import logginglogger = logging.getLogger()logger.setLevel(logging.INFO)logger.addHandler(logging.StreamHandler(sys.stdout))def main_handler(event, context):logger.info('got event{}'.format(event))print("got event{}".format(event))return 'Hello World!'
LogSet log set and LogTopic log topic in CLS, both of which can be queried through the function configuration.print or logger in the function code will be recorded in the SCF_Message field when it is delivered to CLS. For descriptions of CLS fields, see Log Delivery Configuration.SCF_CustomKey: SCF, add a key-value index to the log topic for SCF log delivery as instructed in Configuring Indexes.SCF_LogTopic_) does not support modifying the index configuration. You need to set the destination topic to custom delivery first and then update the log topic's index configuration.field:value when it is delivered to CLS. Only top-level field:value pairs where the value is numeric or a string are parsed; other types are ignored.# -*- coding: utf8 -*-import jsondef main_handler(event, context):print(json.dumps({"key1": "test value 1","key2": "test value 2"}))return("Hello World!")

key1 field in the log query as shown below:

Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback