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

netflow and graylog

Scheduled Pinned Locked Moved General pfSense Questions
19 Posts 2 Posters 2.8k 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.
  • M
    michmoor LAYER 8 Rebel Alliance
    last edited by Jun 29, 2023, 6:48 PM

    @mcury Hey !
    Following up on the other thread, can you help out and send over the netflow dashboard config for Graylog!

    Firewall: NetGate,Palo Alto-VM,Juniper SRX
    Routing: Juniper, Arista, Cisco
    Switching: Juniper, Arista, Cisco
    Wireless: Unifi, Aruba IAP
    JNCIP,CCNP Enterprise

    M 1 Reply Last reply Jun 29, 2023, 7:03 PM Reply Quote 0
    • M
      mcury @michmoor
      last edited by mcury Jun 29, 2023, 7:06 PM Jun 29, 2023, 7:03 PM

      @michmoor Hey, let me try to put it all here in a way that isn't too long and easy to understand.
      Assuming that you have Mongod, Java and Graylog installed, and working.

      But first, I need to give credits to Lawrence System, who first showed me this tool.
      Great channel in Youtube: [https://www.youtube.com/@lawrencesystems
      Visit his forum: https://forums.lawrencesystems.com/

      I'll just focus on the Graylog configuration here, assuming that you are already exporting everything to it.

      e5ab9d45-1a4f-47a9-a1d9-3f0a3c9b4d71-image.png

      In the step below, you can configure how long you want to keep the logs, be careful here because depending on how much logs you will be sending to Graylog, more RAM you will need.
      09b79998-3d1a-4ef2-9d40-050cdc4dccff-image.png

      c04d93cf-3f1f-4475-a701-1e38977ab2e6-image.png

      815789d1-9981-4d14-9c9c-cd2f53877666-image.png

      Some useful links I used to start my journey:

      Graylog: https://docs.graylog.org/docs/ubuntu
      Graylog SSL/HTTPS https://docs.graylog.org/docs/https
      Extractor URL: https://github.com/loganmarchione/Graylog_Extractors_pfSense
      Lawrence System: https://www.youtube.com/watch?v=rtfj6W5X0YA
      Note that for the Extractor, there are other options out there that you might prefer.
      Lawrence's System Extractor: https://github.com/lawrencesystems

      Now, I'll proceed with the configuration in the next posts,

      Edit: Just give me a few minutes because I'm out of beers, I'll have to go out to buy more

      dead on arrival, nowhere to be found.

      M 1 Reply Last reply Jun 29, 2023, 7:07 PM Reply Quote 1
      • M
        michmoor LAYER 8 Rebel Alliance @mcury
        last edited by michmoor Jun 29, 2023, 7:08 PM Jun 29, 2023, 7:07 PM

        @mcury said in netflow and graylog:

        ust focus on the Graylog configuration here, assuming that

        Oh yeah im fully utilizing graylog for all my logs. Even got syslog alerting to my email.
        Just the netflow piece is where im stuck on

        Firewall: NetGate,Palo Alto-VM,Juniper SRX
        Routing: Juniper, Arista, Cisco
        Switching: Juniper, Arista, Cisco
        Wireless: Unifi, Aruba IAP
        JNCIP,CCNP Enterprise

        M 1 Reply Last reply Jun 29, 2023, 7:32 PM Reply Quote 0
        • M
          mcury @michmoor
          last edited by mcury Jun 29, 2023, 7:39 PM Jun 29, 2023, 7:32 PM

          @michmoor said in netflow and graylog:

          Just the netflow piece is where im stuck on

          Oh, great.

          Let me focus on the netflow part them:

          I'm using pipelines since Graylog use bytes and I want to see data in megabytes.

          Pipeline setup:

          c72b5328-f182-422d-9209-d9e601c16106-image.png

          Note that I'm using two pipelines, this is necessary due to inter-vlan connections.

          Bytes_to_megabytes transforms bytes in megabytes.
          Bytes_to_megabytes_2 transforms bytes in megabytes /2.

          When connection comes from one VLAN to the other, pfSense sends netflow data from both VLANs, and because of that, Graylog will report it doubled.
          To circumvent that, I use the pipeline Bytes_to_megabytes_2 to get the data in MB divided by two.

          In pipelines, Manage rules, Bytes_to_megabytes :

          rule "arithmetic"
          when
          has_field("nf_bytes")
          then
          let size_kb = to_long($message.nf_bytes);
          set_field("size_bytes", size_kb / 1048576);
          end

          In pipelines, Manage rules, Bytes_to_megabytes_2 :

          rule "arithmetic2"
          when
          has_field("nf_bytes")
          then
          let size_kb = to_long($message.nf_bytes);
          set_field("size_bytes2", (size_kb / 1048576) / 2);
          end

          I'll get more into Pipeline later, when I'll speak about creating the widgets.

          Please let me know if you want help to configure lookup tables in Graylog

          Edit: I'm exporting netflow from interfaces LAN and WIFI.
          So , connections from LAN to WAN, uses bytes_to_megabytes
          Connections from WIFI to WAN, uses bytes_to_megabytes.
          Connections from WIFI to LAN and vice versa (intervlan), uses bytes_to_megabytes_2

          dead on arrival, nowhere to be found.

          M M 2 Replies Last reply Jun 29, 2023, 7:44 PM Reply Quote 0
          • M
            michmoor LAYER 8 Rebel Alliance @mcury
            last edited by Jun 29, 2023, 7:44 PM

            @mcury Ok this is what i got so far

            42460536-63ef-4dd8-92c3-7b15ddc19d60-image.png

            0e3755f5-ea43-420e-a9a8-a3654ed1b830-image.png

            478f35d5-121f-4d14-b6b7-6cd36a108e88-image.png

            aabfcc8d-46b6-400f-b323-2f3449b63bea-image.png

            Firewall: NetGate,Palo Alto-VM,Juniper SRX
            Routing: Juniper, Arista, Cisco
            Switching: Juniper, Arista, Cisco
            Wireless: Unifi, Aruba IAP
            JNCIP,CCNP Enterprise

            1 Reply Last reply Reply Quote 0
            • M
              mcury @mcury
              last edited by Jun 29, 2023, 7:48 PM

              To configure lookup tables, I used this guide: https://go2docs.graylog.org/5-1/making_sense_of_your_log_data/lookup_tables.html

              Graylog is getting DNS from my AD (samba-ad), so, just internal hosts are being resolved, you can filter what networks will be resolved.

              It is pretty straight forward, just follow the guide and it will work.

              Now, next post, widgets:

              dead on arrival, nowhere to be found.

              M 1 Reply Last reply Jun 29, 2023, 7:53 PM Reply Quote 0
              • M
                mcury @mcury
                last edited by mcury Jun 29, 2023, 7:55 PM Jun 29, 2023, 7:53 PM

                This widget will show you the last 5 days summary (top talkers).

                f3c59a8d-9dee-48eb-aa4f-a65652020f01-image.png

                nf_bytes:>1048576 AND _exists_:hostname_dst AND NOT _exists_:hostname_src AND NOT (nf_dst:172.16.200.* OR nf_src:172.16.200.*)
                

                The filter above will make sure that only hosts that are resolved will be showed.
                I'm not allowing hosts from my MGMT vlan to get their data in the widget (172.16.200.*).

                Widget in details:

                aa7e6975-80e8-4207-8c67-fa6c0b25ae98-image.png

                dead on arrival, nowhere to be found.

                M 1 Reply Last reply Jun 29, 2023, 8:00 PM Reply Quote 0
                • M
                  mcury @mcury
                  last edited by Jun 29, 2023, 8:00 PM

                  This widget will show you the last 2 hours summary (top talkers).
                  Inbound flows only.

                  e323d3fb-0f05-4c02-b010-6372ebfc500d-image.png

                  6981afac-73e1-4e37-a7bd-a19172737af9-image.png

                  nf_bytes:>1048576 AND _exists_:hostname_dst AND NOT _exists_:hostname_src AND NOT (nf_dst:172.16.200.* OR nf_src:172.16.200.*)
                  

                  The filter above will make sure that only hosts that are resolved will be showed.
                  I'm not allowing hosts from my MGMT vlan to get their data in the widget (172.16.200.*).

                  dead on arrival, nowhere to be found.

                  M 1 Reply Last reply Jun 29, 2023, 8:04 PM Reply Quote 0
                  • M
                    mcury @mcury
                    last edited by Jun 29, 2023, 8:04 PM

                    This widget will show you the last 5 days summary (top talkers).
                    Outbound flows only.

                    ddb2275f-2b9b-4d98-aafb-f9db2260cfdd-image.png

                    nf_bytes:>1048576 AND _exists_:hostname_src AND NOT _exists_:hostname_dst AND NOT (nf_dst:172.16.200.* OR nf_src:172.16.200.*)
                    

                    The filter above will make sure that only hosts that are resolved will be showed.
                    I'm not allowing hosts from my MGMT vlan to get their data in the widget (172.16.200.*).

                    Widget in details:

                    64df6462-7277-45d3-967c-e4f392ec82f3-image.png

                    dead on arrival, nowhere to be found.

                    M 1 Reply Last reply Jun 29, 2023, 8:08 PM Reply Quote 0
                    • M
                      mcury @mcury
                      last edited by Jun 29, 2023, 8:08 PM

                      This widget will show you the last 2 hours summary (top talkers).
                      Outbound flows only.

                      c5123e08-dad2-4816-956f-49016b88dc86-image.png

                      nf_bytes:>1048576 AND _exists_:hostname_src AND NOT _exists_:hostname_dst AND NOT (nf_dst:172.16.200.* OR nf_src:172.16.200.*)
                      

                      The filter above will make sure that only hosts that are resolved will be showed.
                      I'm not allowing hosts from my MGMT vlan to get their data in the widget (172.16.200.*).

                      Widget in details:
                      74da6a1d-f0d6-4320-8b44-223f11c4f822-image.png

                      dead on arrival, nowhere to be found.

                      M 1 Reply Last reply Jun 29, 2023, 8:13 PM Reply Quote 0
                      • M
                        mcury @mcury
                        last edited by mcury Jun 29, 2023, 8:13 PM Jun 29, 2023, 8:13 PM

                        Now, for intervlan traffic I have:

                        This widget will show you the last 5 days summary (top talkers).

                        93ba3eeb-dd15-453a-bfce-9f4344ca7d75-image.png

                        As you can see below, this filter is only getting connections from my LAN (192.168.255.2* to my WIFI network 192.168.10* and vice versa. And it will only report resolved hosts:

                        ((nf_src:192.168.10.* AND nf_dst:192.168.255.2*) OR (nf_src:192.168.255.2* AND nf_dst:192.168.10.*)) AND (_exists_:hostname_src AND _exists_:hostname_dst)
                        

                        9fb14a35-e5e5-48ca-ae7d-bd579e874e34-image.png

                        Edit: Note here that I'm using size_bytes2 !!

                        dead on arrival, nowhere to be found.

                        M 1 Reply Last reply Jun 29, 2023, 8:16 PM Reply Quote 0
                        • M
                          mcury @mcury
                          last edited by Jun 29, 2023, 8:16 PM

                          Now, for intervlan traffic I also have:

                          This widget will show you the last 2 hours summary (top talkers).

                          dcc5c48a-6dd6-4f48-8eca-0688ed92d39f-image.png

                          ((nf_src:192.168.255.2* AND nf_dst:192.168.10.*) OR (nf_src:192.168.10.* AND nf_dst:192.168.255.2*)) AND (_exists_:hostname_src AND _exists_:hostname_dst)
                          

                          b54c3ed2-4d0c-4647-9846-ccbf67cfb10a-image.png

                          Edit: Note here that I'm using size_bytes2 !!

                          dead on arrival, nowhere to be found.

                          M 1 Reply Last reply Jun 29, 2023, 8:17 PM Reply Quote 0
                          • M
                            mcury @mcury
                            last edited by mcury Jun 29, 2023, 8:27 PM Jun 29, 2023, 8:17 PM

                            Make sure Pipeline is the latest thing in your message processors:

                            6817890d-e2f3-40af-99fd-086adac3bc29-image.png

                            Edit: For netflow, this is what I have, everything else is using syslog only.

                            Edit2: Make sure netflow version is set 9 in Softflowd, and flow tracking is Full.

                            dead on arrival, nowhere to be found.

                            1 Reply Last reply Reply Quote 0
                            • M
                              michmoor LAYER 8 Rebel Alliance
                              last edited by michmoor Jun 29, 2023, 10:34 PM Jun 29, 2023, 10:21 PM

                              edit1: Having an even more fundamental problem. Netflow collection is no longer working for me in graylog. Receiving no messages.
                              All other syslog messages are working........hmmmm
                              Is softflowd working for you after the upgrade to 23.05.1

                              edit2: A good restart of the input on graylog got things going. Pipelines getting messages

                              On a basic level i think i got something wrong.
                              I got the lookup tables configured - using DNS

                              The pipelines arent seeing any messages but i know the stream is working.

                              e4316e00-2f75-41b6-98e1-c527fdbbf0c2-image.png

                              Firewall: NetGate,Palo Alto-VM,Juniper SRX
                              Routing: Juniper, Arista, Cisco
                              Switching: Juniper, Arista, Cisco
                              Wireless: Unifi, Aruba IAP
                              JNCIP,CCNP Enterprise

                              M 1 Reply Last reply Jun 29, 2023, 10:48 PM Reply Quote 0
                              • M
                                michmoor LAYER 8 Rebel Alliance @michmoor
                                last edited by Jun 29, 2023, 10:48 PM

                                @mcury hope your back from your beer run !
                                I got my lookup table working but i dont have the fields you do in your examples. e.g. Hostname

                                939fbc2d-09a1-4e89-90ce-000ae854e88c-image.png

                                Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                Routing: Juniper, Arista, Cisco
                                Switching: Juniper, Arista, Cisco
                                Wireless: Unifi, Aruba IAP
                                JNCIP,CCNP Enterprise

                                M 1 Reply Last reply Jun 30, 2023, 12:31 PM Reply Quote 0
                                • M
                                  mcury @michmoor
                                  last edited by Jun 30, 2023, 12:31 PM

                                  @michmoor hmm, I forgot to mention the extractors I had to create for netflow lookup to work.
                                  Follows below:

                                  183b7953-c31c-4777-b5a1-4f06a99fe4b9-image.png

                                  {
                                    "extractors": [
                                      {
                                        "title": "hostname_src",
                                        "extractor_type": "lookup_table",
                                        "converters": [],
                                        "order": 0,
                                        "cursor_strategy": "copy",
                                        "source_field": "nf_src_address",
                                        "target_field": "hostname_src",
                                        "extractor_config": {
                                          "lookup_table_name": "hostname"
                                        },
                                        "condition_type": "regex",
                                        "condition_value": "192.168."
                                      },
                                      {
                                        "title": "hostname_dst",
                                        "extractor_type": "lookup_table",
                                        "converters": [],
                                        "order": 0,
                                        "cursor_strategy": "copy",
                                        "source_field": "nf_dst_address",
                                        "target_field": "hostname_dst",
                                        "extractor_config": {
                                          "lookup_table_name": "hostname"
                                        },
                                        "condition_type": "regex",
                                        "condition_value": "192.168."
                                      }
                                    ],
                                    "version": "5.1.2"
                                  }
                                  

                                  dead on arrival, nowhere to be found.

                                  M 1 Reply Last reply Jan 12, 2024, 8:42 PM Reply Quote 0
                                  • M
                                    michmoor LAYER 8 Rebel Alliance @mcury
                                    last edited by michmoor Jan 12, 2024, 8:44 PM Jan 12, 2024, 8:42 PM

                                    @mcury

                                    Re: netflow and graylog

                                    Last few days have been a crash course in GROK and creating my pipeline rules. I thought of this thread and im ready to return to it. Now that i understand GrayLog pipelines way more than i did back last year i can safely say this is pretty easy to get going.
                                    I just dont know how to enrich data using dns for IP lookups but thats ok

                                    Thanks @mcury

                                    edit: The graylog v5.2 has a rule creator which is wayyyyy easier than writing the code which in turn makes managing those pipeline rules even easier. Highly recommended to upgrade.

                                    Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                    Routing: Juniper, Arista, Cisco
                                    Switching: Juniper, Arista, Cisco
                                    Wireless: Unifi, Aruba IAP
                                    JNCIP,CCNP Enterprise

                                    M 1 Reply Last reply Jan 12, 2024, 8:58 PM Reply Quote 1
                                    • M
                                      michmoor LAYER 8 Rebel Alliance @michmoor
                                      last edited by Jan 12, 2024, 8:58 PM

                                      Few things ive been able to do with GROK parsing is not to clean up my unbound log files and create fields that are important to me and good for tracking.

                                      34aa20ba-7c37-4812-ad77-1a0306cb7107-image.png

                                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                                      Routing: Juniper, Arista, Cisco
                                      Switching: Juniper, Arista, Cisco
                                      Wireless: Unifi, Aruba IAP
                                      JNCIP,CCNP Enterprise

                                      M 1 Reply Last reply Jan 12, 2024, 11:01 PM Reply Quote 1
                                      • M
                                        mcury @michmoor
                                        last edited by mcury Jan 12, 2024, 11:01 PM Jan 12, 2024, 11:01 PM

                                        @michmoor said in netflow and graylog:

                                        Few things ive been able to do with GROK parsing is not to clean up my unbound log files and create fields that are important to me and good for tracking.

                                        I'm running Graylog 5.2 now, had to build gcc 11.1.0+ from source, it took a few hours in my raspberry pi 4 but it is working :)

                                        @michmoor said in netflow and graylog:

                                        I just dont know how to enrich data using dns for IP lookups but thats ok

                                        I'm using PTR for that purpose, if there is something I can help, just let me know.

                                        @michmoor said in netflow and graylog:

                                        Few things ive been able to do with GROK parsing is not to clean up my unbound log files and create fields that are important to me and good for tracking.

                                        Ow, that is really nice :) If it is possible, can you share how you are getting those statistics from Unbound ?

                                        dead on arrival, nowhere to be found.

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post
                                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                          This community forum collects and processes your personal information.
                                          consent.not_received