2014년 10월 10일 금요일

SUNDB Splunk 연결


1. Splunk 설치하기

1.1. Splunk Download

            http://www.splunk.com/ 에서 Splunk를 다운로드 한다.




            다운로드한 패키지를 설치한다.




1.2. Splunk Start

            splunk start 명령어를 이용하여 실행한다.




1.3. Splunk 접속

            http://hostname:8000 으로 브라우저를 이용하여 접속한다. 최초의 접속계정은 admin/changeme 이다.





2. Splunk DB Connect 설치하기

2.1. Splunk DB Connect Overview

            Splunk DB Connect delivers reliable, scalable, real-time integration between Splunk Enterprise and relational databases. Integrate structured data from relational databases with data in Splunk Enterprise to drive deeper levels of analysis and operational intelligence.




2.2. Splunk DB Connect앱 설치

            “앱 관리버튼을 클릭하여 DB Connect 앱의 설치를 시작한다.



            “파일에서 앱 설치버튼을 클릭한다.




            “파일선택버튼을 클릭한다.




            다운로드 받은 “splunk-db-connect_113.tgz” 파일을 선택한다. 압축을 풀지 않고 *.tgz 타입으로 선택하여 설치한다.




            선택이 완료되면 열기버튼을 클릭하고, “업로드버튼을 클릭하면 앱의 설치가 시작된다.



            “DB Connect 의 설치가 완료되면 Splunk를 재시작 하여야 한다.






            Splunk가 재시작 되고 다시 로그인 한다.





            ID/PASSWORD를 입력하여 로그인 한다.




            앱의 설치가 완료되었다는 메시지가 출력된다.




2.3. 기본환경 설정

            “지금 설정버튼을 클릭하여 “DB Connect설정을 시작한다. 앱의 설치와 함께 기본값으로 설정이 되어 있으며 이 값을 그대로 사용한다.




            “저장버튼을 클릭하여 설정 값을 저장한다.




            저장이 완료되면 앱 목록에 “Splunk DB Connect” 가 설치되어 있는 것을 볼 수 있다.



            Splunk 로고를 클릭하여 Main화면으로 이동하면 Splunk DB Connect Panel이 표시 된다.

3. SUNDB Splunk연결하기

3.1. JDBC 드라이버 복사하기

            Splunk SUNDB를 연결하기 위해 사전에 SUNDB JDBC Dirver 파일이 필요하다. JDBC파일을 Splunk DB Connect가 설치된 디렉토리의 Library에 복사하여 넣어 둔다. Default로 앱을 설치한 경우 “$SPLUNK_HOME/etc/apps/dbx/bin/lib/ 디렉토리에 복사하면 된다.




3.2. 프로파일 설정하기

            “$SPLUNK_HOME/etc/apps/dbx/default/database_types.conf 파일에 프로파일을 설정한다. README파일을 참고하여 작성하면 된다.
# Copyright (C) 2005-2014 Splunk Inc. All Rights Reserved.
[default]

[mssql]
displayName = Microsoft SQL Server
typeClass = com.splunk.dbx.sql.type.impl.MicrosoftSqlServer

[odbc]
displayName = ODBC
typeClass = com.splunk.dbx.sql.type.impl.ODBC

[sqlite]
displayName = SQLite
typeClass = com.splunk.dbx.sql.type.impl.SQLite
local = 1

[oracle]
displayName = Oracle
typeClass = com.splunk.dbx.sql.type.impl.Oracle
defaultCatalogName = ORCL

[mysql]
displayName = MySQL
typeClass = com.splunk.dbx.sql.type.impl.MySQL
testQuery = SELECT 1
defaultCatalogName = mysql
defaultPort = 3306

[postgresql]
displayName = PostgreSQL
jdbcDriverClass = org.postgresql.Driver
defaultPort = 5432
connectionUrlFormat = jdbc:postgresql://{0}:{1}/{2}
testQuery = SELECT 1 AS test
defaultCatalogName = postgres
defaultSchema = public
streamingFetchSize = 100
streamingAutoCommit = false

[db2]
displayName = DB2
typeClass = com.splunk.dbx.sql.type.impl.DB2
defaultPort = 3700

[informix]
displayName = Informix
typeClass = com.splunk.dbx.sql.type.impl.Informix
defaultPort = 1526

[SUNDB]
displayName = SUNDB
jdbcDriverClass = sunje.sundb.jdbc.SundbDriver
defaultPort = 22581
connectionUrlFormat = jdbc:sundb://{0}:{1}/{2}
testQuery = select 1 from dual
defaultCatalogName = test
defaultSchema = test
streamingAutoCommit = false

            SUNDB 프로파일을 추가한다. defaultPort SUNDB의 서비스 리스너 포트를 등록한다.




3.3. SUNDB 연결

            Panel 상단의 “Splunk DB Connect” 부분을 클릭하여 SUNDB 연결의 설정을 시작한다.



            Connection을 설정하는 화면으로 이동한다.



            “Database connections in Splunk Manager” 버튼을 클릭하여 “External Databases” 연결 화면으로 이동한다.



            “새로 만들기버튼을 클릭하여 Connection정보 입력화면으로 이동한다.



            입력필드에 SUNDB 연결 정보를 입력한다.
구분
비고
이름
sundb
Description
Database Type
SUNDB
SUNDB 선택
Transaction Isolation Level
DATABASE_SETTING

Host
127.0.0.1
SUNDB가 설치된 서버의 IP를 입력
포트
22581
SUNDB 서비스 리스너의 포트 설정
사용자 이름
TEST
SUNDB UserID
암호
test
SUNDB PASSWORD
암호 확인
test

Database
Test



            연결정보를 입력하고 저장버튼을 클릭한다.




            SUNDB의 설정이 완료되면 External Databases 목록에 SUNDB 정보가 표시 된다.

3.4. SUNDB에서 검색 하기

            Splunk 로고를 클릭하여 Main화면으로 이동한다.




            Splunk DB Connect Panel에서 “Database Query” 를 선택한다. Database Query검색화면이 표시되면 “Database” 부분에서 “sundb”를 선택하고, SQL을 입력하여 SUNDB에서 데이터를 검색할 수 있다.