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

FortiGate event handler DHCP parser #8459

Open
wants to merge 11 commits into
base: devel
Choose a base branch
from

Conversation

fdurand
Copy link
Member

@fdurand fdurand commented Dec 31, 2024

Description

Add the ability to parse the syslog messages coming from the fortigate firewall to update the ip4log information.

Impacts

No

Delete branch after merge

YES

Checklist

  • Document the feature
  • Add OpenAPI specification
  • Add unit tests
  • Add acceptance tests (TestLink)

NEWS file entries

New Features

  • FortiGate syslog DHCP parser

go/detectparser/fortigate_dhcp_test.go Show resolved Hide resolved
go/detectparser/fortigate_dhcp.go Outdated Show resolved Hide resolved
go/detectparser/fortigate_dhcp.go Outdated Show resolved Hide resolved
go/detectparser/fortigate_dhcp.go Outdated Show resolved Hide resolved
go/detectparser/fortigate_dhcp.go Outdated Show resolved Hide resolved
go/detectparser/fortigate_dhcp.go Outdated Show resolved Hide resolved
attributes[match[3]] = match[4]
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't iterate through all the fields on the map.
Just grab the value you need

mac = strings.ToLower(attributes["mac"])
ip = attributes["ip"]
...

If you need to do it conditionally

if value, ok := attributes["mac"]; ok {
    mac = strings.ToLower(value)
}

if value, ok := attributes["ip"]; ok {
    ip = strings.ToLower(value)
}

...

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

Successfully merging this pull request may close these issues.

2 participants