   (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)

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

              (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 "; "))))))

