0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Splunkで使用されているPythonを対話モードで起動する

Posted at

今回もSplunkのカスタムサーチコマンド作成の話で投稿します。
カスタムサーチコマンドを作成する際は、(SplunkではUbuntuとは別にPython本体を持っているため)Pythonにどのようなライブラリがあるかわからないため、カスタムサーチコマンドを直接編集しサーチバーでの実行を繰り返す作業をしなければならなくて非常に面倒でした。そこで、少しでも開発が楽になるように、Splunk上のPythonを対話モードで起動する方法を調べましたので、記載することにします。
なお、今回はUbuntu18.04で検証していますので、他のOSの場合は使えない場合があることをご承知ください。

Splunk上のPythonを動かす

以下のコマンドを実行します。Splunk上のPythonが動作します。

# /opt/splunk/bin/splunk cmd python
Python 2.7.17 (default, Jan  7 2020, 18:09:21) 
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

この対話モードを利用してPythonの動作環境を調べれば多少は開発しやすくなると思います。
あと、外部ライブラリも調べてみましたが、残念ながらほとんど入っていませんでした。外部ライブラリを無理やり入れる方法は、別の投稿で記載します。


動作環境
Ubuntu 18.04.4 LTS
Splunk 8.0.2.1

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?