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
Ultra Champion

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!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...