Cloud computing, which uses a centralized data-sharing model, allows sharing of confidential information. Fog computing (FC) extends cloud computing services to provide an intensive layer in an integrated healthcare environment. Quality service dependencies require more latency by taking advantage of feature optimization. Due to legacy integrity problems, confidential management services are affected by security issues. Healthcare management with cloud-based support is often an effective mechanism for managing healthcare data. However, cyber security poses severe problems for healthcare data because attackers create malicious signatures to create security breaches. Increasing demand for services does not protect information from attacker intrusion. Most systems fail to analyze the behavioral features of intrusion data in network logs, leading to detection failures. To resolve this problem, we propose implementing a Deep Spectral Gated Recurrent Neural Network (DSGRNN)--based Intrusion Detection System (IDS) to determine the intrusion and improve detection accuracy. Initially, data normalization is carried out to pre-process Darknet-IDS data. Transmission Flow Defect Rate (TFDR) and Interference Defect Behaviour Rate Analysis (IDBRA) are used to identify feature margins. Adaptive spider ant colony optimization is applied to reduce the feature dimension, and detection is achieved using DSGRNN to detect the IDS. This proposed system produces high performance and identifies behavioral logs from the dark net dataset to improve classification accuracy. This improves the precision-recall rate (F-measure) and IDS identity. This provides high performance compared to other systems to ensure security based on detection accuracy of potential threats.