1 |
Hello, Lee. |
2 |
|
3 |
On Tue, Feb 17, 2015 at 07:26:05PM +0100, lee wrote: |
4 |
> Hi, |
5 |
|
6 |
> how do you read the log files when using syslog-ng? |
7 |
|
8 |
> The log file seem to be some sort of binary that doesn't display too |
9 |
> well in less, and there doesn't seem to be any way to read them. |
10 |
|
11 |
When I try "less /var/log/messages", less gives me what is basically a |
12 |
hex dump of the file. I'm assuming you see the same. |
13 |
|
14 |
less searches part of the buffer (presumably the first few KB) and if it |
15 |
finds non-printable characters, uses an input filter first to convert to |
16 |
the hex dump. This same filter is what enables less to expand |
17 |
compressed files and man pages. |
18 |
|
19 |
What I do is to disable this input filter with |
20 |
|
21 |
# LESSOPEN="" less /var/log/messages |
22 |
|
23 |
. It is evident that every now and then, syslog-ng writes a stream of |
24 |
several hundred null bytes to /var/log/messages. It seems to do this |
25 |
when logging the system startup messages. This is probably a bug. |
26 |
|
27 |
By the way, the LESSOPEN="" trick can sometimes leave your display |
28 |
corrupted, displaying wierd glyphs on the screen when you type. To |
29 |
restore your screen, output ^o. To do this, type (blindly) |
30 |
|
31 |
# echo <ctrl-v><crtl-o><CR> |
32 |
|
33 |
. |
34 |
|
35 |
> -- |
36 |
> Again we must be afraid of speaking of daemons for fear that daemons |
37 |
> might swallow us. Finally, this fear has become reasonable. |
38 |
|
39 |
-- |
40 |
Alan Mackenzie (Nuremberg, Germany). |