 (defun ovirt-log-analyzer-filter-by-function (filter-function)
   (save-excursion
     (goto-char (point-min))
-    (ovirt-log-analyzer-while 50 (< (point) (point-max))
+    (ovirt-log-analyzer-while 500 (< (point) (point-max))
       (let ((beg (point))
             (end (if (funcall filter-function) (line-beginning-position) (point-max))))
         (unless (= beg end)

  (dolist (o (overlays-in (point-min) (point-max)))
    (when (overlay-get o 'ovirt-log-analyzer-filter)
      (let ((invisible (not (eq (overlay-get o 'invisible) 'yes))))
        (overlay-put o 'invisible (if invisible 'yes 'no))
        (overlay-put o 'priority (if invisible 20 0))))))

(defun ovirt-log-analyzer-add-after (overlay string face)
  (overlay-put overlay 'after-string
               (concat (or (overlay-get overlay 'after-string) "")
                       (propertize string 'face face) " ")))

(defun ovirt-log-analyzer-process ()
  (save-excursion
    (goto-char (point-min))
    (remove-overlays)
    (let ((unknown-tags '())
          (max-file-field-length 0))
      (ovirt-log-analyzer-while 50 (not (eobp))
        (if (looking-at "[0-9][^|\n]*| \\( *[^|\n]+:[0-9]+\\) *| \\( *\\([^|\n]*\\) |\\).*$")
            (let* ((beg (match-beginning 0))
                   (end (match-end 0))
                   (line-overlay (make-overlay beg end))
                   (file-point (match-beginning 1))
                   (tag-beg (match-beginning 2))
                   (tag-end (match-end 2))
                   (tag-overlay (make-overlay (match-beginning 2) (match-end 2)))
                   (file-field (match-string 1))
                   (tag-field (match-string 3))
                   (tag-list (split-string (match-string 3) ";"))
                   (visible-tags nil))
              (overlay-put line-overlay 'help-echo (mapconcat #'identity tag-list "; "))
              (overlay-put line-overlay 'ovirt-log-analyzer-file-reference file-field)
              (overlay-put line-overlay 'ovirt-log-analyzer-file (car (split-string file-field ":")))
              (when (string-match "^\\(.*/\\)\\([^/]+\\)$" file-field)
                (let ((file-overlay (make-overlay file-point (+ file-point (match-end 1))))
                      (length (- (match-end 2) (match-beginning 2))))
                  (overlay-put file-overlay 'invisible 'yes)
                  (overlay-put file-overlay 'ovirt-log-analyzer-file-field-length length)
                  (setq max-file-field-length (max max-file-field-length length))))
              (dolist (tag tag-list)
                (cond
                 ((string-match "^Task/\\([1-9]\\)$" tag)
                  (let ((o (make-overlay (- tag-beg 2) (- tag-beg 1))))
                    (overlay-put o 'after-string
                                 (propertize (make-string (string-to-number (match-string 1 tag)) ?>)
                                             'face 'font-lock-keyword-face))))
                 ((string-match "^Task(duration=\\([0-9.]+\\))$" tag)
                  (ovirt-log-analyzer-add-after tag-overlay (concat " " (match-string 1 tag) "s" ) 'font-lock-constant-face))
                 ((string-match "^Host=\\(.*\\)$" tag)
                  (let ((host (match-string 1 tag)))
                    (add-to-list 'ovirt-log-analyzer-hosts host)

              (when visible-tags
                (goto-char tag-beg)
                (while (re-search-forward "\\(Host\\|VM\\)=\\([^; |]*\\)" tag-end t)
                  (let ((beg (match-beginning 0))
                        (end (match-end 0))
                        (entity (match-string 1))
                        (value (match-string 2))
                        (properties (list 'invisible 'no
                                          'face 'font-lock-variable-name-face)))
                    (cond
                     ((string= entity "Host")
                      (setq properties (plist-put properties 'ovirt-log-analyzer-host value)))
                     ((string= entity "VM")
                      (setq properties (plist-put properties 'ovirt-log-analyzer-vm value))))
                    (add-text-properties beg end properties)
                    (ovirt-log-analyzer-add-text beg " ")
                    (cl-incf end)
                    (cl-incf tag-end)
                    (goto-char end))))
              (put-text-property tag-beg (1+ tag-end) 'invisible 'yes))
          (put-text-property (line-beginning-position) (1+ (line-end-position)) 'invisible 'yes))
        (forward-line))
      (when (> max-file-field-length 0)
        (goto-char (point-min))
        (let (point)
          (ovirt-log-analyzer-while 500 (and (not (eobp))
                                            (setq point (next-single-char-property-change (point) 'ovirt-log-analyzer-file-field-length)))
            (goto-char point)
            (let ((length (get-char-property (point) 'ovirt-log-analyzer-file-field-length)))
              (when (and length
                         (< length max-file-field-length)
                         (get-text-property (point) 'ovirt-log-analyzer-file-field-length))
                (let ((spacer (make-string (- max-file-field-length length) ? )))
                  (ovirt-log-analyzer-add-text (point) spacer)
                  (goto-char (+ (point) (length spacer))))))
            (goto-char (1+ (point))))))
      (unless modified-p
        (set-buffer-modified-p nil))
      (when unknown-tags
        (message "Unknown tags found: %s" (mapconcat #'identity unknown-tags "; "))))))

