일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Python
- GitHub
- SPL
- pycharm
- Button
- dataframe
- javascript
- 삼성소프트웨어멤버십
- Numpy
- Splunk
- pandas
- CNN
- 알고리즘
- pip
- keras
- mariadb
- GT-S80
- mean
- synology
- DFS
- RNN
- LSTM
- install
- SciPy
- imread
- Series
- index
- ipad
- Lotto
- E-P1
Archives
- Today
- Total
잠토의 잠망경
[Splunk] python 연계 01 본문
https://docs.splunk.com/Documentation/Splunk/latest/Search/Customsearchcommandshape
Custom search command example - Splunk Documentation
Download topic as PDF Custom search command example This following is an example of a custom search command called shape. The shape command categorizes events based on the event line count (tall or short) and line length (thin, wide, and very_wide) and whe
docs.splunk.com
1. app을 먼저 만든다.

2. 앱 만들기를 클릭한다.

3. 내용 채우기

4. 추가된 내용을 볼 수 있다.

5. app이 설치된 폴더로 이동한다.

6. pip install 진행한다.
$pip install -t . splunk-sdk

차가된 사항

7. python code를 작성한다. 파일이름(mycommand.py)

import sys
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration
@Configuration()
class MyCommand(StreamingCommand):
def stream(self, records):
for record in records:
record['hello'] = 'world'
yield record
if __name__ == '__main__':
dispatch(MyCommand, sys.argv, sys.stdin, sys.stdout, __name__)

8. 등록하기(commands.conf) 파일을 만든다.

파일 내용
[mycommand]
chunked=true
filename=mycommand.py
9. 재실행

10. 재실행

11. 사용자 권한 나눠주기



12. 검색
index=main | mycommand | stats count by hello

Comments