---
title: "Apache APISIX, Google Cloud Logging과 통합하여 로그 처리 개선 - API7.ai"
description: "로깅은 분산 시스템을 위한 중요한 인프라입니다. 개발자들이 ..."
url: "https://api7.ai/ko/blog/apache-apisix-google-cloud"
---

[Blog](https://api7.ai/ko/blog)

[Products](https://api7.ai/ko/category/products)[Technology](https://api7.ai/ko/category/technology)[Ecosystem](https://api7.ai/ko/category/ecosystem)[Case Study](https://api7.ai/ko/category/usercase)[Team & Community](https://api7.ai/ko/category/community)

Search

⌘ + K

[Blog](https://api7.ai/blog)

Ecosystem

# Apache APISIX, Google Cloud Logging과 통합하여 로그 처리 개선

API7.ai

December 22, 2021

[Ecosystem](https://api7.ai/category/ecosystem)

![Apache APISIX-Google Cloud Logging 커버](https://static.api7.ai/2022/10/03/633a42498b1bc.png?imageMogr2/format/webp)

로깅은 분산 시스템에서 중요한 인프라입니다. 이를 통해 개발자는 서비스 운영 상태를 관찰하고, 서비스 문제 해결 및 진단 효율을 높이며, 다차원 분석을 통해 시스템의 전반적인 안정성과 운영 효율성을 개선할 수 있습니다.

[Google Cloud Logging](https://cloud.google.com/logging/)은 Google Cloud가 제공하는 실시간 로그 관리 서비스로, EB급 저장, 검색, 분석 및 알림 서비스를 제공합니다. Google Cloud Logging의 로그 브라우저를 사용하면 로그를 쉽고 효율적으로 검색, 정렬 및 분석할 수 있으며, 저장된 쿼리와 풍부한 그래픽 기능을 제공하여 로그 스크리닝 결과를 검색 가능하고 더 직관적으로 만들 수 있습니다.

Apache APISIX는 이전에 [HTTP Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/http-logger.md), [TCP Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/tcp-logger.md), [Kafka Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/kafka-logger.md), [UDP Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/udp-logger.md), [RocketMQ Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/rocketmq-logger.md), [SkyWalking Logger](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/skywalking-logger.md), [Aliyun Cloud Logging(SLS)](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/sls-logger.md) 등 다양한 오픈 소스 및 클라우드 로깅 서비스 솔루션을 지원해 왔습니다.

최근 Apache APISIX는 Google Cloud Logging 지원도 추가하여, Apache APISIX를 게이트웨이로 사용할 때 새로운 로깅 솔루션을 제공합니다: [google-cloud-logging](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/google-cloud-logging.md)을 사용하여 Apache APISIX 요청 로그를 Google Cloud Logging 서비스로 전송하여 분석 및 저장할 수 있습니다.

플러그인이 활성화되면, Apache APISIX는 Log Phase에서 요청 컨텍스트 정보를 가져와 Google Cloud Logging의 [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry)로 직렬화한 후, 직렬화된 로그 데이터를 배치 큐에 제출합니다. 배치 큐가 사용자 설정 시간 또는 항목 임계값에 도달하면, 로그 데이터는 Google Cloud API를 통해 Google Cloud Logging 서비스로 전송됩니다.

이 글에서는 Apache APISIX에서 Google Cloud Logging 서비스를 구성하고 사용하는 방법을 설명합니다.

## Google Cloud 구성

1. 브라우저를 열고 Google Cloud 홈페이지를 방문합니다.
2. 사용자 이름과 비밀번호를 입력하여 Google Cloud 콘솔에 로그인합니다.
3. Google Cloud 콘솔 왼쪽 메뉴에서 "IAM & Admin > 프로젝트 만들기"를 선택하여 프로젝트 생성을 시작합니다. ![프로젝트 생성](https://static.api7.ai/2022/10/03/633a3edf07257.jpg?imageMogr2/format/webp)
4. 프로젝트 이름을 입력하고 조직 이름을 선택한 후 "CREATE"를 클릭하여 프로젝트를 생성합니다. ![프로젝트 생성-2](https://static.api7.ai/2022/10/03/633a42489fca6.png?imageMogr2/format/webp)
5. 프로젝트가 성공적으로 생성되면 콘솔 오른쪽 상단에 생성 성공 알림이 표시됩니다. ![프로젝트 알림](https://static.api7.ai/2022/10/03/633a424907a8c.png?imageMogr2/format/webp)
6. 창에서 프로젝트를 선택하거나 콘솔 홈페이지 상단 탐색 바에서 프로젝트 작업 경로를 선택합니다. 프로젝트를 선택하면 콘솔 홈페이지로 리디렉션되며, 상단 탐색 바에서 현재 프로젝트에 대한 데이터와 정보 센터에서 프로젝트 정보를 볼 수 있습니다. ![프로젝트 보기](https://static.api7.ai/2022/10/03/633a4249971e4.png?imageMogr2/format/webp)
7. 프로젝트 생성이 완료되면 프로젝트를 위한 서비스 계정을 생성해야 합니다. Google Cloud 콘솔 홈페이지로 돌아가 왼쪽 메뉴에서 "IAM & Admin > 서비스 계정"을 클릭하여 서비스 계정 생성을 시작합니다. ![서비스 계정 생성 시작](https://static.api7.ai/2022/10/03/633a424886255.png?imageMogr2/format/webp)
8. "CREATE SERVICE ACCOUNT"를 클릭하여 서비스 계정을 생성합니다. ![서비스 계정 생성](https://static.api7.ai/2022/10/03/633a4248c67b1.png?imageMogr2/format/webp)
9. 서비스 계정 이름과 ID를 입력하고(일반적으로 ID는 계정 생성 시 자동 생성됨), "CREATE AND CONTINUE"를 클릭합니다. ![서비스 계정 생성-2](https://static.api7.ai/2022/10/03/633a42490540d.png?imageMogr2/format/webp)
10. "Role"을 클릭하고 검색 상자에 "Logging Admin"을 입력하여 이 역할을 검색하고 "Logging Admin"을 선택합니다. ![서비스 계정 생성-3](https://static.api7.ai/2022/10/03/633a4248cfece.png?imageMogr2/format/webp)
11. "DONE"을 클릭하여 서비스 계정 생성을 완료하고 서비스 계정 홈페이지로 이동합니다. 이제 목록에서 방금 생성한 계정과 그 세부 정보를 볼 수 있습니다. ![서비스 계정 정보](https://static.api7.ai/2022/10/03/633a4247917f0.png?imageMogr2/format/webp)
12. 서비스 계정의 마지막 열에서 "Manage keys"를 클릭하여 비밀 키 관리 인터페이스로 이동합니다. ![비밀 키 관리 인터페이스로 이동](https://static.api7.ai/2022/10/03/633a3edf07257.jpg?imageMogr2/format/webp)
13. "ADD KEY > Create new key"를 클릭하여 새로운 비밀 키 생성을 시작합니다. ![새로운 비밀 키 생성](https://static.api7.ai/2022/10/03/633a42490dd41.png?imageMogr2/format/webp)
14. 팝업 페이지에서 비밀 키 유형을 "JSON"으로 선택한 후 "CREATE"를 클릭하여 새로운 비밀 키를 생성합니다. ![새로운 비밀 키 생성-2](https://static.api7.ai/2022/10/03/633a4248d4d4b.png?imageMogr2/format/webp)
15. 비밀 키 정보는 브라우저를 통해 시스템 기본 다운로드 디렉토리에 자동으로 다운로드됩니다. google-cloud-logging 플러그인을 활성화할 때 이 비밀 키의 정보를 사용해야 하므로, 비밀 키 파일을 저장해 두세요. ![비밀 키 다운로드](https://static.api7.ai/2022/10/03/633a4247a7c76.png?imageMogr2/format/webp)

## Apache APISIX 구성

### google-cloud-logging 플러그인 활성화

#### 옵션 1: 키 파일 업로드 구성

1. 비밀 키 파일을 Apache APISIX 노드 서버에 업로드합니다.
2. 파일 경로를 `google-cloud-logging.auth_file`에 구성합니다. 아래와 같습니다:

```
curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri":"/logging.do",
    "upstream":{
        "type":"roundrobin",
        "nodes":{
            "127.0.0.1:1980":1
        }
    },
    "plugins":{
        "google-cloud-logging":{
            // Google Cloud Logging 비밀 키 파일
            "auth_file":"/path/to/apache-apisix-fcafc68c2f41.json",
            // 배치 큐당 최대 항목 수
            "batch_max_size": 1,
            // 버퍼를 새로 고치는 최대 시간(초)
            "inactive_timeout": 10
        }
    }
}'
```

#### 옵션 2: JSON에서 구성 선언

1. 비밀 키 파일을 엽니다.
2. `project_id` 값을 `google-cloud-logging.auth_config.project_id`에 구성합니다.
3. `private_key` 값을 `google-cloud-logging.auth_config.private_key`에 구성합니다. 아래와 같습니다:

```
curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri":"/logging.do",
    "upstream":{
        "type":"roundrobin",
        "nodes":{
            "127.0.0.1:1980":1
        }
    },
    "plugins":{
        "google-cloud-logging":{
            // Google Cloud Logging 비밀 키 파일
            "auth_config":{
                "project_id":"apache-apisix",
                "private_key":"-----BEGIN RSA PRIVATE KEY-----your private key-----END RSA PRIVATE KEY-----"
            },
            // 배치 큐당 최대 항목 수
            "batch_max_size": 1,
            // 버퍼를 새로 고치는 최대 시간(초)
            "inactive_timeout": 10
        }
    }
}'
```

#### 매개변수

| 이름                        | 필수 여부 | 기본값                                                                                                                                                                                                                                                                                                                                                                                                             | 설명                                                                                                                          |
| ------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| auth\_config              | 아니오   | n/a                                                                                                                                                                                                                                                                                                                                                                                                             | Google Cloud Logging 비밀 키 파일. auth\_config 또는 auth\_file 중 하나를 구성해야 합니다.                                                    |
| auth\_config.private\_key | 예     | n/a                                                                                                                                                                                                                                                                                                                                                                                                             | Google Cloud Logging 비밀 키.                                                                                                  |
| auth\_config.project\_id  | 예     | n/a                                                                                                                                                                                                                                                                                                                                                                                                             | Google 서비스 계정의 프로젝트 ID.                                                                                                     |
| auth\_config.token\_uri   | 아니오   | oauth2.googleapis.com/token                                                                                                                                                                                                                                                                                                                                                                                     | Google 서비스 계정 토큰 요청 URI.                                                                                                    |
| auth\_config.entries\_uri | 아니오   | logging.googleapis.com/v2/entries                                                                                                                                                                                                                                                                                                                                                                               | Google 로그 서비스 로그 항목 작성 API.                                                                                                 |
| auth\_config.scopes       | 아니오   | \["[https://www.googleapis.com/auth/logging.read","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/logging.admin","https://www.googleapis.com/auth/cloud-platform](https://www.googleapis.com/auth/logging.read%22,%22https://www.googleapis.com/auth/logging.write%22,%22https://www.googleapis.com/auth/logging.admin%22,%22https://www.googleapis.com/auth/cloud-platform)"] | Google 서비스 계정 접근 범위, 참조: [Google API용 OAuth 2.0 범위](https://developers.google.com/identity/protocols/oauth2/scopes#logging) |
| auth\_file                | 아니오   | n/a                                                                                                                                                                                                                                                                                                                                                                                                             | Google 서비스 계정 JSON 파일 경로 (auth\_config 또는 auth\_file 중 하나를 구성해야 함)                                                          |
| ssl\_verify               | 아니오   | TRUE                                                                                                                                                                                                                                                                                                                                                                                                            | SSL 인증 활성화, [OpenResty 문서](https://github.com/openresty/lua-nginx-module#tcpsocksslhandshake) 옵션에 따라 구성.                    |
| resource                  | 아니오   | {"type": "global"}                                                                                                                                                                                                                                                                                                                                                                                              | Google 모니터링 리소스, 참조: [MonitoredResource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource).     |
| log\_id                   | 아니오   | apisix.apache.org%2Flogs                                                                                                                                                                                                                                                                                                                                                                                        | Google 로그 ID, 참조: [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry).                          |
| max\_retry\_count         | 아니오   | 0                                                                                                                                                                                                                                                                                                                                                                                                               | 처리 파이프라인에서 제거되기 전 최대 재시도 횟수.                                                                                                |
| retry\_delay              | 아니오   | 1                                                                                                                                                                                                                                                                                                                                                                                                               | 실행이 실패할 경우 실행을 지연시킬 시간(초).                                                                                                  |
| buffer\_duration          | 아니오   | 60                                                                                                                                                                                                                                                                                                                                                                                                              | 배치에서 가장 오래된 항목의 최대 지속 시간(초)이 먼저 처리되어야 함.                                                                                    |
| inactive\_timeout         | 아니오   | 10                                                                                                                                                                                                                                                                                                                                                                                                              | 버퍼를 새로 고치는 최대 시간(초).                                                                                                        |
| batch\_max\_size          | 아니오   | 100                                                                                                                                                                                                                                                                                                                                                                                                             | 버퍼를 새로 고치는 최대 시간(초).                                                                                                        |

### 플러그인이 정상적으로 실행되는지 확인

1. 다음 명령을 실행하여 Google Cloud Logging에 요청을 보냅니다.

   ```
   curl -i http://127.0.0.1:9080/logging.do
   HTTP/1.1 200 OK
   Content-Type: text/html; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Date: Fri, 10 Dec 2021 09:57:52 GMT
   Server: APISIX/2.11.0

   Hello, Google Cloud Logging
   ```

2. 브라우저를 열고 Google Cloud 홈페이지를 방문합니다.

3. 사용자 이름과 비밀번호를 입력하여 Google Cloud 콘솔에 로그인합니다.

4. 로그 브라우저를 통해 전송된 요청 로그를 확인하고, 반환된 결과는 아래와 같습니다. ![로그 보기](https://static.api7.ai/2022/10/03/633a3edf07257.jpg?imageMogr2/format/webp)

### google-cloud-logging 플러그인 비활성화

google-cloud-logging 관련 구성 블록을 제거하여 플러그인을 비활성화할 수 있습니다.

```
curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri":"/logging.do",
    "upstream":{
        "type":"roundrobin",
        "nodes":{
            "127.0.0.1:1980":1
        }
    },
    "plugins":{
    }
}'
```

## 요약

이 글에서는 Apache APISIX와 Google Cloud Logging을 연동하는 상세한 단계를 설명했습니다. 이 글이 Apache APISIX에서 Google Cloud Logging을 사용하는 방법을 더 명확히 이해하고, 이후 실습 작업에 도움이 되길 바랍니다.

Apache APISIX는 자체의 고성능을 유지하는 데만 전념하는 것이 아니라, 오픈 소스 생태계 구축에도 큰 중요성을 두고 있습니다. 현재 Apache APISIX는 10개 이상의 로깅 관련 플러그인을 보유하고 있으며, 업계의 주요 오픈 소스 로깅 프로젝트와의 연동을 지원합니다.

다른 로그와의 연동이 필요하다면, Apache APISIX의 [GitHub](https://github.com/apache/apisix/issues)를 방문하여 issue를 통해 제안을 남기거나, Apache APISIX [메일링 리스트](https://apisix.apache.org/docs/general/subscribe-guide/)를 구독하여 이메일로 의견을 표현할 수 있습니다.

## 관련 글

[Apache APISIX와 SkyWalking 연동으로 완벽한 로그 처리 구축](https://apisix.apache.org/blog/2021/12/07/apisix-integrate-skywalking-plugin/)

[Apache APISIX & RocketMQ를 통한 사용자 API 로그 모니터링 기능 지원](https://apisix.apache.org/blog/2021/12/08/apisix-integrate-rocketmq-logger-plugin/)

Tags:

[APISIX Basics](https://api7.ai/tags/apisix-basics)

[Ecosystem](https://api7.ai/tags/ecosystem)

[Google Cloud](https://api7.ai/tags/google-cloud)

Share article link

Share

Related Posts

[![야생에서 API 보호하기: WAF와 API Gateway 통합 심층 분석](https://static.api7.ai/uploads/2024/01/29/xV7L0ef7_APISIX_WAF_Cover.jpeg)](https://api7.ai/blog/waf-and-api-gateway-integration)

## [야생에서 API 보호하기: WAF와 API Gateway 통합 심층 분석](https://api7.ai/blog/waf-and-api-gateway-integration)

[![mTLS Everywhere: APISIX에서 TLS를 구성하는 방법](https://static.api7.ai/uploads/2024/12/24/DVhnbLpy_apisix-mtls.png)](https://api7.ai/blog/configure-tls-for-apisix)

## [mTLS Everywhere: APISIX에서 TLS를 구성하는 방법](https://api7.ai/blog/configure-tls-for-apisix)

Table of Contents

- [Google Cloud 구성](#google-cloud-%EA%B5%AC%EC%84%B1)

- [Apache APISIX 구성](#apache-apisix-%EA%B5%AC%EC%84%B1)

  - [google-cloud-logging 플러그인 활성화](#google-cloud-logging-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8-%ED%99%9C%EC%84%B1%ED%99%94)
  - [플러그인이 정상적으로 실행되는지 확인](#%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8%EC%9D%B4-%EC%A0%95%EC%83%81%EC%A0%81%EC%9C%BC%EB%A1%9C-%EC%8B%A4%ED%96%89%EB%90%98%EB%8A%94%EC%A7%80-%ED%99%95%EC%9D%B8)
  - [google-cloud-logging 플러그인 비활성화](#google-cloud-logging-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8-%EB%B9%84%ED%99%9C%EC%84%B1%ED%99%94)

- [요약](#%EC%9A%94%EC%95%BD)

- [관련 글](#%EA%B4%80%EB%A0%A8-%EA%B8%80)

## Related Posts

[![Apache APISIX, Open Policy Agent와 통합하여 생태계를 확장하다](https://static.api7.ai/2022/10/03/633a42410370c.webp)](https://api7.ai/ko/blog/apache-apisix-opa-integration)

Ecosystem

December 24, 2021

#### [Apache APISIX, Open Policy Agent와 통합하여 생태계를 확장하다](https://api7.ai/ko/blog/apache-apisix-opa-integration)

Open Policy Agent (OPA)는 오픈 소스 경량 범용 정책 엔진입니다...

[APISIX Basics](https://api7.ai/tags/apisix-basics)

[Ecosystem](https://api7.ai/tags/ecosystem)

[Open Policy Agent](https://api7.ai/tags/open-policy-agent)

[![xRPC 출시 예정, APISIX Ecosystem에 대한 더 많은 정보 확인하기](https://static.api7.ai/2022/11/18/6377370f7d49c.png)](https://api7.ai/ko/blog/apisix-xrpc-details-and-miltilingual)

Ecosystem

January 21, 2021

#### [xRPC 출시 예정, APISIX Ecosystem에 대한 더 많은 정보 확인하기](https://api7.ai/ko/blog/apisix-xrpc-details-and-miltilingual)

비즈니스 시나리오와 요구사항이 점점 더 복잡하고 다양해짐에 따라, 점점 더 많은 ...

[APISIX Basics](https://api7.ai/tags/apisix-basics)

[Ecosystem](https://api7.ai/tags/ecosystem)

[xRPC](https://api7.ai/tags/xrpc)

[![맞춤형 솔루션 구현: Apache APISIX와 Node-Red의 조화로운 활용](https://static.api7.ai/uploads/2024/03/06/uppjizMq_APISIX-node-red-cover.png)](https://api7.ai/ko/blog/apache-apisix-and-node-red)

Ecosystem

March 6, 2024

#### [맞춤형 솔루션 구현: Apache APISIX와 Node-Red의 조화로운 활용](https://api7.ai/ko/blog/apache-apisix-and-node-red)

APISIX와 Node-Red를 결합하면 복잡한 코드나 플러그인을 다시 작성하지 않고도 완전한 요청 처리 프로세스를 시각적으로 구현하는 데 도움이 됩니다.

[Node-Red](https://api7.ai/tags/node-red)

[APISIX Basics](https://api7.ai/tags/apisix-basics)
