# XML, JSON 등 다양한 유형의 로그를 별도 개발 없이 파싱, 정규화 가능한가?

**URL:** <https://forum.logpresso.com/t/xml-json/24>\
**Category:** FAQ\
**Tags:** siem, poc, rfp\
**Created:** [2월 2, 2025, 11:14오전 UTC](https://forum.logpresso.com/t/xml-json/24 "2025-02-02T11:14:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xeraph](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.logpresso.com/xeraph/32/6_2.png) [@xeraph](https://forum.logpresso.com/u/xeraph)\
**Post date:** [2월 2, 2025, 11:14오전 UTC](https://forum.logpresso.com/t/xml-json/24/1 "2025-02-02T11:14:26Z")

</div>

로그프레소 쿼리 언어는 높은 수준의 표현력을 제공하므로 별도의 개발 없이 사용자가 쿼리 작성만으로 파싱 및 정규화를 수행할 수 있습니다.

## XML 파싱 예시

> **[parsexml | 로그프레소 쿼리](https://docs.logpresso.com/ko/query/parsexml-command)**
>
> parsexml 명령어는 XML 문서를 복합 객체의 집합으로 파싱하여 필드에 저장합니다. 선택 매개변수로는 파싱할 값이 저장된 필드 이름과 원본 데이터의 출력 옵션을 설정할 수 있습니다. 이 명령어를 사용하면 XML 요소의 문자열과 속성을 쉽게 추출하여 활용할 수 있습니다.

아래는 보안뉴스 RSS를 쿼리로 파싱하는 예제입니다.

```auto
wget encoding=euc-kr url="http://www.boannews.com/media/news_rss.xml?mkind=1" 
| parsexml field=line 
| parsemap field=channel 
| explode item
| parsemap field=item 
| fields title, link, description

```

 ![image](https://canada1.discourse-cdn.com/flex034/uploads/logpresso/original/1X/fc2b20f3b70254a8e779f8af2c60d5595ebddd08.png)

## JSON 파싱 예시

> **[parsejson | 로그프레소 쿼리](https://docs.logpresso.com/ko/query/parsejson-command)**
>
> parsejson 명령어는 JSON 문자열을 파싱하여 원하는 형식으로 출력하는 기능을 제공합니다. 다양한 선택 매개변수를 통해 중첩 항목 처리, 입력 길이 제한, 오류 복구 등의 세부 조정을 할 수 있습니다. 이 명령어는 JSON 데이터의 구조를 쉽게 분석하고 활용할 수 있도록 돕습니다.

아래는 Zscaler Private Access 로그를 parsejson 명령어로 파싱하는 예제입니다.

```auto
json "{}" 
| eval line = "{\"LogTimestamp\":\"Wed Jul 3 05:17:22 2019\",\"Customer\":\"Safe March\",\"SessionID\":\"8A64Qwj9zCkfYDGJVoUZ\",\"SessionType\":\"ZPN_ASSISTANT_BROKER_CONTROL\",\"SessionStatus\":\"ZPN_STATUS_AUTHENTICATED\",\"Version\":\"19.20.3\",\"Platform\":\"el7\",\"ZEN\":\"US-NY-8179\",\"Connector\":\"Seattle App Connector 1\",\"ConnectorGroup\":\"Azure App Connectors\",\"PrivateIP\":\"10.0.0.4\",\"PublicIP\":\"0.0.0.0\",\"Latitude\":47,\"Longitude\":-122,\"CountryCode\":\"\",\"TimestampAuthentication\":\"2019-06-27T05:05:23.348Z\",\"TimestampUnAuthentication\":\"\",\"CPUUtilization\":1,\"MemUtilization\":20,\"ServiceCount\":2,\"InterfaceDefRoute\":\"eth0\",\"DefRouteGW\":\"10.0.0.1\",\"PrimaryDNSResolver\":\"168.63.129.16\",\"HostStartTime\":\"1513229995\",\"ConnectorStartTime\":\"1555920005\",\"NumOfInterfaces\":2,\"BytesRxInterface\":319831966346,\"PacketsRxInterface\":1617569938,\"ErrorsRxInterface\":0,\"DiscardsRxInterface\":0,\"BytesTxInterface\":192958782635,\"PacketsTxInterface\":1797471190,\"ErrorsTxInterface\":0,\"DiscardsTxInterface\":0,\"TotalBytesRx\":10902554,\"TotalBytesTx\":48931771}"
| parsejson

```

 ![image](https://canada1.discourse-cdn.com/flex034/uploads/logpresso/original/1X/7a7f352d042d001a83cb1f6782fbf114a39edc96.png)
