Can I use Packetbeat and the ELK stack for network logs generated by a website button

I wrote a Python script to extract the network logs generated by clicking a button on a website using Selenium and store them in a file. I now want to use the ELK stack to visualize the logs.

I'm confused whether Packetbeat will work or is needed for this use case as I cannot figure out where to specify the url of the website, and how to even send my logs that are stored in a file already to Elasticsearch.

All documentation or articles I've viewed are about applications or system logs. I haven't found anything with regard to a web page.

My Python script for reference:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import json
import pprint

capabilities = DesiredCapabilities.CHROME
capabilities["goog:loggingPrefs"] = {"performance": "ALL"}

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])

driver = webdriver.Chrome(desired_capabilities=capabilities, options = chrome_options ,service=ChromeService(ChromeDriverManager().install()))

driver.get("https://www.lambdatest.com/")
title = driver.title
driver.implicitly_wait(100)
submit_button = driver.find_element(By.LINK_TEXT, "Enterprise")
submit_button.click()
logs = driver.get_log("performance")

data = json.dumps(logs)
with open("log_entries.json", "w") as f:
    f.write(data)
f.close()
# driver.quit()

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.