INNER CODE UNIT · JavaScript

fetchFieldStats

netnr/workers · wwwroot/loggly.js:325

    function fetchFieldStats(fieldName) {
        var query = buildQuery();
        var facetSize = getStatsTopN();
        var url = CONFIG.baseUrl + '/fields/' + encodeURIComponent(fieldName) +
            '?q=' + encodeURIComponent(query.q) +
            '&from=' + encodeURIComponent(query.from) +
            '&until=' + encodeURIComponent(query.until) +
            '&facet_size=' + facetSize;

        setStatus('Querying stats for ' + fieldName + '...');

        apiGet(url).then(function (data) {
            var totalEvents = data.total_events || 0;
            var rows = (data[fieldName] || []).slice().sort(function (a, b) {
                return b.count - a.count;
            });
            state.currentStatsRows = rows;
            renderStats(fieldName, rows, totalEvents, facetSize);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…