Sending service logs to Google Cloud Logging - Aiven Help ...

文章推薦指數: 80 %
投票人數:10人

You can enable the Google Cloud Logging integration in the Service Integrations section of your project. You will need to configure the Google Cloud Platform ... AllCollections Services Integrations SendingservicelogstoGoogleCloudLogging SendingservicelogstoGoogleCloudLogging ServiceintegrationforsendinglogstoGoogleCloudLogging WrittenbyTeemuHarju Updatedoveraweekago ItispossibletosendtheservicelogsofyourAivenservicestoGoogleCloudLogging,formerlyknownasGoogleStackdriver.CloudLoggingallowsyoutostore,search,analyze,monitor,andalertonlogdatafromyourservicesrunningintheAivencloud.CreatingtheGoogleCloudLoggingintegrationBeforestartingyouwouldneedtomakesurethatloggingAPIisenabledinyourGCPproject.ThefirststepistocreateaGoogleCloudLoggingintegrationendpointtotheAivenprojectthatyouareusing.ItispossibletodothiseitherinsidetheAivenWebConsoleorbyusingtheAivenClient.We'llgothroughbothoptionshere.CreatetheintegrationendpointusingtheAivenWebConsoleYoucanenabletheGoogleCloudLoggingintegrationintheServiceIntegrationssectionofyourproject.YouwillneedtoconfiguretheGoogleCloudPlatformprojectIDaswellasthelogIDusedwhensendingthelogstoGoogleCloudLogging.NotethatthevalueoflogIDneedstobeURL-encoded.Youwillalsoneedtoprovideserviceaccountcredentials,thatwillbeusedwhenauthenticatingagainstGoogleCloudPlatform.Youcanfindinstructionsonhowtocreatethiscredential(privatekey)fromtheofficialGoogledocumentationhere.Theserviceaccountneedspermissionlogging.logEntries.create.Thispermissionisgrantedbythe2roles:roles/logging.logWriter,androles/editor.TheofficialGoogledocumentationalsoexplainshowtoaddrolestoyourserviceaccount.Also,importanttonoticeisthatthecredentialsneedtobeprovidedinJSONformat.AddtheintegrationendpointtoyourserviceusingtheAivenWebConsoleGototheserviceyouwanttoaddthelogsintegrationtoandselectManageIntegrations.ThenfindtheGoogleCloudLoggingintegrationfromthelistandclickUseIntegration.Afterthisyouwillbeaskedtoselecttheendpointyouwanttousefortheintegration.CreatetheintegrationendpointusingtheAivenclientavnserviceintegration-endpoint-create--projectyour-project-d"GoogleCloudLogging"-texternal_google_cloud_logging-cproject_id=your-gcp-project-id-clog_id=my-aiven-service-logs-cservice_account_credentials='{"type":"service_account...'Therequiredconfigurationparametersfortheendpointareasfollows:project_id-TheIDoftheGoogleCloudPlatformprojectyouwanttosendtheservicelogsto.log_id-TheIDassociatedwiththelogsyouaresendingtoGoogleCloudLogging.NotethatvalueneedstobeURL-encoded.service_account_credentials-GoogleCloudPlatformserviceaccountcredentialstobeusedwhensendingoutthelogs.Theaccountneedspermissionlogging.logEntries.create.Also,importanttonoticeisthattheserviceaccountcredentialsneedtobeinJSONformat.AddtheintegrationendpointtoyourserviceusingAivenclientTobeabletosendthelogstoGoogleCloudLoggingusingthepreviouslycreatedendpoint,itneedstobeattachedtotheservice.Forthisyouneedtheendpointidentifier.Thisyoucangetbylistingtheavailableendpointsforyourproject.avnserviceintegration-endpoint-list--projectyour-projectENDPOINT_IDENDPOINT_NAMEENDPOINT_TYPE==================================================================02b4ee79-3c09-4608-87a1-4ee716...GoogleCloudL...external_goog...Usingthisendpointidyoucanattachtheservicetotheendpoint.avnserviceintegration-create--projectyour-project\-texternal_google_cloud_logging-syour-service\-D02b4ee79-3c09-4608-87a1-4ee71609e0cbAttachingtheservicetotheendpointwillenablesendingtheservicelogstoGoogleCloudLogging.YoucanviewthelogsthroughtheGoogleCloudPlatformconsole. Didthisansweryourquestion?



請為這篇文章評分?