Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples of network policies troubleshooting using JSON format #120

Open
aojea opened this issue Nov 19, 2024 · 4 comments
Open

Examples of network policies troubleshooting using JSON format #120

aojea opened this issue Nov 19, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@aojea
Copy link
Contributor

aojea commented Nov 19, 2024

The json logging can be very powerful to troubleshoot network policies, specially using the packet json format and the results of the evaluation, it will be nice to document some examples on how to use it

{
  "ts": 1720777151838.3552,
  "caller": "networkpolicy/controller.go:461",
  "msg": "Evaluating packet",
  "v": 2,
  "packet": {
    "Id": 9,
    "Family": "IPv4",
    "SrcIP": "11.0.3.3",
    "DstIP": "11.0.2.2",
    "Proto": "TCP",
    "SrcPort": 33803,
    "DstPort": 6000
  }
}

Text output is not altered:

I0712 09:53:52.257809       1 controller.go:461] "Evaluating packet" packet=<
        [8] 11.0.1.3:40243 11.0.2.2:6000 TCP
        00000000  00 00 a0 02 fa f0 19 33  00 00 02 04 05 b4 04 02  |.......3........|
        00000010  08 0a c1 d9 c1 bd 00 00  00 00 01 03 03 07        |..............|
 >

Originally posted by @uablrek in #50 (comment)

@aojea aojea added documentation Improvements or additions to documentation help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Nov 19, 2024
@phuhung273
Copy link

Hi @aojea, can you please help suggesting where is the most suitable place to put this doc. Is it fine to put right in the home README.md ?

@uablrek
Copy link
Contributor

uablrek commented Dec 7, 2024

Please mention formatting with jq

@aojea
Copy link
Contributor Author

aojea commented Dec 7, 2024

Add a subsection called Advanced so we can keep adding documentation, and from that subsection we can have a list of links to the docs folder.
You add the new document it in docs and you link it from the readme, it has to be a meaningful title as "Using JSON logging for troubleshooting network policies" per example

@phuhung273
Copy link

thanks @aojea @uablrek for supporting. I will give a try.

/assign

@phuhung273 phuhung273 removed their assignment Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

3 participants