Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Not sure what platform you want to do this on, but I assume using "span"/ port monitoring would meet your requirement. The link below is for 2960s, but the capability is generally available across all platforms.