# Auditbeat fileintegrity module cannot detect file update from vi

**URL:** https://discuss.elastic.co/t/auditbeat-fileintegrity-module-cannot-detect-file-update-from-vi/211920
**Category:** SIEM
**Created:** [December 15, 2019, 7:00pm UTC](https://discuss.elastic.co/t/auditbeat-fileintegrity-module-cannot-detect-file-update-from-vi/211920 "2019-12-15T19:00:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jittinan](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jittinan](https://discuss.elastic.co/u/jittinan)
#### Post date: [December 15, 2019, 7:00pm UTC](https://discuss.elastic.co/t/auditbeat-fileintegrity-module-cannot-detect-file-update-from-vi/211920/1 "2019-12-15T19:00:57Z")

</div>

from auditbeat documents,file integrity module detect changes by using inotify events from os.it works correctly with created,deleted,moved events by sending a message for each event to elasticserch but when the monitored file is modified by vim editor,file integrity module catch many events.After I debug how vim editor cause these events by using inotifywait.I notice that vim create/update/delete many temporary files (.swp,.swx,4913, etc.) so it should be reasonable if file integrity module catch these events .However I cannot find any message from file integrity module which notify about file updated event. After I turn on debug log on auditbeat,I notice that file integrity module can detect write event but it does not notify file updated event. please see my log snippets.At time 2019-12-14T22:34:52.557+0700 is what I mention to.  
1.open file with #vi test.conf  
2019-12-14T22:16:12.266+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "CREATE"}  
2019-12-14T22:16:12.266+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swx", "event\_flags": "REMOVE"}  
2019-12-14T22:16:12.266+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "REMOVE"}  
2019-12-14T22:16:12.266+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/.test.conf.swp", "took": 191670, "event": {"old": null, "new": {"timestamp":"2019-12-14T15:16:12.26638284Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":4096,"mtime":"2019-12-14T15:16:12.264689909Z","ctime":"2019-12-14T15:16:12.264689909Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"created","hash":{"sha1":"2fd9f6ff74f92b1802066124df9f146b5dc52610"}}}}  
2019-12-14T22:16:12.267+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/.test.conf.swx", "took": 6160, "event": {"old": null, "new": {"timestamp":"2019-12-14T15:16:12.266606262Z","path":"/root/test/.test.conf.swx","info":null,"source":"fsnotify","action":"deleted"}}}  
2019-12-14T22:16:12.268+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "CREATE"}  
2019-12-14T22:16:12.269+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "WRITE"}  
2019-12-14T22:16:12.270+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "CHMOD"}  
2019-12-14T22:16:16.269+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "WRITE"}  
2019-12-14T22:16:16.270+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/.test.conf.swp", "took": 297524, "event": {"old": {"timestamp":"2019-12-14T15:16:12.270272121Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"","group":"","size":4096,"mtime":"2019-12-14T15:16:12.264689909Z","ctime":"2019-12-14T15:16:12.264689909Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"attributes\_modified","hash":{"sha1":"2fd9f6ff74f92b1802066124df9f146b5dc52610"}}, "new": {"timestamp":"2019-12-14T15:16:16.270041359Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":12288,"mtime":"2019-12-14T15:16:16.2686964Z","ctime":"2019-12-14T15:16:16.2686964Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"updated","hash":{"sha1":"730042f3e0de417f03908dc0307565a75e24e7b7"}}}}  
2.write fille with :w  
2019-12-14T22:34:52.551+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/4913", "event\_flags": "REMOVE"}  
2019-12-14T22:34:52.551+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf", "event\_flags": "RENAME"}  
2019-12-14T22:34:52.552+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf~", "event\_flags": "CREATE"}  
2019-12-14T22:34:52.552+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/4913", "took": 6230, "event": {"old": null, "new": {"timestamp":"2019-12-14T15:34:52.551963912Z","path":"/root/test/4913","info":null,"source":"fsnotify","action":"deleted"}}}  
2019-12-14T22:34:52.553+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/test.conf", "took": 157659, "event": {"old": {"timestamp":"2019-12-14T15:34:28.493429017Z","path":"/root/test/test.conf","info":{"inode":100974249,"uid":0,"gid":0,"sid":"","owner":"","group":"","size":0,"mtime":"2019-12-14T15:03:43.629492538Z","ctime":"2019-12-14T15:03:43.629492538Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"scan","action":"none","hash":{"sha1":"da39a3ee5e6b4b0d3255bfef95601890afd80709"}}, "new": {"timestamp":"2019-12-14T15:34:52.552019167Z","path":"/root/test/test.conf","info":{"inode":100974253,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":2,"mtime":"2019-12-14T15:34:52.550520431Z","ctime":"2019-12-14T15:34:52.550520431Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"moved","hash":{"sha1":"e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"}}}}  
2019-12-14T22:34:52.554+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf", "event\_flags": "CREATE"}  
2019-12-14T22:34:52.554+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/test.conf~", "took": 84476, "event": {"old": null, "new": {"timestamp":"2019-12-14T15:34:52.552237997Z","path":"/root/test/test.conf~","info":{"inode":100974249,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":0,"mtime":"2019-12-14T15:03:43.629492538Z","ctime":"2019-12-14T15:34:52.550520431Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"created","hash":{"sha1":"da39a3ee5e6b4b0d3255bfef95601890afd80709"}}}}  
2019-12-14T22:34:52.555+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf", "event\_flags": "WRITE"}  
2019-12-14T22:34:52.555+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf", "event\_flags": "CHMOD"}  
2019-12-14T22:34:52.556+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "WRITE"}  
2019-12-14T22:34:52.557+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/test.conf~", "event\_flags": "REMOVE"}  
2019-12-14T22:34:52.557+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/.test.conf.swp", "took": 131000, "event": {"old": {"timestamp":"2019-12-14T15:34:28.493169456Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"","group":"","size":12288,"mtime":"2019-12-14T15:30:47.314117427Z","ctime":"2019-12-14T15:30:47.314117427Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"scan","action":"none","hash":{"sha1":"da611b007320981c61dbb7f642c79f5ff020da55"}}, "new": {"timestamp":"2019-12-14T15:34:52.556603673Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":12288,"mtime":"2019-12-14T15:34:52.552520435Z","ctime":"2019-12-14T15:34:52.552520435Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"updated","hash":{"sha1":"530808091273a1887bfeeb6dba788a4087ff8f1b"}}}}  
2019-12-14T22:34:52.558+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/test.conf~", "took": 7128, "event": {"old": {"timestamp":"2019-12-14T15:34:52.552237997Z","path":"/root/test/test.conf~","info":{"inode":100974249,"uid":0,"gid":0,"sid":"","owner":"","group":"","size":0,"mtime":"2019-12-14T15:03:43.629492538Z","ctime":"2019-12-14T15:34:52.550520431Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"created","hash":{"sha1":"da39a3ee5e6b4b0d3255bfef95601890afd80709"}}, "new": {"timestamp":"2019-12-14T15:34:52.557249178Z","path":"/root/test/test.conf~","info":null,"source":"fsnotify","action":"deleted"}}}  
2019-12-14T22:34:56.558+0700 DEBUG [file\_integrity] file\_integrity/eventreader\_fsnotify.go:136 Received fsnotify event {"file\_path": "/root/test/.test.conf.swp", "event\_flags": "WRITE"}  
2019-12-14T22:34:56.558+0700 DEBUG [file\_integrity] file\_integrity/metricset.go:252 File changed since it was last seen {"file\_path": "/root/test/.test.conf.swp", "took": 258151, "event": {"old": {"timestamp":"2019-12-14T15:34:52.556603673Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"","group":"","size":12288,"mtime":"2019-12-14T15:34:52.552520435Z","ctime":"2019-12-14T15:34:52.552520435Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"updated","hash":{"sha1":"530808091273a1887bfeeb6dba788a4087ff8f1b"}}, "new": {"timestamp":"2019-12-14T15:34:56.55847786Z","path":"/root/test/.test.conf.swp","info":{"inode":100974252,"uid":0,"gid":0,"sid":"","owner":"root","group":"root","size":12288,"mtime":"2019-12-14T15:34:56.557527027Z","ctime":"2019-12-14T15:34:56.557527027Z","type":"file","mode":420,"setuid":false,"setgid":false,"origin":null},"source":"fsnotify","action":"updated","hash":{"sha1":"c4eee1d7c73f8f04be5010ae50db5a8a89f1e993"}}}}

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 12, 2020, 7:00pm UTC](https://discuss.elastic.co/t/auditbeat-fileintegrity-module-cannot-detect-file-update-from-vi/211920/2 "2020-01-12T19:00:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
