class K8sTshark::TsharkPacketCapture

Defined in:

tasks/utils/k8s_tshark.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.begin_capture_by_label(label_key : String, label_value : String, command : String = "", &block : TsharkPacketCapture -> ) #

Method to provide a block context for capture by label.


[View source]
def self.begin_capture_by_node(node : JSON::Any, command : String = "", &block : TsharkPacketCapture -> ) #

Method to provide a block context for capture by node.


[View source]

Instance Method Detail

def begin_capture_by_label(label_key : String, label_value : String, command : String = "") #

Starts a tshark packet capture on the node where the pod with the specified label is running. label_key and label_value: Used to identify the pod's label. command: Parameters to be passed to tshark.


[View source]
def begin_capture_by_node(node : JSON::Any, command : String = "") #

Starts a tshark packet capture on the specified node. node: The node where the capture should be performed. command: Parameters to be passed to tshark. duration: Optional; specifies the capture duration, eliminating the need to call terminate_capture manually.


[View source]
def capture_file_path : String #

[View source]
def capture_file_path=(capture_file_path : String) #

[View source]
def finalize #

[View source]
def get_capture_file_path : String #

Retrieves the file path where the capture is stored.


[View source]
def pid : Int32 | Nil #

[View source]
def pid=(pid : Int32 | Nil) #

[View source]
def regex_match?(pattern : Regex) : Bool #

Checks if any line in the capture file matches the specified regex pattern. Returns true if a match is found, otherwise false.


[View source]
def regex_search(pattern : Regex) : Array(String) #

Searches the capture file for lines matching the specified regex pattern. Returns an array of matching lines.


[View source]
def terminate_capture #

Terminates the tshark packet capture process.


[View source]