Splunk Enterprise

splunk duplicate events after forwarder running in a container gets restarted

rajholla_optum
Engager

We have splunk forwarder running in a docker container and all our workloads which is also running in different containers and writes logs to NFS file mounts on dedicated location.
The problem here is , when container running forwarder restarts it simply sees all file as new and reads them again causing duplicate events.
I assume the problem here is, when forwarder starts in container it becomes new installation of a forwarder.
Can this be solved by persisting forwarder file system(/opt/splunk/splunkforworder/*) ? Or is there any alternative ?

Tags (1)
0 Karma
1 Solution

mattymo
Splunk Employee
Splunk Employee

if persisting the forwarder is possible (im not a docker guy) then it would solve the issue as Splunk would then remember where it was in each of the files. check out the fishbucket!

https://www.splunk.com/blog/2008/08/14/what-is-this-fishbucket-thing/

- MattyMo

View solution in original post

rfaircloth_splu
Splunk Employee
Splunk Employee

I would also be very concerned the NFS portion of this solution would allow for loss of logs if a close happens without the proper time for flushing to occur. Normally streaming to remote mounts is considered a bad practice. Consider the use of the splunk docker log driver for OS logs and other means of streaming delivery such rsyslog or HEC to avoid the file IO.

rajholla_optum
Engager

After persisting "/opt/splunk/splunkforwarder" forwarder was able to read the files at specific offset.
Information about fishbucket was very really helpful.

Thank you!

0 Karma

mattymo
Splunk Employee
Splunk Employee

if persisting the forwarder is possible (im not a docker guy) then it would solve the issue as Splunk would then remember where it was in each of the files. check out the fishbucket!

https://www.splunk.com/blog/2008/08/14/what-is-this-fishbucket-thing/

- MattyMo

MuS
Legend

Is the Splunk forwarder reading from NFS or writing its logs to NFS?
Check any existing inputs.conf for an option called crcSalt if this is set it can produce duplicate events.

0 Karma

rajholla_optum
Engager

Thank you for your time !

Forwarder reading log files from NFS.
Forwarder writes everything into container write layer which wont be persisted after restart.
We are not using crcSlat in our inputs.conf

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...