# Parse Mcafee audit log file with Logstash

**URL:** <https://discuss.elastic.co/t/parse-mcafee-audit-log-file-with-logstash/302946>\
**Category:** Logstash\
**Created:** [April 21, 2022, 4:05pm UTC](https://discuss.elastic.co/t/parse-mcafee-audit-log-file-with-logstash/302946 "2022-04-21T16:05:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 21, 2022, 6:44pm UTC](https://discuss.elastic.co/t/parse-mcafee-audit-log-file-with-logstash/302946/2 "2022-04-21T18:44:37Z")

</div>

The events are delimited by a line of underscores, so you could use a multiline codec to combine all the lines for a single event.

```
file {
    path => "/home/user/foo.txt"
    sincedb_path => "/dev/null"
    start_position => beginning
    codec => multiline {
        pattern => " _______"
        negate => true
        what => previous
        auto_flush_interval => 2
        multiline_tag => ""
    }
}

```

Then use grok

```
        grok {
        break_on_match => false
        match => {
            "message" => [
                "Timestamp%{SPACE}:%{SPACE}(?<Timestamp>[^\n]+)\n",
                "User%{SPACE}:%{SPACE}(?<User>[^\n]+)\n",
                "Action%{SPACE}:%{SPACE}(?<Action>[^\n]+)\n",
                "Source Type%{SPACE}:%{SPACE}(?<Source Type>[^\n]+)\n",
                "Source ID%{SPACE}:%{SPACE}(?<Source ID>[^\n]+)\n",
                "Appliance%{SPACE}:%{SPACE}(?<Appliance>[^\n]+)\n",
                "User-Agent%{SPACE}:%{SPACE}(?<User-Agent>[^\n]+)\n",
                "Role%{SPACE}:%{SPACE}(?<Role>[^\n]+)\n"
            ]
        }
    }

```

I would recommend against having spaces in your field names. Use [SourceType] rather than [Source Type].

---

_[View the full topic](https://discuss.elastic.co/t/parse-mcafee-audit-log-file-with-logstash/302946)._
