Configure security group logging
Create and manage packet logs to monitor security group traffic flows.
Each log stores data about packet flow events and appends it to a common log file on the instance’s Compute host.
You can associate any instance port with one or more security groups and define one or more rules for each security group. For example, you can create a rule to allow inbound SSH traffic to any virtual machine in a security group. You can create another rule in the same security group to allow virtual machines in that group to initiate and respond to ICMP (ping) messages.
Then you can create logs to record combinations of packet flow events. For example, the following command creates a log to capture all ACCEPT events in the security group, security-group1.
$ openstack network log create my-log1 \
--resource-type security_group \
--resource security-group1 \
--event ACCEPT
You can create multiple logs to capture data about specific combinations of security groups and packet flow events.
You can configure the following parameters:
-
--resource-type - You must set this required parameter to
security_group. -
--resource <security_group_name|security_group_ID> - Optional: limit the log to a specific security group. If you do not specify a resource, the log will capture events from all security groups on the specified ports in the project.
-
--target <port_ID|port_name> - Optional: limit the log to a specific port in the security group. If you do not specify a target, the log will capture events from all ports in the security group in the project.
--event(types of events to log)-
You can choose to log the following packet flow events:
DROP: Log oneDROPlog entry for each incoming or outgoing session that is dropped.Note If you log dropped traffic on one or more security groups, the Networking service logs dropped traffic on all security groups.
ACCEPT: Log oneACCEPTlog entry for each new session that is allowed by the security group.ALL(drop and accept): Log allDROPandACCEPTevents. If you do not set –eventACCEPTor –eventDROP, the Networking service defaults toALL.
The Networking service writes all log data to the same file on every Compute node: /var/log/containers/openvswitch/ovn-controller.log.
Sample security group log content Copy linkLink copied!
Security group log content includes information such as timestamp, status, source, and other relevant data..
Security group log content includes:
- A timestamp of the packet flow.
- A status of the flow:
ACCEPTorDROP. - An indication of the originator of the flow. For example, which project or log resource generated the events.
- An identifier of the associated instance interface (Neutron port ID).
- Layer 2, 3 and 4 information such as MAC, address, port, and protocol.
- Example: logged data from an ACCEPT event
2022-11-30T03:29:12.868Z|00111|acl_log(ovn_pinctrl1)|INFO|name="neutron-bc53f8df-2318-4d08-8e12-89e92b08deec", verdict=allow, severity=info, direction=from-lport: udp,vlan_tci=0x0000,dl_src=fa:16:3e:70:c4:45,dl_dst=fa:16:3e:66:8b:18,nw_src=192.168.100.59,nw_dst=192.168.100.1,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=68,tp_dst=67
Share security groups across projects Copy linkLink copied!
Share a security group across projects by using RBAC policies.
Verify security group logging is enabled Copy linkLink copied!
Verify that the Networking service has loaded the logging service plugin and extension.
Before you begin Copy linkLink copied!
- You have the
occommand line tool installed on your workstation. - You are logged on to a workstation that has access to the RHOSO control plane as a user with
cluster-adminprivileges.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Confirm that the Networking service has successfully loaded the
Logging API Extensionby repeating step 1.
Monitor security group traffic with log objects Copy linkLink copied!
Create log objects with the resource type security_group.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - You have created security groups.
- You have created security group rules for the security groups.
- You have assigned ports to the security groups.
Procedure Copy linkLink copied!
List and view security group log objects Copy linkLink copied!
List and view security group log objects to monitor network traffic and verify security configurations.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - You have created security groups.
- You have created security group rules for the security groups.
- You have assigned ports to the security groups.
Procedure Copy linkLink copied!
Control security group logging activity Copy linkLink copied!
Enable or disable security group log objects to control logging activity and reduce resource overhead.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - You have created security groups.
- You have created security group rules for the security groups.
- You have assigned ports to the security groups.
Procedure Copy linkLink copied!
Organize logging with descriptive log names Copy linkLink copied!
Rename a security group log object to assign a descriptive name for easier identification and organization.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - You have created security groups.
- You have created security group rules for the security groups.
- You have assigned ports to the security groups.
Procedure Copy linkLink copied!
Delete security group log objects Copy linkLink copied!
Delete security group log objects to remove unused log collectors and optimize system resources.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - You have created security groups.
- You have created security group rules for the security groups.
- You have assigned ports to the security groups.
Procedure Copy linkLink copied!
Accessing security group log content Copy linkLink copied!
The Networking service (neutron) aggregates security group logs from all instances on a Compute node in one location: /var/log/containers/openvswitch/ovn-controller.log.
The log file contains other log objects. Security group log entries include the string acl_log.
Adjust rate and burst limits for security group logging Copy linkLink copied!
Adjust rate and burst limits to optimize security group logging.
Before you begin Copy linkLink copied!
- You have the
occommand line tool installed on your workstation. - You are logged on to a workstation that has access to the RHOSO control plane as a user with
cluster-adminprivileges. - The Networking service (neutron) has loaded the logging service plugin and the logging extension.
For more information, see Verify security group logging is enabled.
About this task Copy linkLink copied!
the Networking service (neutron) limits the maximum number of packets that it logs per second. You can adjust rate and burst limits to optimize logging for your environment.
The Networking service limits the maximum number of packets that it logs per second with the rate_limit_interval parameter. The default value is 100 packets per second.
When the number of packets the Networking service logs reaches the rate limit, the Networking service queues the excess packets to be logged with the rate_limit_burst parameter. The default value is 25 packets in the log queue.
You can modify the values of these parameters to meet the logging requirements of your networks.
Logging rate and burst limits do not limit control of data traffic. They limit only the transmission of logging data.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Confirm that your rate and burst configuration changes are updated.
Create one log object, and verify the meter band entry:
$ oc rsh -n openstack ovsdbserver-nb-0 ovn-nbctl --no-leader list meter-band_uuid : 721334bc-8e45-417a-a523-9e4d56dd97c3 action : drop burst_size : 55 external_ids : {} rate : 132