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;








14















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?










share|improve this question






























    14















    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?










    share|improve this question


























      14












      14








      14


      2






      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?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 7 '16 at 14:34









      Jeff Schaller

      44.7k1162145




      44.7k1162145










      asked Oct 7 '16 at 14:25









      bikeybikey

      71114




      71114




















          4 Answers
          4






          active

          oldest

          votes


















          13














          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





          share|improve this answer






























            2














            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)





            share|improve this answer























            • 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 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



















            1














            try something like:



            tail -f /tmp/myapp.log >> /tmp/tail.log &
            journalctl -f >> /tmp/tail.log &
            tail -f /tmp/tail.log





            share|improve this answer
































              0














              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.






              share|improve this answer










              New contributor




              Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




















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



                );













                draft saved

                draft discarded


















                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









                13














                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





                share|improve this answer



























                  13














                  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





                  share|improve this answer

























                    13












                    13








                    13







                    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





                    share|improve this answer













                    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






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 23 '17 at 15:12









                    don_crisstidon_crissti

                    51.8k15141168




                    51.8k15141168























                        2














                        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)





                        share|improve this answer























                        • 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 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
















                        2














                        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)





                        share|improve this answer























                        • 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 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














                        2












                        2








                        2







                        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)





                        share|improve this answer













                        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)






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Oct 7 '16 at 14:37









                        Jeff SchallerJeff 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 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


















                        • 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 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

















                        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












                        1














                        try something like:



                        tail -f /tmp/myapp.log >> /tmp/tail.log &
                        journalctl -f >> /tmp/tail.log &
                        tail -f /tmp/tail.log





                        share|improve this answer





























                          1














                          try something like:



                          tail -f /tmp/myapp.log >> /tmp/tail.log &
                          journalctl -f >> /tmp/tail.log &
                          tail -f /tmp/tail.log





                          share|improve this answer



























                            1












                            1








                            1







                            try something like:



                            tail -f /tmp/myapp.log >> /tmp/tail.log &
                            journalctl -f >> /tmp/tail.log &
                            tail -f /tmp/tail.log





                            share|improve this answer















                            try something like:



                            tail -f /tmp/myapp.log >> /tmp/tail.log &
                            journalctl -f >> /tmp/tail.log &
                            tail -f /tmp/tail.log






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Apr 23 '17 at 12:58









                            Jeff Schaller

                            44.7k1162145




                            44.7k1162145










                            answered Oct 7 '16 at 14:33









                            PaulPaul

                            115




                            115





















                                0














                                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.






                                share|improve this answer










                                New contributor




                                Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.
























                                  0














                                  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.






                                  share|improve this answer










                                  New contributor




                                  Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.






















                                    0












                                    0








                                    0







                                    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.






                                    share|improve this answer










                                    New contributor




                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.










                                    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.







                                    share|improve this answer










                                    New contributor




                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    share|improve this answer



                                    share|improve this answer








                                    edited 2 days ago









                                    Jeff Schaller

                                    44.7k1162145




                                    44.7k1162145






                                    New contributor




                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 2 days ago









                                    TouficToufic

                                    1




                                    1




                                    New contributor




                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    Toufic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.



























                                        draft saved

                                        draft discarded
















































                                        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.




                                        draft saved


                                        draft discarded














                                        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





















































                                        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







                                        Popular posts from this blog

                                        getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                                        Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                                        NetworkManager fails with “Could not find source connection”Trouble connecting to VPN using network-manager, while command line worksHow can I be notified about state changes to a VPN adapterBacktrack 5 R3 - Refuses to connect to VPNFeed all traffic through OpenVPN for a specific network namespace onlyRun daemon on startup in Debian once openvpn connection establishedpfsense tcp connection between openvpn and lan is brokenInternet connection problem with web browsers onlyWhy does NetworkManager explicitly support tun/tap devices?Browser issues with VPNTwo IP addresses assigned to the same network card - OpenVPN issues?Cannot connect to WiFi with nmcli, although secrets are provided