Splunk Search

regex問題のトラブルシューティング方法について

cwl
Contributor

以下のサーチ文で、regexreplacementプロセッサーがかなりのCPUリソースを使用していることまではわかりましたが、どのように問題のREGEXを特定できますでしょうか。

index=_internal source=*metrics.log* group=pipeline name=typing | timechart limit=50 span=1h per_hour(cpu_seconds) by processor

例えば、どのsourcetypeやhostなどからのREGEXがCPUを使っているかを特定する方法はありますでしょうか。

0 Karma
1 Solution

cwl
Contributor

Splunk Enterprise 6.6 および 7.0 から、limits.conf に以下のパラメータが追加されました。

regex_cpu_profiling = <bool>
* Enable CPU time metrics for RegexProcessor. Output will be in the 
  metrics.log file.
  Entries in metrics.log will appear per_host_regex_cpu, per_source_regex_cpu,
  per_sourcetype_regex_cpu, per_index_regex_cpu.
* Default: false

regex_cpu_profiling を true に設定し、splunk を再起動することにより、metrics.log に per_host_regex_cpu、per_source_regex_cpu、per_sourcetype_regex_cpu、per_index_regex_cpu のような情報が追加されます。
そして、以下のサーチ文を使うことにより、どの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpu) by series

また、以下のサーチ文を使うことにより、event 毎にどの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpupe) by series

なお、デフォルトでは、もっともCPUリソースを使用する上位の10 sourceytypeしかmetrics.logに記録されず、10より多くのsourcetypeを記録したい場合は、記録したい数をmaxseriesに設定する必要があります。

[metrics]
maxseries = <integer>
* The number of series to include in the per_x_thruput reports in metrics.log.
* Default: 10

View solution in original post

cwl
Contributor

Splunk Enterprise 6.6 および 7.0 から、limits.conf に以下のパラメータが追加されました。

regex_cpu_profiling = <bool>
* Enable CPU time metrics for RegexProcessor. Output will be in the 
  metrics.log file.
  Entries in metrics.log will appear per_host_regex_cpu, per_source_regex_cpu,
  per_sourcetype_regex_cpu, per_index_regex_cpu.
* Default: false

regex_cpu_profiling を true に設定し、splunk を再起動することにより、metrics.log に per_host_regex_cpu、per_source_regex_cpu、per_sourcetype_regex_cpu、per_index_regex_cpu のような情報が追加されます。
そして、以下のサーチ文を使うことにより、どの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpu) by series

また、以下のサーチ文を使うことにより、event 毎にどの sourcetype がもっとも CPU リソースを使用しているかを確認することができます。

index=_internal host=<調査対象ホストサーバ> source=*metrics.log* group=per_sourcetype_regex_cpu | timechart max(cpupe) by series

なお、デフォルトでは、もっともCPUリソースを使用する上位の10 sourceytypeしかmetrics.logに記録されず、10より多くのsourcetypeを記録したい場合は、記録したい数をmaxseriesに設定する必要があります。

[metrics]
maxseries = <integer>
* The number of series to include in the per_x_thruput reports in metrics.log.
* Default: 10
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...