Skip to content

Conversation

@kellybyrd
Copy link

Provide a JSON output of all templates for all Netflow sources on the configured TemplatePath HTTP endpoint. This will only be active if there is a NetflowPipe and TemplatePath is not null.

The changes to do this work:

  • Implement GetTemplates() for NetFlowTemplateSystem
  • Call the wrapped GetTemplates() for PromTemplateSystem
  • GetTemplatesForAllSources() for NetflowPipe, this does a deep copy of all templates for each source key.

Example output (I restarted my Netflow observer so there are two sources)

{
   "[::ffff:172.16.1.254]:50050": {},
   "[::ffff:172.16.1.254]:50861": {
      "2533274790396160": {
         "template-id": 256,
         "field-count": 20,
         "fields": [...]
      },
      "2533274790396163": {...}
   }
}

Provide a JSON output of all templates for all Netflow sources
on the configured TemplatePath HTTP endpoint. This will only
be active if there is a NetflowPipe and TemplatePath is not null.

The JSON format is: "source string": { <template map> }

The changes to do this work:
* Implement GetTemplates() for NetFlowTemplateSystem

* Call the wrapped GetTemplates() for PromTemplateSystem

* GetTemplatesForAllSources() for NetflowPipe, this does a deep
  copy of all templates for each source key.
@kellybyrd
Copy link
Author

Any feedback on this?

@synfinatic
Copy link

Would like to include this with netflow2ng as being able to view the templates is super useful in debugging.

@kellybyrd
Copy link
Author

kellybyrd commented Nov 5, 2025

I see recent comments on issues, but no comments or movement on PRs, it would be great to get some feedback here. I assumed this work was wanted because the cmd/goflow2/main.go code has some hints about the /templates endpoint, so I assumed it was a thing that was wanted but didn't have time for when porting over from the original goflow project.

If it's easier to review or accept, you (or I) could remove the the HTTP endpoint code in cmd/goflow2/main.go from this PR. Then the PR is just exposing GetTemplates() in the template decoders and then providing a function to get a copy of the templates from all sources in pipe.go

@lspgn
Copy link
Member

lspgn commented Nov 30, 2025

Catching up on the PRs and issues.
Thank you very much for implementing this. Will test and circle back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants