   (toggle-truncate-lines 1)
   (setq font-lock-defaults ovirt-log-analyzer-font-lock-keywords)
   (setq buffer-invisibility-spec '(yes))
+  (add-hook 'before-save-hook 'ovirt-log-analyzer-cleanup nil t)
   (ovirt-log-analyzer-process))
 
 (provide 'ovirt-log-analyzer)

              (when visible-tags
                (goto-char tag-beg)
                (while (re-search-forward "\\(Host\\|VM\\)=\\([^; |]*\\)" tag-end t)
                  (let ((entity (match-string 1))
                        (value (match-string 2))
                        (o (make-overlay (match-beginning 0) (match-end 0))))
                    (overlay-put o 'invisible 'no)
                    (overlay-put o 'face 'font-lock-variable-name-face)
                    (overlay-put o 'before-string " ")
                    (overlay-put o 'priority 10)
                    (cond
                     ((string= entity "Host")
                      (overlay-put o 'ovirt-log-analyzer-host value))
                     ((string= entity "VM")
                      (overlay-put o 'ovirt-log-analyzer-vm value)))
                    (goto-char (overlay-end o)))))
              (overlay-put tag-overlay 'invisible 'yes))
          (let ((o (make-overlay (line-beginning-position) (1+ (line-end-position)))))
            (overlay-put o 'invisible 'yes)))
        (forward-line))
      (when (> max-file-field-length 0)
        (goto-char (point-min))
        (let (point)
          (ovirt-log-analyzer-while 100 (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))
                (let ((overlay (cl-find-if #'(lambda (o) (overlay-get o 'ovirt-log-analyzer-file-field-length)) (overlays-at (point)))))
                  (overlay-put overlay 'after-string (make-string (- max-file-field-length length) ? )))))
            (goto-char (1+ (point))))))
      (when unknown-tags
        (message "Unknown tags found: %s" (mapconcat #'identity unknown-tags "; "))))))


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