Skip to content

Network check script#11

Open
Adepetu-Oluwasegun wants to merge 1 commit intooyogbeche:mainfrom
Adepetu-Oluwasegun:network-check-update
Open

Network check script#11
Adepetu-Oluwasegun wants to merge 1 commit intooyogbeche:mainfrom
Adepetu-Oluwasegun:network-check-update

Conversation

@Adepetu-Oluwasegun
Copy link

@Adepetu-Oluwasegun Adepetu-Oluwasegun commented Dec 4, 2024

What is this PR about?

This PR introduces a network-check.sh script that logs active network connections on the system. The script checks for available tools (ss or netstat) to gather information on current network connections and stores the output in a log file with a timestamp.

Purpose of this script

The purpose of this script is to monitor and log active network connections, which can be useful for debugging, network analysis, or security auditing. It ensures that a consistent log file is created for each check, and it creates the necessary directories if they do not exist.

How this change affect the project?

This script adds a new utility for logging network activity, providing system administrators or users with valuable insights into active connections. The logs can be used for troubleshooting or tracking network usage over time.

Note:

  • The script creates a log file with a timestamp in the /var/log/network_logs/ directory.
  • If the ss command is unavailable, it falls back to using netstat.
  • The script ensures that the log directory is created if it doesn't exist.

Testing:

  • Tested on a Linux machine with both ss and netstat available.
  • Verified that the log directory is created when needed and that network connection logs are successfully written to the generated log files.

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.

1 participant