Monitoring Splunk

ログファイルを再配置した場合の挙動について

yyyharmonia
New Member

「Monitor files and directories」を使って特定のディレクトリに配置したログファイルをインデキシングしているのですが、インデキシング対象のログファイルが破損した場合の対応方法についてお聞きしたいです。

  • ログファイルが破損して再度インデキシングを行う場合、バックアップしておいたログファイルをモニターしているディレクトリに戻す(コピーする)だけで良いのでしょうか?別に何か設定などの操作を行う必要はあるのでしょうか?

    • 例:test_log1.logというファイルを含む/data/ディレクトリ以下をモニターするようにしていて、このtest_log1.logが破損したときバックアップしておいたものを/dataにコピーしなおすだけで良いのでしょうか?
  • バックアップからログファイルをコピーした際、イベントデータが重複してインデキシングされてしまうことがありますが、重複インデキシングを回避する方法はあるのでしょうか?(一度インデックス中をcleanしてからコピーし直すなど)

なお、Splunkのバージョンは6.2.5となります。
よろしくお願いいたします。

0 Karma

harsmarvania57
SplunkTrust
SplunkTrust

Hi @yyyharmonia,

I am using google translator to translate your question and based on understanding you want to restore test_log1.log in /data/ directory from backup because test_log1.log is corrupted. In that case when you restore test_log1.log, restart splunkforwarder once so it will index test_log1.log file again but there might be chances that you will end-up with duplicate data in splunk if your test_log1.log corrupted in half-way, in that case you can use | delete command to hide those duplicate data from searching before restoring test_log1.log from backup but you need can_delete role to run this command even admin can't run this command.

So for example you have duplicate data from 11 AM to 1 PM by checking restored test_log1.log and data which is available in splunk so for those events run your search like index=<index name> source=/data/test_log1.log | delete and run this query for 11 AM to 1 PM so it will hide those data from searching again.

After restoring file if it will not index again then please follow below steps

1.) Stop Splunk on Universal forwarder
2.) Run command $SPLUNK_HOME/bin/splunk cmd btprobe -d $SPLUNK_HOME/var/lib/splunk/fishbucket/splunk_private_db --file /data/test_log1.log --reset , this command will remove /data/test_log1.log from fishbucket so forwarder will read it again.
3.) Start Splunk on Universal forwarder.

I hope this helps.

Thanks,
Harshil

micahkemp
Champion

Upvoted for the effort alone.

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 ...