Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Firewall filterlogs via telegraf in influxdb

    Scheduled Pinned Locked Moved Deutsch
    2 Posts 1 Posters 155 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      n300
      last edited by

      Hallo zusammen,

      hat es von euch schon jemand geschafft das filter.log mit telegraf und eventuell grok anständig zu parsen um es dann in Grafana ordentlich auswerten zu können?
      Da ich ja nur ne 2100er im HomeLab habe hätte ich solche Daten lieber in der InfluxDB, da hier die Performance einfach deutlich besser ist. Die WebUI Performance ist leider ein ziemlicher Pain auf dem kleinen SoC der 2100.

      Hab schon einiges versucht und gesucht. Auch die KI bemüht. Leider funktionierte bislang nichts davon, was ich gefunden habe.
      Die pfBlocker Logs hab ich schon in Grafana, das funktioniert gut. Aber die nativen filter logs sind vom Format her etwas "anstrengend" zu parsen.

      1 Reply Last reply Reply Quote 0
      • N
        n300
        last edited by

        Ich habs mittlerweile hinbekommen.
        Falls es jemandem hilft:

        Hier das config Snipped für telegraf.conf

        [[inputs.tail]]
          files = ["/var/log/filter.log"]
          from_beginning = false
          pipe = false
          watch_method = "inotify"
          
          # Data Format Configuration
          data_format = "grok"
          # Simple pattern that captures the syslog header and comma-separated filterlog data
          grok_patterns = [
          #IPv4
          "%{SYSLOGTIMESTAMP:timestamp} %{DATA:hostname} %{WORD:process}\\[%{INT:pid}\\]: %{INT:rule_number},%{DATA:sub_rule},%{DATA:anchor},%{DATA:tracking_id},%{DATA:interface},%{DATA:reason},%{DATA:action},%{DATA:direction},%{INT:ip_version},%{DATA:TOS},%{DATA:ECN},%{DATA:TTL},%{DATA:ID},%{DATA:offset},%{DATA:Flags},%{DATA:protocol_id},%{DATA:protocol},%{INT:length},%{DATA:source_ip},%{DATA:destination_ip},%{INT:source_port},%{INT:destination_port},%{INT:data_length}"
          ,
          #IPv6
          "%{SYSLOGTIMESTAMP:timestamp} %{DATA:hostname} %{WORD:process}\\[%{INT:pid}\\]: %{INT:rule_number},%{DATA:sub_rule},%{DATA:anchor},%{DATA:tracking_id},%{DATA:interface},%{DATA:reason},%{DATA:action},%{DATA:direction},%{INT:ip_version},%{DATA:class},%{DATA:flow_level},%{DATA:hop_limit},%{DATA:protocol_id},%{DATA:protocol},%{INT:length},%{DATA:source_ip},%{DATA:destination_ip},%{INT:source_port},%{INT:destination_port},%{INT:data_length}"]
        
          
          # Custom measurement name
          name_override = "pfsense_filterlog"
          
          # Static Tags
          [inputs.tail.tags]
            log_type = "pfsense_firewall"
        

        Hab noch nen Spalten-Dreher im IPv6 Pattern drinnen und das Grafana-Output muss ich noch etwas hübsch machen. Aber im Groben tuts was ich wollte.

        1e05e1f5-536c-490f-af9f-93d40c974229-image.png

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.