Combining tail && journalctlForward logs from file to journaldStop tailing logClear terminal window before tail -f outputdoes journalctl eliminate the need for most logging?How to view stderr log only with journalctl?Application log files to the systemd journalWhy journalctl does not display log message if I use filtering by unit?Bypass systemd-journald to send messages directly to ryslog daemonHow to continuously tail a log, find all files (sed), and display (cat) the found filesrsyslog: send logs to different file using custom templateGetting systemd service logs faster from my service
Are the number of citations and number of published articles the most important criteria for a tenure promotion?
How to format long polynomial?
"You are your self first supporter", a more proper way to say it
What are these boxed doors outside store fronts in New York?
Why does Kotter return in Welcome Back Kotter?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Can I make popcorn with any corn?
Perform and show arithmetic with LuaLaTeX
Is it possible to run Internet Explorer on OS X El Capitan?
Does an object always see its latest internal state irrespective of thread?
dbcc cleantable batch size explanation
How do I deal with an unproductive colleague in a small company?
A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?
How does one intimidate enemies without having the capacity for violence?
strTok function (thread safe, supports empty tokens, doesn't change string)
How to draw a waving flag in TikZ
Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?
Watching something be written to a file live with tail
Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?
What typically incentivizes a professor to change jobs to a lower ranking university?
Why do I get two different answers for this counting problem?
Replacing matching entries in one column of a file by another column from a different file
Convert two switches to a dual stack, and add outlet - possible here?
Why is consensus so controversial in Britain?
Combining tail && journalctl
Forward logs from file to journaldStop tailing logClear terminal window before tail -f outputdoes journalctl eliminate the need for most logging?How to view stderr log only with journalctl?Application log files to the systemd journalWhy journalctl does not display log message if I use filtering by unit?Bypass systemd-journald to send messages directly to ryslog daemonHow to continuously tail a log, find all files (sed), and display (cat) the found filesrsyslog: send logs to different file using custom templateGetting systemd service logs faster from my service
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm tailing logs of my own app and postgres.
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log
I need to include pgpool's logs. It used to be syslog but now it is in journalctl.
Is there a way to tie tail -f && journalctl -f together?
systemd tail journalctl
add a comment |
I'm tailing logs of my own app and postgres.
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log
I need to include pgpool's logs. It used to be syslog but now it is in journalctl.
Is there a way to tie tail -f && journalctl -f together?
systemd tail journalctl
add a comment |
I'm tailing logs of my own app and postgres.
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log
I need to include pgpool's logs. It used to be syslog but now it is in journalctl.
Is there a way to tie tail -f && journalctl -f together?
systemd tail journalctl
I'm tailing logs of my own app and postgres.
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log
I need to include pgpool's logs. It used to be syslog but now it is in journalctl.
Is there a way to tie tail -f && journalctl -f together?
systemd tail journalctl
systemd tail journalctl
edited Oct 7 '16 at 14:34
Jeff Schaller♦
44.7k1162145
44.7k1162145
asked Oct 7 '16 at 14:25
bikeybikey
71114
71114
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
You could forward your log entries to journal:
systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log
and then use journalctl -f
... though as Mark mentioned, that will print all journal entries.
One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER
i.e. edit the unit file and under the [Service]
section add e.g.
SyslogIdentifier=my_stuff
restart the unit then run systemd-cat
with the same identifier
systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log
and finally query the journal only for that particular identifier:
journalctl -f -t my_stuff
add a comment |
If you have bash available, you can use process substitution as one of the tail
parameters:
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service namedpgpool.service
, tryjournalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in thesystemd-journal
group!
– Mark Stosberg
Oct 10 '16 at 13:50
add a comment |
try something like:
tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log
add a comment |
You could use:
journalctl -u service-name -f
-f, --follow
Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name
.
New contributor
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f314985%2fcombining-tail-journalctl%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could forward your log entries to journal:
systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log
and then use journalctl -f
... though as Mark mentioned, that will print all journal entries.
One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER
i.e. edit the unit file and under the [Service]
section add e.g.
SyslogIdentifier=my_stuff
restart the unit then run systemd-cat
with the same identifier
systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log
and finally query the journal only for that particular identifier:
journalctl -f -t my_stuff
add a comment |
You could forward your log entries to journal:
systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log
and then use journalctl -f
... though as Mark mentioned, that will print all journal entries.
One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER
i.e. edit the unit file and under the [Service]
section add e.g.
SyslogIdentifier=my_stuff
restart the unit then run systemd-cat
with the same identifier
systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log
and finally query the journal only for that particular identifier:
journalctl -f -t my_stuff
add a comment |
You could forward your log entries to journal:
systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log
and then use journalctl -f
... though as Mark mentioned, that will print all journal entries.
One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER
i.e. edit the unit file and under the [Service]
section add e.g.
SyslogIdentifier=my_stuff
restart the unit then run systemd-cat
with the same identifier
systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log
and finally query the journal only for that particular identifier:
journalctl -f -t my_stuff
You could forward your log entries to journal:
systemd-cat tail -f /tmp/myapp.log /var/log/postgresql.log
and then use journalctl -f
... though as Mark mentioned, that will print all journal entries.
One way to filter only the messages from those logs and from that particular unit is to use a distinct SYSLOG_IDENTIFIER
i.e. edit the unit file and under the [Service]
section add e.g.
SyslogIdentifier=my_stuff
restart the unit then run systemd-cat
with the same identifier
systemd-cat -t my_stuff tail -f /tmp/myapp.log /var/log/postgresql.log
and finally query the journal only for that particular identifier:
journalctl -f -t my_stuff
answered Apr 23 '17 at 15:12
don_crisstidon_crissti
51.8k15141168
51.8k15141168
add a comment |
add a comment |
If you have bash available, you can use process substitution as one of the tail
parameters:
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service namedpgpool.service
, tryjournalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in thesystemd-journal
group!
– Mark Stosberg
Oct 10 '16 at 13:50
add a comment |
If you have bash available, you can use process substitution as one of the tail
parameters:
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service namedpgpool.service
, tryjournalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in thesystemd-journal
group!
– Mark Stosberg
Oct 10 '16 at 13:50
add a comment |
If you have bash available, you can use process substitution as one of the tail
parameters:
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
If you have bash available, you can use process substitution as one of the tail
parameters:
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log <(journalctl -f)
answered Oct 7 '16 at 14:37
Jeff Schaller♦Jeff Schaller
44.7k1162145
44.7k1162145
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service namedpgpool.service
, tryjournalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in thesystemd-journal
group!
– Mark Stosberg
Oct 10 '16 at 13:50
add a comment |
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service namedpgpool.service
, tryjournalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in thesystemd-journal
group!
– Mark Stosberg
Oct 10 '16 at 13:50
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
This is the elegant way I also tried, but is doesn't work. Tail shows that it's using /dev/fd/xx, but no logs are displayed.
– bikey
Oct 7 '16 at 15:12
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
correct; /dev/fd/xxx is the temporary pipe that bash uses in order to implement the process substitution; any journalctl output will show up in there.
– Jeff Schaller♦
Oct 7 '16 at 15:13
4
4
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service named
pgpool.service
, try journalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in the systemd-journal
group!– Mark Stosberg
Oct 10 '16 at 13:50
You probably don't want to follow the whole journal but just those for the pgpool unit. Assuming the service named
pgpool.service
, try journalctl -fu pgpool.service
. Also, if you are not running this as root, make sure the user is in the systemd-journal
group!– Mark Stosberg
Oct 10 '16 at 13:50
add a comment |
try something like:
tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log
add a comment |
try something like:
tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log
add a comment |
try something like:
tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log
try something like:
tail -f /tmp/myapp.log >> /tmp/tail.log &
journalctl -f >> /tmp/tail.log &
tail -f /tmp/tail.log
edited Apr 23 '17 at 12:58
Jeff Schaller♦
44.7k1162145
44.7k1162145
answered Oct 7 '16 at 14:33
PaulPaul
115
115
add a comment |
add a comment |
You could use:
journalctl -u service-name -f
-f, --follow
Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name
.
New contributor
add a comment |
You could use:
journalctl -u service-name -f
-f, --follow
Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name
.
New contributor
add a comment |
You could use:
journalctl -u service-name -f
-f, --follow
Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name
.
New contributor
You could use:
journalctl -u service-name -f
-f, --follow
Show only the most recent journal entries, and continuously print new entries as they are appended to the journal.
Here I've added "service-name" to distinguish this answer from others; you substitute the actual service name instead of the text service-name
.
New contributor
edited 2 days ago
Jeff Schaller♦
44.7k1162145
44.7k1162145
New contributor
answered 2 days ago
TouficToufic
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f314985%2fcombining-tail-journalctl%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown