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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...