# Nginx 로그

## 개요

Panther는 일반적인 방법을 통해 Nginx 로그 수집을 지원합니다 [데이터 전송](https://docs.panther.com/ko/data-onboarding/data-transports) 옵션: Amazon Web Services (AWS) S3, SQS 및 CloudWatch.

## Nginx 로그를 Panther에 온보딩하는 방법

이 로그를 Panther에 연결하려면:

1. Panther 콘솔의 왼쪽 탐색 창에서 **구성** > **로그 소스**.
2. 를 선택하고 Panther가 설치된 계정 ID를 입력하십시오. **새로 만들기**.
3. 온보딩하려는 로그 유형을 검색한 다음 해당 타일을 클릭하세요.
4. 이 통합에 사용할 데이터 전송 방법을 선택한 다음 해당 방법을 구성하기 위한 Panther의 지침을 따르세요:
   * [AWS CloudWatch](https://docs.panther.com/ko/data-onboarding/data-transports/aws/cloudwatch)
   * [AWS SQS](https://docs.panther.com/ko/data-onboarding/data-transports/aws/sqs)
   * [AWS S3 버킷](https://docs.panther.com/ko/data-onboarding/data-transports/aws/s3)
5. Nginx를 구성하여 로그를 데이터 전송(Data Transport) 소스로 푸시하십시오.
   * 선택한 데이터 전송 소스로 로그를 푸시하는 방법은 Nginx 문서를 참조하십시오.

## Data Explorer에서 로그 쿼리하기

Panther의 Data Explorer에서 NGINX 로그 쿼리 예시를 보려면 [Nginx 및 ALB 액세스 로그 쿼리](https://docs.panther.com/ko/search/data-explorer/example-queries/nginx-and-alb-access-logs-queries).

## 지원되는 로그 유형

### Nginx.Access

Nginx 서버의 액세스 로그입니다. Panther는 Nginx 'combined' 형식을 지원합니다.

참고: [로그 포맷에 대한 Nginx 문서.](http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format)

```yaml
schema: Nginx.Access
파서:
    패스트매치:
        매치:
            - '%{remoteAddr} - %{remoteUser} [%{time}] "%{request}" %{status} %{bodyBytesSent} "%{httpReferer}" "%{httpUserAgent}"'
        빈값:
            - '-'
description: Nginx 서버의 액세스 로그입니다. 현재 Nginx 'combined' 형식을 지원합니다.
referenceURL: https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
필드:
    - name: remoteAddr
      description: 서버에 요청을 보낸 클라이언트(원격 호스트)의 IP 주소입니다.
      type: string
      지표:
        - ip
    - name: remoteUser
      description: 요청을 수행한 사용자의 userid입니다. 보통 .htaccess에서 인증을 요청하지 않으면 비어 있습니다.
      type: string
      지표:
        - username
    - 이름: time
      required: true
      description: 요청을 수신한 시간(UTC)입니다.
      type: timestamp
      timeFormats:
        - '%d/%b/%Y:%H:%M:%S %z'
      isEventTime: true
    - 이름: request
      description: 클라이언트의 요청 라인입니다. HTTP 메서드, 요청된 리소스 및 HTTP 프로토콜을 포함합니다.
      type: string
    - 이름: status
      description: 클라이언트에 반환된 HTTP 상태 코드입니다.
      유형: smallint
    - name: bodyBytesSent
      description: 바이트 단위로 측정된 클라이언트에 반환된 객체의 크기입니다.
      type: bigint
    - name: httpReferer
      description: 존재하는 경우 HTTP 리퍼러입니다.
      type: string
    - name: httpUserAgent
      description: 요청을 보낼 때 사용자가 사용한 에이전트입니다.
      type: string
```

### Nginx.Error

Nginx 서버의 오류 로그입니다.

```yaml
schema: Nginx.Error
파서:
    패스트매치:
        매치:
            - '%{time} [%{severity}] %{pid}#%{tid}: *%{message}'
        빈값:
            - '-'
description: Nginx 서버의 오류 로그입니다.
referenceURL: https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
필드:
    - 이름: time
      required: true
      description: 오류가 발생한 시간(UTC)입니다.
      type: timestamp
      timeFormats:
        - '%Y/%m/%d %H:%M:%S'
      isEventTime: true
    - 이름: severity
      required: true
      description: 오류의 심각도 레벨입니다.
      type: string
    - name: pid
      description: Nginx 서버의 프로세스 ID입니다.
      type: bigint
    - name: tid
      description: Nginx 서버의 스레드 ID입니다.
      type: bigint
    - name: message
      required: true
      description: 오류 메시지입니다.
      type: string
```
