How to use pipeline in promtail/loki to count specific loglines (noob question)

Is there a simple method to count certain logfiles.
For instance:
The response codes in a standard apache log
or
The number of ERROR messages in a log file
or
The number of times FooBar is in the log

If i try to follow the standard documentation my promtail will not start anymore.

Here is part of my config:

Promtail Server Config

server:
http_listen_port: 9080
grpc_listen_port: 0

Positions

positions:
filename: /tmp/positions.yaml

Loki Server URL

clients:

scrape_configs:

  • job_name: access_log
    static_configs:
    • targets:
      • localhost
        labels:
        job: access_log
        host: lsrv2289
        path: /var/log/httpd/access_log
  • job_name: ssl_request_log
    static_configs:
    • targets:
      • localhost
        labels:
        job: ssl_request_log
        host: lsrv2289
        path: /var/log/httpd/ssl_request_log

Okay iu found a way to do 1 extraction. Response 200. But how do i realize more rules/regex???

scrape_configs:

  • job_name: access_log
    pipeline_stages:
    • match:
      selector: ‘{job=“access_log”} != “info”’
      stages:

      The regex stage tries to extract a Go panic by looking for panic:

      in the log message.

      • regex:
        expression: “.(?P 200 .)”

      The metrics stage is going to increment a panic_total metric counter

      which Promtail exposes. The counter is only incremented when panic

      was extracted from the regex stage.

      • metrics:
        resp200_total:
        type: Counter
        description: “total count of 200 response”
        source: resp200
        config:
        action: inc
        static_configs:
      • targets:
        • localhost