티스토리 뷰
## 1. 인덱스 및 소스 현황 파악
### 모든 인덱스 목록 조회
```splunk
| eventcount summarize=false index=*
| dedup index
| table index
```
### 인덱스별 데이터 볼륨 및 이벤트 수
```splunk
| eventcount summarize=false index=*
| stats sum(eventcount) as total_events by index
| join type=left index [| dbinspect index=*
| stats sum(sizeOnDiskMB) as total_size_mb by index]
| sort - total_events
```
### 소스 유형별 현황
```splunk
| metadata index=* type=sourcetypes
| stats count by sourcetype
| sort - count
```
### 호스트별 로그 현황
```splunk
| metadata index=* type=hosts
| stats count by host
| sort - count
```
## 2. 대시보드 현황 파악
### 모든 대시보드 목록
```splunk
| rest /servicesNS/-/-/data/ui/views
| search eai:data=*
| fields id title eai:acl.*
| table id, title, eai:acl.owner, eai:acl.app
```
### 대시보드별 사용 빈도
```splunk
| rest /servicesNS/-/-/data/ui/views
| search eai:data=*
| fields id title
| join type=left id [| rest /servicesNS/-/-/data/ui/views/-/data
| search id=*
| stats count by id]
| table id, title, count
| sort - count
```
## 3. 알림 현황 파악
### 모든 알림 목록
```splunk
| rest /servicesNS/-/-/saved/searches
| search alert_type=*
| fields title, alert_type, cron_schedule, search, action.*
| table title, alert_type, cron_schedule, action.email.*
```
### 알림 실행 빈도 및 상태
```splunk
| rest /servicesNS/-/-/saved/searches
| search alert_type=*
| fields title, alert_type
| join type=left title [| rest /servicesNS/-/-/saved/searches/-/history
| search title=*
| stats count, avg(run_time) as avg_run_time by title]
| table title, alert_type, count, avg_run_time
| sort - count
```
## 4. 데이터 소스 상세 분석
### 특정 인덱스의 상세 정보
```splunk
index=<인덱스명>
| head 1000
| stats count by sourcetype, host, source
| sort - count
```
### 로그 패턴 분석
```splunk
index=<인덱스명>
| timechart count by sourcetype
```
### 필드 사용 현황 분석
```splunk
index=<인덱스명>
| fieldsummary
| fields field, count, percent
| where percent > 1
| sort - percent
```
## 5. 종합 리포트 생성
### 이관 대상 현황 종합 리포트
```splunk
| makeresults
| eval report_type="인덱스 현황"
| append [| eventcount summarize=false index=* | stats sum(eventcount) as total_events by index | eval report_type="인덱스 현황"]
| append [| metadata index=* type=sourcetypes | stats count as sourcetype_count by index | eval report_type="소스타입 현황"]
| append [| rest /servicesNS/-/-/saved/searches | search alert_type=* | stats count as alert_count | eval report_type="알림 현황"]
| append [| rest /servicesNS/-/-/data/ui/views | search eai:data=* | stats count as dashboard_count | eval report_type="대시보드 현황"]
| table report_type, index, total_events, sourcetype_count, alert_count, dashboard_count
```
## 사용 방법
1. **인덱스명 교체**: `<인덱스명>`을 실제 인덱스 이름으로 교체하여 사용
2. **범위 지정**: 시간 범위를 적절히 설정 (예: 지난 30일)
3. **결과 내보내기**: CSV로 export하여 이관 계획 수립에 활용
