GCP - Logging Enum

हैकट्रिक्स का समर्थन करें

मूल जानकारी

यह सेवा उपयोगकर्ताओं को अपने GCP से लॉग डेटा और घटनाएं को स्टोर, सर्च, विश्लेषण, मॉनिटर और अलर्ट करने की अनुमति देती है।

क्लाउड लॉगिंग को अन्य GCP सेवाओं के साथ पूरी तरह से एकीकृत किया गया है, जो आपके सभी GCP संसाधनों से लॉग को सेंट्रलाइज़ड रिपॉज़िटरी प्रदान करता है। यह स्वचालित रूप से विभिन्न GCP सेवाओं से लॉग एकत्र करता है जैसे App Engine, Compute Engine, और Cloud Functions। आप Cloud Logging का उपयोग भी कर सकते हैं जो on-premises या अन्य क्लाउड्स पर चल रहे एप्लिकेशन्स के लिए Cloud Logging एजेंट या API का उपयोग करके।

मुख्य विशेषताएँ:

  • लॉग डेटा सेंट्रलाइज़ेशन: विभिन्न स्रोतों से लॉग डेटा को एकत्रित करें, अपने एप्लिकेशन्स और इंफ्रास्ट्रक्चर का पूर्ण दृश्य प्रदान करने वाला।

  • रियल-टाइम लॉग प्रबंधन: त्वरित विश्लेषण और प्रतिक्रिया के लिए लॉग को रियल टाइम में स्ट्रीम करें।

  • शक्तिशाली डेटा विश्लेषण: बड़े मात्रा में लॉग डेटा को तेजी से छानने के लिए उन्नत फ़िल्टरिंग और खोज क्षमताएँ का उपयोग करें।

  • BigQuery के साथ एकीकरण: विस्तृत विश्लेषण और क्वेरींग के लिए लॉग को BigQuery में निर्यात करें।

  • लॉग-आधारित मीट्रिक्स: अलर्टिंग और मॉनिटरिंग के लिए अपने लॉग डेटा से कस्टम मीट्रिक्स बनाएं।

लॉग्स फ्लो

मूल रूप से सिंक्स और लॉग-आधारित मीट्रिक्स यह तय करेंगे कि एक लॉग को कहां स्टोर किया जाए।

GCP लॉगिंग द्वारा समर्थित विन्यास

क्लाउड लॉगिंग विविध ऑपरेशनल आवश्यकताओं को सुविधाजनक बनाने के लिए अधिकतम रूप से विन्यासी है:

  1. लॉग बकेट्स (वेब में लॉग स्टोरेज): Cloud Logging में बकेट्स को परिभाषित करें लॉग रिटेंशन को प्रबंधित करने के लिए, अपने लॉग एंट्री को कितने समय तक रखा जाए इस पर नियंत्रण प्रदान करते हैं।

  • डिफ़ॉल्ट रूप से बकेट्स _Default और _Required बनाए जाते हैं (एक वह है जो लॉगिंग कर रहा है जो दूसरा नहीं है)।

  • _Required है:

LOG_ID("cloudaudit.googleapis.com/activity") OR LOG_ID("externalaudit.googleapis.com/activity") OR LOG_ID("cloudaudit.googleapis.com/system_event") OR LOG_ID("externalaudit.googleapis.com/system_event") OR LOG_ID("cloudaudit.googleapis.com/access_transparency") OR LOG_ID("externalaudit.googleapis.com/access_transparency")
  • डेटा की रिटेंशन अवधि बकेट प्रति कॉन्फ़िगर की जाती है और यह कम से कम 1 दिन होनी चाहिए। हालांकि _Required की रिटेंशन अवधि 400 दिन है और इसे संशोधित नहीं किया जा सकता है।

  • ध्यान दें कि लॉग बकेट्स क्लाउड स्टोरेज में दिखाई नहीं देते हैं।

  1. लॉग सिंक्स (लॉग राउटर वेब में): फ़िल्टर के आधार पर लॉग एंट्रीज़ को विभिन्न गंतव्यों जैसे Pub/Sub, BigQuery, या Cloud Storage में निर्यात करने के लिए सिंक्स बनाएं

  • डिफ़ॉल्ट रूप से सिंक्स बकेट्स _Default और _Required के लिए बनाए जाते हैं:

_Required logging.googleapis.com/projects//locations/global/buckets/_Required LOG_ID("cloudaudit.googleapis.com/activity") OR LOG_ID("externalaudit.googleapis.com/activity") OR LOG_ID("cloudaudit.googleapis.com/system_event") OR LOG_ID("externalaudit.googleapis.com/system_event") OR LOG_ID("cloudaudit.googleapis.com/access_transparency") OR LOG_ID("externalaudit.googleapis.com/access_transparency") _Default logging.googleapis.com/projects//locations/global/buckets/_Default NOT LOG_ID("cloudaudit.googleapis.com/activity") AND NOT LOG_ID("externalaudit.googleapis.com/activity") AND NOT LOG_ID("cloudaudit.googleapis.com/system_event") AND NOT LOG_ID("externalaudit.googleapis.com/system_event") AND NOT LOG_ID("cloudaudit.googleapis.com/access_transparency") AND NOT LOG_ID("externalaudit.googleapis.com/access_transparency")

* **अलगाव फ़िल्टर:** विशिष्ट लॉग एंट्रीज़ को इंजेस्ट न होने देने के लिए **अलगाव सेट करना संभव है**, जिससे लागत को कम किया जा सकता है और अनावश्यक शोर को कम किया जा सकता है।
3. **लॉग-आधारित मीट्रिक्स:** लॉग की सामग्री पर आधारित **कस्टम मीट्रिक्स** कॉन्फ़िगर करें, जिससे लॉग डेटा के आधार पर अलर्टिंग और मॉनिटरिंग किया जा सके।
4. **लॉग व्यूज़:** लॉग बकेट्स में लॉग किसके पास है उस पर उच्च और **विस्तृत नियंत्रण प्रदान करते हैं**। 
* क्लाउड लॉगिंग **हर बकेट के लिए स्वचालित रूप से `_AllLogs` व्यू बनाता है**, जो सभी लॉग दिखाता है। क्लाउड लॉगिंग डिफ़ॉल्ट बकेट के लिए `_Default` नामक एक व्यू भी बनाता है। `_Default` बकेट के लिए `_Default` व्यू सभी लॉग दिखाता है केवल डेटा एक्सेस ऑडिट लॉग्स को छोड़कर। `_AllLogs` और `_Default` व्यूज़ को संपादित नहीं किया जा सकता है।

एक प्रिंसिपल को केवल एक विशिष्ट लॉग व्यू का उपयोग करने की अनुमति देना संभव है जैसे एक IAM नीति के साथ:

<div data-gb-custom-block data-tag="code" data-overflow='wrap'>

```json
{
"bindings": [
{
"members": [
"user:username@gmail.com"
],
"role": "roles/logging.viewAccessor",
"condition": {
"title": "Bucket reader condition example",
"description": "Grants logging.viewAccessor role to user username@gmail.com for the VIEW_ID log view.",
"expression":
"resource.name == \"projects/PROJECT_ID/locations/LOCATION/buckets/BUCKET_NAME/views/VIEW_ID\""
}
}
],
"etag": "BwWd_6eERR4=",
"version": 3
}

डिफ़ॉल्ट लॉग

डिफ़ॉल्ट रूप से एडमिन लेखन ऑपरेशन (जिसे एडमिन गतिविधि ऑडिट लॉग भी कहा जाता है) लॉग किए जाते हैं (मेटाडेटा लेखें या विन्यास सूचना लिखें) और इन्हें अक्षम नहीं किया जा सकता

उसके बाद, उपयोगकर्ता डेटा एक्सेस ऑडिट लॉग को सक्षम कर सकते हैं, ये हैं एडमिन पढ़ें, डेटा लेखें और डेटा लेखें

आप दस्तावेज़ में प्रत्येक प्रकार के लॉग के बारे में अधिक जानकारी पा सकते हैं: https://cloud.google.com/iam/docs/audit-logging

हालांकि, ध्यान दें कि इसका मतलब है कि डिफ़ॉल्ट रूप से GetIamPolicy क्रियाएँ और अन्य पढ़ने वाली क्रियाएँ लॉग नहीं की जा रही हैं। इसलिए, डिफ़ॉल्ट रूप से एक हमलावर जो पर्यावरण की जांच करने की कोशिश कर रहा है, उसे पकड़ा नहीं जाएगा अगर सिस्टम व्यवस्थापक ने अधिक लॉग उत्पन्न करने की विन्यास नहीं किया।

कॉन्सोल में अधिक लॉग सक्षम करने के लिए सिस्टम व्यवस्थापक को https://console.cloud.google.com/iam-admin/audit जाना होगा और उन्हें सक्षम करना होगा। यहां 2 विभिन्न विकल्प हैं:

  • डिफ़ॉल्ट विन्यास: एक डिफ़ॉल्ट विन्यास बनाना संभव है और सभी एडमिन पढ़ें और/या डेटा पढ़ें और/या डेटा लेख लॉग और यहां छूट देने वाले मुख्य सिद्धांतों को भी जोड़ सकते हैं:

  • सेवाएं चुनें: या फिर केवल उन सेवाओं को चुनें जिनके लॉग उत्पन्न करना चाहते हैं और लॉग के प्रकार और उस विशेष सेवा के लिए छूट देने वाले मुख्य सिद्धांत।

ध्यान दें कि डिफ़ॉल्ट रूप से केवल वे लॉग उत्पन्न किए जा रहे हैं क्योंकि अधिक लॉग उत्पन्न करने से लागत बढ़ जाएगी।

गणना

gcloud कमांड-लाइन टूल GCP पारिस्थितिकी में एक महत्वपूर्ण हिस्सा है, जो आपको अपने संसाधनों और सेवाओं का प्रबंधन करने की अनुमति देता है। यहाँ यहाँ आप अपनी लॉगिंग विन्यास और एक्सेस लॉग को प्रबंधित करने के लिए gcloud का उपयोग कैसे कर सकते हैं।

```bash # List buckets gcloud logging buckets list gcloud logging buckets describe --location

List log entries: only logs that contain log entries are listed.

gcloud logging logs list

Get log metrics

gcloud logging metrics list gcloud logging metrics describe

Get log sinks

gcloud logging sinks list gcloud logging sinks describe

Get log views

gcloud logging views list --bucket --location global gcloud logging views describe --bucket --location global # view-id is usually the same as the bucket name

gcloud logging links list --bucket _Default --location global gcloud logging links describe --bucket _Default --location global

[अनुवाद]

[//]: [The following [content] is from the file...]
[[sample-अनुवाद]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [Example check the logs of **`cloudresourcemanager`** (used to permissions):]
[**`cloudresourcemanager`** के लॉग की जांच करने का उदाहरण:]

[//]: [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]
[https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]

[//]: [There aren't logs of **`testIam`** permissions:]
[**`testIam`** 권한에 대한 로그가 없습니다:]

[//]: [```]
[उपयुक्तf-अनुवाद]
[//]: [```]

[//]: [ [References]]
[##] [संदर्भ]

[//]: [* [https://cloud.google.com/logging/docs/logs-views#gcloud]]
[* [https://cloud.google.com/logging/docs/logs-views#gcloud]]

[//]: [* [https://betterstack.com/community/guides/logging/gcp-logging/]]
[* [https://betterstack.com/community/guides/logging/gcp-logging/]]

[//]: [ [//]: [```]]
[//]: [```]

[//]: [ [//]: [```]]
[//-अनुवाद]

[//]: [Do not translate the following content]
[Do not translate the following content]

[//]: [The following is content from the file...]
[The following is content from the file...]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [Example check the logs of **`cloudresourcemanager`** (used to permissions):]
[**`cloudresourcemanager`** के लॉग की जांच करने का उदाहरण:]

[//]: [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]
[https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]

[//]: [There aren't logs of **`testIam`** permissions:]
[**`testIam`** 권한에 대한 로그가 없습니다:]

[//]: [```]
[उपयुक्तf-अनुवाद]
[//]: [```]
"""

[//]: [Do not translate the following content]
[Do not translate the following content]

[//]: [The following is content from the file...]
[The following is content from the file...]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [Example check the logs of **`cloudresourcemanager`** (used to permissions):]
[**`cloudresourcemanager`** के लॉग की जांच करने का उदाहरण:]

[//]: [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]
[https update [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]

[//]: [There aren't logs of **`testIam`** permissions:]
[**`testIam`** 권한에 대한 로그가 없습니다.]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [ [References]]
[##] [संदर्भ]

[//]: [* [https://cloud.google.com/logging/docs/logs-views#gcloud]]
[* [https://cloud.google.com/logging/docs/logs-views#gcloud]]

[//]: [* [https://betterstack.com/community/guides/logging/gcp-logging/]]
[* [https://betterstack.com/community/guides/logging/gcp-logging/]]
"""

[//]: [Do not translate the following content]
[Do not translate the following content]

[//]: [The following is content from the file...]
[The following is content from the file...]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [Example check the logs of **`cloudresourcemanager`** (used to permissions):]
[**`cloudresourcemanager`** के लॉग की जांच करने का उदाहरण:]

[//]: [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]
[https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26.062Z?authuser=2\&project=digital-bonfire-410512]

[//]: [There aren't logs of **`testIam`** permissions:]
[**`testIam`** 권한에 대한 로그가 없습니다:]

[//]: [```]
[उपयुक्तf-अनुवाद]
[//]: [```]

[//]: [ [References]]
[##] [संदर्भ]

[//]: [* [https://cloud.google.com/logging/docs/logs-views#gcloud]]
[* [https://cloud.google.com/logging/docs/logs-views#gcloud]]

[//]: [* [https://betterstack.com/community/guides/logging/gcp-logging/]]
[* [https://betterstack.com/community/guides/logging/gcp-logging/]]
"""

[//]: [Do not translate the following content]
[Do not translate the following content]

[//]: [The following is content from the file...]
[The following is content from the file...]

[//]: [```]
[उपयुक्त-अनुवाद]
[//]: [```]

[//]: [Example check the logs of **`cloudresourcemanager`** (used to permissions):]
[**`cloudresourcemanager`** के लॉग की जांच करने का उदाहरण:]

[//]: [https://console.cloud.google.com/logs/query;query=protoPayload.serviceName%3D%22cloudresourcemanager.googleapis.com%22;summaryFields=:false:32:beginning;cursorTimestamp=2024-01-20T00:07:14.482809Z;startTime=2024-01-01T11:12:26.062Z;endTime=2024-02-02T17:12:26

Last updated