1 |
On Mon, Feb 9, 2015 at 6:52 AM, Alec Ten Harmsel |
2 |
<alec@××××××××××××××.com> wrote: |
3 |
> |
4 |
> On 02/09/2015 06:49 AM, Mick wrote: |
5 |
>> On Monday 09 Feb 2015 11:23:15 Rich Freeman wrote: |
6 |
>>> You don't have to export them from anything unless you need their |
7 |
>>> content in a text file. If you just run "journalctl" that is the |
8 |
>>> equivalent of typing cat /var/log/messages. If you do want to parse |
9 |
>>> them with an external tool then you get your choice of several text |
10 |
>>> formats and json. |
11 |
>> The thing is I never use cat. I invariably use less, rview, or grep, to |
12 |
>> browse or search the log files. |
13 |
>> |
14 |
>> How will this work with journalctl, will I have to export them first into a |
15 |
>> different format? |
16 |
>> |
17 |
> |
18 |
> You can run `journalctl | grep whatever`. I don't know what rview is, |
19 |
> but as long as whatever you're using supports pipes you should be fine. |
20 |
> |
21 |
|
22 |
Keep in mind that if you're grepping logs, there is probably a better |
23 |
way to accomplish what you want to do with journalctl's options. |
24 |
Finding all output from a particular daemon is going to be more |
25 |
reliable if you filter by unit, versus getting verbose log output from |
26 |
your mail server that has "mysql" somewhere in it or whatever. That |
27 |
is the main reason for using a binary log format. |
28 |
|
29 |
But, yes, you can just pipe the output into the tool of your choice. |
30 |
If you keep a lot of logs like I do it might be wiser to prefilter it |
31 |
a bit, such as by adding -b to the options to limit it to entries |
32 |
since the last reboot. |
33 |
|
34 |
I also tend to keep a journalctl -f running in a screen session, which |
35 |
is the equivalent of a tail -f. |
36 |
|
37 |
If you're using an automated tool you can also use cursors to bookmark |
38 |
the last entry you read and then ask journalctl for entries since that |
39 |
one. Of course, an automated tool would probably just read the logs |
40 |
via dbus or whatever (I haven't taken the time to look into the APIs). |
41 |
|
42 |
-- |
43 |
Rich |