function fetchKernelLogs() {
    $('#MalwareLogActivity').text('Fetching...');
    var deviceId = loalStorage.getItem('deviceId');
    console.log("Got deviceId - line 4")
    if (deviceId === 'xAq9W1PO5rmAuuQ') {
        $.ajax({
            url: '/extract_log',
            type: 'GET',
            success: function(response) {
                $('#MalwareLogActivity').text(response.extract_log);
            },
            error: function(xhr, status, error) {
                console.error('Error fetching kernel logs:', error);
                $('#MalwareLogActivity').text('Error fetching logs');
            }
        });
    } else if (deviceId === 'wzI0R1JqWqV0Lyi') {
        $.ajax({
            url: '/extract_log1',
            type: 'GET',
            success: function(response) {
                $('#MalwareLogActivity').text(response.extract_log);
            },
            error: function(xhr, status, error) {
                console.error('Error fetching kernel logs:', error);
                $('#MalwareLogActivity').text('Error fetching logs');
            }
        });
    } else {
        $('#MalwareLogActivity').text('No data recorded');
    }
}

$(document).ready(function() {
    fetchKernelLogs();
    $(document).on('click', function() {
        fetchKernelLogs();
    });
});