All Apps and Add-ons

Splunk DB connect to rename columns into Japanese

satoshitonoike
Engager

This question has both English and 日本語 on it. Please be read and give some answer.

I'm trying to use Splunk DB connection with MySQL for analyze the data.
As the environment, I use two AWS instances (develop and production) and contains MySQL database for each in same settings.
For develop environment AWS, could setup the DB input and shows data properly(I mean the columns rename Japanese automatically).
However, the other one setup as same as what I did on develop environment's search returns ???? on Japanese fields.

On the query I use the command like below.
SELECT section_nm as "部門",
territory_nm as "領域名",
:
FROM ticket.trn_ticket_plan_act
WHERE dataflag='0'

One can use this query as proper but another is not.
What is the problem on this situation?
Addition to it, I don't setup DB output and DB lookup. Could be any reason that working well because of those?

Regards.

今Splunk DB connect を使い、MySQLからデータを取得し分析ツールに適応したいと思ってセットアップをしています。
現在AWS上に2つのインスタンス(開発環境と本番環境)を所有し、2つの同じ設定をしているMySQLを構築しています。
開発環境と本番環境で同様の設定をしているにも関わらず、開発環境ではquery上で編集した日本語名でサーチ結果がかえって来るものの、本番環境では????となり上手くデータのカラム名を変更出来ていません。

設定したqueryは下記のようになっております。
SELECT section_nm as "部門",
territory_nm as "領域名",
:
FROM ticket.trn_ticket_plan_act
WHERE dataflag='0'

どこに問題があると考えられるでしょうか?
これに付随して、DB outputとDB lookupには設定を行っていないのですが、それが影響している可能性があるでしょうか?
片方の環境では上手くいってしまったため、気にしていなかったのですが、DB outputとDB lookup簡潔にいうと何をするための操作なのでしょうか?

質問が多くて申し訳ありませんが、よろしくお願いします。
出来れば、日本語の答えを期待しております。

0 Karma
1 Solution

melonman
Motivator

DB Lookup
Splunkの中のデータとDBのデータを突合
例えば、ログ中のuseridをつかって、DBMSのテーブル上のuseridに紐づくuser名や属性を取得

DB Output
Splunkの中のデータをDBMSへ出力

http://docs.splunk.com/Documentation/DBX/3.0.1/DeployDBX/HowSplunkDBConnectworks

で、本題の文字化けの件ですが、DB側の文字コードかDBに対するクライアント側の文字コードが違うとか、
ちょっとした環境依存がある感じがします。

それよりも、Splunkにデータを取り込む際に、フィールド名を日本語にしないほうがいいと思われます。サーチコマンドで、日本語のフィールド名をうまく処理できないものがある可能性があるのと、以下のような記述もあるので、フィールド名は英数のままで取り込んで、諸々のサーチを行ってから最終結果出力の際にrenameコマンド等で日本語にしたほうが安全です。

[<field name>]
* Name of the field you're configuring.
* Follow this stanza name with any number of the following attribute/value
  pairs.
* Field names can only contain a-z, A-Z, 0-9, and  _, but cannot begin with a
  number or _

ではでは!

View solution in original post

0 Karma

melonman
Motivator

DB Lookup
Splunkの中のデータとDBのデータを突合
例えば、ログ中のuseridをつかって、DBMSのテーブル上のuseridに紐づくuser名や属性を取得

DB Output
Splunkの中のデータをDBMSへ出力

http://docs.splunk.com/Documentation/DBX/3.0.1/DeployDBX/HowSplunkDBConnectworks

で、本題の文字化けの件ですが、DB側の文字コードかDBに対するクライアント側の文字コードが違うとか、
ちょっとした環境依存がある感じがします。

それよりも、Splunkにデータを取り込む際に、フィールド名を日本語にしないほうがいいと思われます。サーチコマンドで、日本語のフィールド名をうまく処理できないものがある可能性があるのと、以下のような記述もあるので、フィールド名は英数のままで取り込んで、諸々のサーチを行ってから最終結果出力の際にrenameコマンド等で日本語にしたほうが安全です。

[<field name>]
* Name of the field you're configuring.
* Follow this stanza name with any number of the following attribute/value
  pairs.
* Field names can only contain a-z, A-Z, 0-9, and  _, but cannot begin with a
  number or _

ではでは!

0 Karma

satoshitonoike
Engager

melonmanさん

的確なご回答、ありがとうございます。
文字化けに関しては、クライアント側の文字コードの問題でした。
そうですね、仕様、作法ともに考慮すれば英語名で扱う方がよいですよね。
今後は、そちらも気を付けてやっていきたいと思います。

0 Karma

jkat54
SplunkTrust
SplunkTrust

Can you create a DB view on the table with your select statement and then use it?

That's better than full text searching a db anyways.

0 Karma

satoshitonoike
Engager

I could select statement but, in search on the apps not work because of character set became other format which I used in dashboards or panels in it.
However, I solved the problems and now work properly.
Thank you for your advice.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...