Как Вы делаете это будет зависеть, на котором демоне журнала Вы используете, syslog
или syslog-ng
.
С системным журналом можно сделать это путем тонкой настройки определенного уровня журнала, чтобы только содержать iptables
сообщения.
В /etc/syslog.conf
:
kern.warning /var/log/iptables
Набор iptables
использовать тот уровень журнала:
iptables -A INPUT -j LOG --log-level 4
С syslog-ng
необходимо смочь стать немного более необычными. Вместо того, чтобы взломать уровень журнала можно отфильтровать для содержания и отправить то содержание в определенный файл журнала.
В /etc/syslog-ng/syslog-ng.conf
:
destination d_iptables { file("/var/log/iptables"); };
filter f_iptables { match("IN=[A-Za-z0-9\.]* OUT=[A-Za-z0-9\.]*" value("MESSAGE")); };
log { source(s_sys); filter(f_iptables); destination(d_iptables); }
(defun delete-line (&optional arg)
(interactive "P")
(flet ((kill-region (begin end)
(delete-region begin end)))
(kill-line arg)))
Возможно, это не лучшее решение, но это кажется работами. Вы, возможно, должны связать 'удалять-строку' с некоторым глобальным ключом, такой как
(global-set-key [(control shift ?k)] 'delete-line)
cinsk ответ не сработал для меня на emacs 24.
Но это сработало:
;; Ctrl-K with no kill
(defun delete-line-no-kill ()
(interactive)
(delete-region
(point)
(save-excursion (move-end-of-line 1) (point)))
(delete-char 1)
)
(global-set-key (kbd "C-k") 'delete-line-no-kill)
El enfoque que sigo es simplemente reescribir kill-line
para usar delete-region
en lugar de kill-region
. Las funciones kill-region
y delete-region
son casi las mismas. La gran diferencia es que el primero guarda lo que se elimina en el anillo de eliminación. Este último no. Reescribir la función con este reemplazo conserva el comportamiento exacto de kill-line
sin efectos secundarios.
(defun my/kill-line (&optional arg)
"Delete the rest of the current line; if no nonblanks there, delete thru newline.
With prefix argument ARG, delete that many lines from point.
Negative arguments delete lines backward.
With zero argument, delete the text before point on the current line.
When calling from a program, nil means \"no arg\",
a number counts as a prefix arg.
If `show-trailing-whitespace' is non-nil, this command will just
delete the rest of the current line, even if there are no nonblanks
there.
If option `kill-whole-line' is non-nil, then this command deletes the whole line
including its terminating newline, when used at the beginning of a line
with no argument.
If the buffer is read-only, Emacs will beep and refrain from deleting
the line."
(interactive "P")
(delete-region
(point)
(progn
(if arg
(forward-visible-line (prefix-numeric-value arg))
(if (eobp)
(signal 'end-of-buffer nil))
(let ((end
(save-excursion
(end-of-visible-line) (point))))
(if (or (save-excursion
;; If trailing whitespace is visible,
;; don't treat it as nothing.
(unless show-trailing-whitespace
(skip-chars-forward " \t" end))
(= (point) end))
(and kill-whole-line (bolp)))
(forward-visible-line 1)
(goto-char end))))
(point))))
(global-set-key (kbd "C-k") 'my/kill-line)
C-H k
, затем введите привязку клавиш, работает ли она. – cinsk 09.06.2014, 04:05