Sending service logs to Google Cloud Logging - Aiven Help ...
文章推薦指數: 80 %
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?
延伸文章資訊
- 1GCP 就該這樣用!Google Cloud Audit Logging 的最佳實踐
Audit Logging 主要功能與關鍵實踐介紹身為一位稽核人員,您可能要花費許多時間檢閱log。Goo … Continue reading "GCP 就該這樣用!Google Cloud ...
- 2Google Cloud Logging
... and scale applications, websites, and services on the same infrastructure as Google. ... Sign...
- 3Cloud Logging
Platform logs are ingested from Google Cloud services and securely stored with no setup required....
- 4Stackdriver Logging - Google Cloud
A log is a named collection of entries. Logs can be produced by Google Cloud Platform services, b...
- 5Configure Google Cloud Platform Log Collector - Alert Logic ...
Google Cloud logs do not have host metadata and are formatted in JSON. ... The Role field authori...