{"id":27,"date":"2018-04-24T22:15:47","date_gmt":"2018-04-24T22:15:47","guid":{"rendered":"https:\/\/techplushost.com\/blog\/?p=27"},"modified":"2019-04-29T14:55:27","modified_gmt":"2019-04-29T14:55:27","slug":"how-to-view-linux-logs","status":"publish","type":"post","link":"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/","title":{"rendered":"How to view Linux Logs?"},"content":{"rendered":"<p>When your systems are running smoothly, take some time to learn and understand the content of various log files, which will help you when there is a crisis and you have to look though the log files to identify the issue. The operating system and running applications constantly create different types of messages that are registered in different log files.<\/p>\n<p>Open the Terminal or login as root user using ssh command. Go to \/var\/log directory using the following cd command:<\/p>\n<pre class=\"CodeBlock\"># cd \/var\/log<\/pre>\n<p>To list files use the following ls command:<\/p>\n<pre class=\"CodeBlock\"># ls<\/pre>\n<p>To view the log files use any one of the following methods:<\/p>\n<p><b>vi<\/b>\u00a0\u2013 If you are comfortable with the vi commands, use vi editor for quick log file browsing.<br \/>\n<b>tail<\/b>\u00a0\u2013 If you want to view the content of the log files real time, as the application is writting to it, use \u201ctail -f\u201d. You can also view multiple log files at the same time (using \u201ctail -f\u201d).<br \/>\n<b>grep<\/b>\u00a0\u2013 If you know exactly what you are looking for in a log file, you can quickly use grep command to grep a pattern. The 15 practical grep examples will take out all your excuses of not using grep.<br \/>\n<b>less<\/b>\u00a0\u2013 Less command is very powerful to browse log files. Use these 10 less command tips to master the less command.<\/p>\n<p><a title=\"Link: http:\/\/geek-university.com\/linux\/var-log-messages-file\/\" href=\"http:\/\/geek-university.com\/linux\/var-log-messages-file\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/var\/log\/messages<\/a>\u00a0\u2013 Contains global system messages, including the messages that are logged during system startup. There are several things that are logged in \/var\/log\/messages including mail, cron, daemon, kern, auth, etc.<\/p>\n<p><a title=\"Link: https:\/\/www.loggly.com\/ultimate-guide\/analyzing-linux-logs\/\" href=\"https:\/\/www.loggly.com\/ultimate-guide\/analyzing-linux-logs\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u00a0\/var\/log\/auth.log<\/a>\u00a0\u2013 Contains system authorization information, including user logins and authentication mechanism that were used.<\/p>\n<p>\/var\/log\/kern.log \u2013 Contains information logged by the kernel. Helpful for you to troubleshoot a custom-built kernel.<\/p>\n<p><a href=\"https:\/\/www.cyberciti.biz\/faq\/how-to-check-cron-logs-in-ubuntu-linux\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/var\/log\/cron<\/a>\u00a0\u2013 Whenever cron daemon (or anacron) starts a cron job, it logs the information about the cron job in this file<\/p>\n<p>\/var\/log\/secure \u2013 Contains information related to authentication and authorization privileges. For example, sshd logs all the messages here, including unsuccessful login.<\/p>\n<p><a href=\"http:\/\/www.linfo.org\/dmesg.html\" rel=\"nofollow\">\/var\/log\/dmesg<\/a>\u00a0\u2013 Contains kernel ring buffer information. When the system boots up, it prints number of messages on the screen that displays information about the hardware devices that the kernel detects during boot process. These messages are available in kernel ring buffer and whenever the new message comes the old message gets overwritten. You can also view the content of this file using the dmesg command.<\/p>\n<p><a title=\"Link: https:\/\/wiki.debian.org\/bootlogd\" href=\"https:\/\/wiki.debian.org\/bootlogd\" rel=\"nofollow\">\/var\/log\/boot.log\u00a0<\/a>\u2013 Contains information that are logged when the system boots<\/p>\n<p>\/var\/log\/daemon.log \u2013 Contains information logged by the various background daemons that runs on the system<\/p>\n<p>\/var\/log\/dpkg.log \u2013 Contains information that are logged when a package is installed or removed using dpkg command<\/p>\n<p>\/var\/log\/lastlog \u2013 Displays the recent login information for all the users. This is not an ascii file. You should use lastlog command to view the content of this file.<\/p>\n<p>\/var\/log\/maillog \/var\/log\/mail.log \u2013 Contains the log information from the mail server that is running on the system. For example, sendmail logs information about all the sent items to this file<\/p>\n<p>\/var\/log\/user.log \u2013 Contains information about all user level logs<\/p>\n<p>\/var\/log\/Xorg.x.log \u2013 Log messages from the X<\/p>\n<p>\/var\/log\/alternatives.log \u2013 Information by the update-alternatives are logged into this log file. On Ubuntu, update-alternatives maintains symbolic links determining default commands.<\/p>\n<p>\/var\/log\/btmp \u2013 This file contains information about failed login attemps. Use the last command to view the btmp file. For example, \u201clast -f \/var\/log\/btmp | more\u201d<\/p>\n<p>\/var\/log\/cups \u2013 All printer and printing related log messages<\/p>\n<p>\/var\/log\/anaconda.log \u2013 When you install Linux, all installation related messages are stored in this log file<\/p>\n<p>\/var\/log\/yum.log \u2013 Contains information that are logged when a package is installed using yum<\/p>\n<p>\/var\/log\/wtmp or \/var\/log\/utmp \u2013 Contains login records. Using wtmp you can find out who is logged into the system. who command uses this file to display the information.<\/p>\n<p>\/var\/log\/faillog \u2013 Contains user failed login attemps. Use faillog command to display the content of this file.<\/p>\n<p><a href=\"https:\/\/httpd.apache.org\/docs\/current\/logs.html\" rel=\"nofollow\">\/var\/log\/httpd\/\u00a0<\/a>(or) \/var\/log\/apache2 \u2013 Contains the apache web server access_log and error_log<\/p>\n<p>\/var\/log\/lighttpd\/ \u2013 Contains light HTTPD access_log and error_log<\/p>\n<p>\/var\/log\/conman\/ \u2013 Log files for ConMan client. conman connects remote consoles that are managed by conmand daemon.<\/p>\n<p>\/var\/log\/mail\/ \u2013 This subdirectory contains additional logs from your mail server. For example, sendmail stores the collected mail statistics in \/var\/log\/mail\/statistics file<\/p>\n<p>\/var\/log\/prelink\/ \u2013 prelink program modifies shared libraries and linked binaries to speed up the startup process. \/var\/log\/prelink\/prelink.log contains the information about the .so file that was modified by the prelink.<\/p>\n<p><a href=\"https:\/\/linux-audit.com\/linux-audit-log-files-in-var-log-audit\/\" rel=\"nofollow\">\/var\/log\/audit\/\u00a0<\/a>\u2013 Contains logs information stored by the Linux audit daemon (auditd).<\/p>\n<p>\/var\/log\/setroubleshoot\/ \u2013 SELinux uses setroubleshootd (SE Trouble Shoot Daemon) to notify about issues in the security context of files, and logs those information in this log file.<\/p>\n<p><a href=\"https:\/\/wiki.samba.org\/index.php\/Configuring_Logging_on_a_Samba_Server\" rel=\"nofollow\">\/var\/log\/samba\/\u00a0<\/a>\u2013 Contains log information stored by samba, which is used to connect Windows to Linux.<\/p>\n<p><a href=\"https:\/\/github.com\/sysstat\/sysstat\" rel=\"nofollow\">\/var\/log\/sa\/<\/a>\u00a0\u2013 Contains the daily sar files that are collected by the sysstat package.<\/p>\n<p><a href=\"https:\/\/docs.pagure.org\/SSSD.sssd\/users\/troubleshooting.html\" rel=\"nofollow\">\/var\/log\/sssd\/<\/a>\u00a0\u2013 Use by system security services daemon that manage access to remote directories and authentication mechanisms.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When your systems are running smoothly, take some time to learn and understand the content of various log files, which will help you when there is a crisis and you have to look though the log files to identify the issue. The operating system and running applications constantly create different &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[10],"tags":[16],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to view Linux Logs? | TechPlusHost | Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to view Linux Logs? | TechPlusHost | Blog\" \/>\n<meta property=\"og:description\" content=\"When your systems are running smoothly, take some time to learn and understand the content of various log files, which will help you when there is a crisis and you have to look though the log files to identify the issue. The operating system and running applications constantly create different &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/\" \/>\n<meta property=\"og:site_name\" content=\"TechPlusHost | Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/web.facebook.com\/techplushost\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-24T22:15:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-29T14:55:27+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@techplushost\" \/>\n<meta name=\"twitter:site\" content=\"@techplushost\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"Tolulope Oyeniyi\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"4 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/techplushost.com\/blog\/#organization\",\"name\":\"TechPlusHost\",\"url\":\"https:\/\/techplushost.com\/blog\/\",\"sameAs\":[\"https:\/\/web.facebook.com\/techplushost\",\"https:\/\/www.instagram.com\/techplushost\/\",\"https:\/\/twitter.com\/techplushost\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/techplushost.com\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/i1.wp.com\/techplushost.com\/blog\/wp-content\/uploads\/2018\/04\/logo.png?fit=314%2C108&ssl=1\",\"width\":314,\"height\":108,\"caption\":\"TechPlusHost\"},\"image\":{\"@id\":\"https:\/\/techplushost.com\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/techplushost.com\/blog\/#website\",\"url\":\"https:\/\/techplushost.com\/blog\/\",\"name\":\"TechPlusHost\",\"description\":\"Our Blog\",\"publisher\":{\"@id\":\"https:\/\/techplushost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/techplushost.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/#webpage\",\"url\":\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/\",\"name\":\"How to view Linux Logs? | TechPlusHost | Blog\",\"isPartOf\":{\"@id\":\"https:\/\/techplushost.com\/blog\/#website\"},\"datePublished\":\"2018-04-24T22:15:47+00:00\",\"dateModified\":\"2019-04-29T14:55:27+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/\"]}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/#webpage\"},\"author\":{\"@id\":\"https:\/\/techplushost.com\/blog\/#\/schema\/person\/05c8d030ad69f48b481298cd68c7df43\"},\"headline\":\"How to view Linux Logs?\",\"datePublished\":\"2018-04-24T22:15:47+00:00\",\"dateModified\":\"2019-04-29T14:55:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/techplushost.com\/blog\/#organization\"},\"keywords\":\"Linux Logs\",\"articleSection\":\"Various Tutorials\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/techplushost.com\/blog\/how-to-view-linux-logs\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/techplushost.com\/blog\/#\/schema\/person\/05c8d030ad69f48b481298cd68c7df43\",\"name\":\"Tolulope Oyeniyi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/techplushost.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/862d4163a73f8f6f83733690bfb1b535?s=96&d=wavatar&r=g\",\"caption\":\"Tolulope Oyeniyi\"},\"sameAs\":[\"https:\/\/techplushost.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9RiNW-r","jetpack-related-posts":[{"id":82,"url":"https:\/\/techplushost.com\/blog\/cyberpanel-installation-and-starting-usage-of-cyberpanel\/","url_meta":{"origin":27,"position":0},"title":"[CyberPanel] Installation and starting usage of CyberPanel","date":"April 29, 2019","format":false,"excerpt":"Introduction: In this guide we will introduce you on how to install CyberPanel into your VPS. This is a control panel that eases the control on domains, databases, e-mails and users that are added to your server. For more information and updates on the CyberPanel, you can check the home\u2026","rel":"","context":"In &quot;Linux Applications&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":86,"url":"https:\/\/techplushost.com\/blog\/how-to-manually-import-emails\/","url_meta":{"origin":27,"position":1},"title":"How to manually import emails","date":"May 1, 2019","format":false,"excerpt":"Instructions for manual import of the emails to your CWP server. 1. Create all required mailboxes via CWP2. Login in each created mailbox (this will create required file and folder structure)3. Copy the emails (like any other files) in \/var\/vmail\/DOMAIN.COM\/USERNAME4. Fix Permissions (chown uploaded files vmail:mail) Example path for email\u2026","rel":"","context":"In &quot;Web hosting control panels&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":80,"url":"https:\/\/techplushost.com\/blog\/sshfs-installation-and-mounting\/","url_meta":{"origin":27,"position":2},"title":"SSHFS: Installation and Mounting","date":"April 29, 2019","format":false,"excerpt":"Introduction SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection. The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP), a network protocol providing file access, file\u2026","rel":"","context":"In &quot;Linux Applications&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":54,"url":"https:\/\/techplushost.com\/blog\/webmin-setting-up-multiple-php-versions-in-webmin-virtualmin\/","url_meta":{"origin":27,"position":3},"title":"[Webmin] Setting up multiple PHP versions in Webmin\/Virtualmin","date":"April 25, 2018","format":false,"excerpt":"Webmin control panel allows you to have several PHP versions in the same server. There is a possibility to choose different PHP versions for seperate Virtual Servers (per domain and per directory). 0. Preliminary requirements Webmin 1.8 using CentOS 6. 1. Log into your server Log in to your server\u2026","rel":"","context":"In &quot;Tutorials&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":92,"url":"https:\/\/techplushost.com\/blog\/windows-plesk-installation-guide\/","url_meta":{"origin":27,"position":4},"title":"[Windows] Plesk installation guide","date":"July 22, 2019","format":false,"excerpt":"Plesk\u00a0- commercial web hosting control panel. As most of such control panels, it allows a server administrator to set up new websites, reseller accounts, e-mail accounts, and DNS entries through a web-based interface. Requirements: Windows VPS server 0. Log-in to the server via\u00a0RDP. 1. Visit Plesk\u00a0webpage\u00a0on your browser. At the\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":95,"url":"https:\/\/techplushost.com\/blog\/plesk-getting-started-with-plesk\/","url_meta":{"origin":27,"position":5},"title":"[Plesk] Getting started with Plesk","date":"July 22, 2019","format":false,"excerpt":"IntroductionPlesk is commercial web hosting data center automation software developed for Linux- and Windows-based commercial hosting service providers. Plesk was designed to install and manage web hosting systems and applications on a single server. The control panel is designed to simplify the management and administration of the websites by automating\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/posts\/27"}],"collection":[{"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":2,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techplushost.com\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}