# \[solved\] Postfix parser not working

**URL:** <https://discourse.crowdsec.net/t/solved-postfix-parser-not-working/2547>\
**Category:** crowdsec\
**Created:** [May 8, 2025, 10:40am UTC](https://discourse.crowdsec.net/t/solved-postfix-parser-not-working/2547 "2025-05-08T10:40:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DynamicOpsArchitect](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@DynamicOpsArchitect](https://discourse.crowdsec.net/u/DynamicOpsArchitect)\
**Post date:** [May 8, 2025, 10:40am UTC](https://discourse.crowdsec.net/t/solved-postfix-parser-not-working/2547/1 "2025-05-08T10:40:27Z")

</div>

Hello everyone,

CrowdSec is new to me, this is my first post here and of course a question about parsers 😆 especially for Postfix.

First some information.

CrowdSec comes from openSUSE :

> **[Crowdsourced protection against malicious IPs](https://build.opensuse.org/package/show/security/crowdsec)**
>
> CrowdSec is a free, modern & collaborative behavior detection engine, coupled with a global IP reputation network. It stacks on fail2ban's philosophy but is IPV6 compatible and 60x faster (Go vs Python), it uses Grok patterns to parse
> logs and...

CrowdSec Version:

```auto
cscli version
version: v1.6.8-f209766e
Codename: alphaga
BuildDate: 2025-04-19T12:00:00Z
GoVersion: 1.24.2
Platform: linux
libre2: C++
User-Agent: crowdsec/v1.6.8-f209766e-linux
Constraint_parser: >= 1.0, <= 3.0
Constraint_scenario: >= 1.0, <= 3.0
Constraint_api: v1
Constraint_acquis: >= 1.0, < 2.0

```

Collections:

```auto
cscli collections list
─────────────────────────────────────────────────────────────────────────────────────
 COLLECTIONS                                                                         
─────────────────────────────────────────────────────────────────────────────────────
 Name 📦 Status Version Local Path                             
─────────────────────────────────────────────────────────────────────────────────────
 crowdsecurity/postfix ✔ enabled 0.4 /etc/crowdsec/collections/postfix.yaml 
─────────────────────────────────────────────────────────────────────────────────────

```

Parsers:

```auto
cscli parsers list
───────────────────────────────────────────────────────────────────────────────────────────────────────────
 PARSERS                                                                                                   
───────────────────────────────────────────────────────────────────────────────────────────────────────────
 Name 📦 Status Version Local Path                                           
───────────────────────────────────────────────────────────────────────────────────────────────────────────
 crowdsecurity/postfix-logs ✔ enabled 0.9 /etc/crowdsec/parsers/s01-parse/postfix-logs.yaml    
 crowdsecurity/postscreen-logs ✔ enabled 0.3 /etc/crowdsec/parsers/s01-parse/postscreen-logs.yaml 
 crowdsecurity/whitelists ✔ enabled 0.3 /etc/crowdsec/parsers/s02-enrich/whitelists.yaml     
───────────────────────────────────────────────────────────────────────────────────────────────────────────

```

Acquisition for Postfix /etc/crowdsec/acquis.d/postfix.yaml

```auto
filenames:
  - /var/log/mail
labels:
  type: syslog

```

```auto
cscli metrics show acquisition
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Acquisition Metrics │
├────────────────────┬────────────┬──────────────┬────────────────┬────────────────────────┬───────────────────┤
│ Source │ Lines read │ Lines parsed │ Lines unparsed │ Lines poured to bucket │ Lines whitelisted │
├────────────────────┼────────────┼──────────────┼────────────────┼────────────────────────┼───────────────────┤
│ file:/var/log/mail │ 1.16k │ - │ 1.16k │ - │ - │
╰────────────────────┴────────────┴──────────────┴────────────────┴────────────────────────┴───────────────────╯

```

As yo can seee, no lines are parsed.

I’ve already gone through various forum posts and troubleshooting guides, unfortunately without success.

What particularly puzzles me is the following:

```auto
cscli explain -v --log "2025-05-06T17:56:54.132546+02:00 mx01 postfix/smtpd[14483]: warning: non-SMTP command from doriansco.com[193.233.203.93]: Message-ID: <80cf862dd91d373c1fb5fc57a3674d46b836f7@shopaways.org>" --type syslog
WARNING Line 0/1 is missing evt.StrTime. It is most likely a mistake as it will prevent your logs to be processed in time-machine/forensic mode. file=/tmp/cscli_explain326842116/parser-dump.yaml
line: 2025-05-06T17:56:54.132546+02:00 mx01 postfix/smtpd[14483]: warning: non-SMTP command from doriansco.com[193.233.203.93]: Message-ID: <80cf862dd91d373c1fb5fc57a3674d46b836f7@shopaways.org>
        ├ s01-parse
        | ├ 🔴 crowdsecurity/postfix-logs
        | └ 🔴 crowdsecurity/postscreen-logs
        └-------- parser failure 🔴

```

As far as I can understand grok, this line should be hit by the following section in /etc/crowdsec/parsers/s01-parse/postfix-logs.yaml:

```auto
      apply_on: message
      pattern: 'warning: non-SMTP command from %{POSTFIX_HOSTNAME:remote_host}\[%{IP:remote_addr}\]: %{GREEDYDATA:command}'
      statics:
        - meta: log_type_enh
          value: non-smtp-command

```

What am I misssing?

THX so far!

---

<div class="post-metadata">

**Author:** ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)\
**Post date:** [May 9, 2025, 7:45am UTC](https://discourse.crowdsec.net/t/solved-postfix-parser-not-working/2547/2 "2025-05-09T07:45:23Z")

</div>

You are missing the `crowdsecurity/linux` collection which installs the `s00` parser to prepare the lines for the postfix parser (well for the s01 stage).

---

<div class="post-metadata">

**Author:** ![DynamicOpsArchitect](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@DynamicOpsArchitect](https://discourse.crowdsec.net/u/DynamicOpsArchitect)\
**Post date:** [May 9, 2025, 8:58am UTC](https://discourse.crowdsec.net/t/solved-postfix-parser-not-working/2547/3 "2025-05-09T08:58:58Z")

</div>

Oh boy … typical newbie at its best. 🤦 Installing `crowdsecurity/linux` collection indeed solved my problem. Many thanks!
