{"id":6245,"date":"2018-08-16T14:43:12","date_gmt":"2018-08-16T10:43:12","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-monitor-your-linux-server-using-osquery\/"},"modified":"2018-08-16T14:43:12","modified_gmt":"2018-08-16T10:43:12","slug":"how-to-monitor-your-linux-server-using-osquery","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-monitor-your-linux-server-using-osquery\/","title":{"rendered":"How to Monitor your Linux Server using osquery"},"content":{"rendered":"<p>Osquery is an open source Operating System monitoring, query, and analytics software. Created by Facebook, it exposes an operating system as a high-performance relational database that can be queried using SQL-based queries.<\/p>\n<p>Osquery is a multi-platform software, can be installed on Linux, Windows, MacOS, and FreeBSD. Osquery allows us to explore\u00a0the operating system profile, performance, security and many more metrics by using SQL-based queries.<\/p>\n<p>In this tutorial, I will show you how to install osquery on the Linux distributions Ubuntu 18.04 LTS and CentOS 7. We will install osquery, learn how to use the &#8216;osqueryi&#8217; interactive mode, and how to monitor a\u00a0live system using osquery.<\/p>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<ul>\n<li>Linux OS (Ubuntu 18.04 or CentOS 7)<\/li>\n<li>Root privileges<\/li>\n<\/ul>\n<h2 id=\"what-we-will-do\">What we will do<\/h2>\n<ul>\n<li>Install osquery on Linux Operating System<\/li>\n<li>Basic Usage of osqueryi Interactive Mode<\/li>\n<li>Monitoring System using osquery<\/li>\n<\/ul>\n<h2 id=\"step-install-osquery-on-linux-operating-system\">Step 1 &#8211; Install osquery on Linux Operating System<\/h2>\n<p>osquery provides its own repository for each platform. Ithis step, we will install the osquery package\u00a0from the official osquery repository.<\/p>\n<h3 id=\"on-ubuntu\">On Ubuntu<\/h3>\n<p>Add the osquery key.<strong><br \/><\/strong><\/p>\n<p class=\"command\">export OSQUERY_KEY=1484120AC4E9F8A1A577AEEE97A80C63C9D8B80B<br \/>sudo apt-key adv &#8211;keyserver keyserver.ubuntu.com &#8211;recv-keys $OSQUERY_KEY<\/p>\n<p>Install the osquery package on Ubuntu.<\/p>\n<p class=\"command\">sudo add-apt-repository &#8216;deb [arch=amd64] https:\/\/pkg.osquery.io\/deb deb main&#8217;<br \/>sudo apt install osquery -y<strong><br \/><\/strong><\/p>\n<h3 id=\"on-centos\">On CentOS<\/h3>\n<p>Add the osquery key.<strong><br \/><\/strong><\/p>\n<p class=\"command\">curl -L https:\/\/pkg.osquery.io\/rpm\/GPG | sudo tee \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-osquery<\/p>\n<p>Install the osquery package on CentOS 7.<\/p>\n<p class=\"command\">sudo yum-config-manager &#8211;add-repo https:\/\/pkg.osquery.io\/rpm\/osquery-s3-rpm.repo<br \/>sudo yum-config-manager &#8211;enable osquery-s3-rpm<br \/>sudo yum install osquery<\/p>\n<p>Wait for all packages to be installed.<\/p>\n<p><a class=\"fancybox\" id=\"img-1\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery.png\" alt=\"Install osquery\" width=\"500\" height=\"184\" title=\"\"><\/a><\/p>\n<h2 id=\"step-basic-usage-of-osqueryi-interactive-mode\">Step 2 &#8211; Basic Usage of osqueryi Interactive Mode<\/h2>\n<p>osquery provides two main interfaces to the users, osqueryi, and osqueryd.<\/p>\n<p>osqueryi is the osquery interactive query console. It&#8217;s like the &#8216;mysql&#8217; command shell on the MySQL and the &#8216;psql&#8217; shell on PostgreSQL database.<\/p>\n<p>In this step, we will learn the basic usage of the &#8216;osqueryi&#8217; interactive mode.<\/p>\n<p>Type the &#8216;osqueryi&#8217; command on the server terminal, and you will get the osquery interactive console mode.<\/p>\n<p class=\"command\">osqueryi<\/p>\n<p>Next, we will learn about the basic command of the osqueryi console mode.<\/p>\n<p>Show all basic available commands on the interactive mode osqueryi.<\/p>\n<p class=\"command\">.help<\/p>\n<p><a class=\"fancybox\" id=\"img-2\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-1.png\" alt=\"using osqueryi command\" width=\"461\" height=\"550\" title=\"\"><\/a><\/p>\n<p>Show the current osquery configurations and settings.<\/p>\n<p class=\"command\">.show<\/p>\n<p><a class=\"fancybox\" id=\"img-3\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/3.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-2.png\" alt=\"Show osquery configuration\" width=\"388\" height=\"550\" title=\"\"><\/a><\/p>\n<p>Osquery provides multiple view modes to show query results. The default mode is the &#8216;pretty&#8217; mode.<\/p>\n<p>Now we&#8217;ll change the view mode of query results, for this guide, we will be using the &#8216;line&#8217; mode.<\/p>\n<p class=\"command\">.mode csv<br \/>.mode list<br \/>.mode column<br \/>.mode line<br \/>.mode pretty<\/p>\n<p>Osquery exposes the operating system as a relational database system. All info about the system is stored in the osquery tables and we can explore the whole system info by querying all available tables.<\/p>\n<p>To get a list all available tables in the osquery, run the command below.<\/p>\n<p class=\"command\">.tables<\/p>\n<p><a class=\"fancybox\" id=\"img-4\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/4.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-3.png\" alt=\"Get a list of all tables\" width=\"500\" height=\"419\" title=\"\"><\/a><\/p>\n<p>Once we know all the available tables in the osquery system, we will look at the columns.<\/p>\n<p>Use the following command to get the schema (columns, types) of tables.<\/p>\n<p class=\"command\">.schema users<br \/>.schema processes<\/p>\n<p><a class=\"fancybox\" id=\"img-5\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/5.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-4.png\" alt=\"Get osquery columns\" width=\"500\" height=\"81\" title=\"\"><\/a><\/p>\n<p>And you will get all schema columns of the table.<\/p>\n<h2 id=\"step-basic-linux-monitoring-using-query\">Step 3 &#8211; Basic Linux Monitoring using query<\/h2>\n<p>In this step, we will monitor a live Linux system using the osquery. We will monitor the system profile info, users, network interfaces etc through the osqueryi interactive mode.<\/p>\n<h3 id=\"get-system-info\">Get System Info<\/h3>\n<p>Show\u00a0details about the system hardware.<\/p>\n<p class=\"command\">SELECT * FROM system_info;<br \/>SELECT hostname, cpu_type, physical_memory, hardware_vendor, hardware_model FROM system_info;<\/p>\n<p><a class=\"fancybox\" id=\"img-6\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-5.png\" alt=\"Show system hardware details\" width=\"500\" height=\"298\" title=\"\"><\/a><\/p>\n<h3 id=\"get-os-version\">Get OS Version<\/h3>\n<p>Show the current operating system info, including the os version, platform, os patch, and codename.<\/p>\n<p class=\"command\">SELECT * FROM os_version;<\/p>\n<p><a class=\"fancybox\" id=\"img-7\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/7.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-6.png\" alt=\"Show details about the OS\" width=\"500\" height=\"262\" title=\"\"><\/a><\/p>\n<h3 id=\"view-kernel-version-and-modules\">View Kernel Version and Modules<\/h3>\n<p>To check the kernel info of the system, osquery provides the tables &#8216;kernel_info&#8217; and the &#8216;kernel_modules&#8217;.<\/p>\n<p>Show the kernel used by the system.<\/p>\n<p class=\"command\">SELECT * FROM kernel_info;<\/p>\n<p>Show all loaded kernel modules on the system.<\/p>\n<p class=\"command\">SELECT * FROM kernel_modules LIMIT 5;<\/p>\n<p><a class=\"fancybox\" id=\"img-8\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/8.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-7.png\" alt=\"get details about the used Linux Kernel\" width=\"428\" height=\"550\" title=\"\"><\/a><\/p>\n<h3 id=\"checking-repository-and-packages\">Checking Repository and Packages<\/h3>\n<p>osquery provides tables for checking repositories and installed packages on both Linux Ubuntu and CentOS.<\/p>\n<p><strong>&#8211; On Ubuntu<\/strong><\/p>\n<p>On Ubuntu, we can check the available repositories through the &#8216;apt_sources&#8217; and check packages installed through the &#8216;deb_packages&#8217;.<\/p>\n<p>Check all available Ubuntu repositories.<\/p>\n<p class=\"command\">SELECT * FROM apt_sources;<br \/>SELECT name, base_uri, release, maintainer, components FROM apt_sources ORDER BY name;<\/p>\n<p>Check all packages installed using the deb_packages table.<\/p>\n<p class=\"command\">SELECT * FROM deb_packages;<\/p>\n<p>Show only the name of package and version.<\/p>\n<p class=\"command\">SELECT name, version FROM deb_packages ORDER BY name;<\/p>\n<p><a class=\"fancybox\" id=\"img-24\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/24.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-8.png\" alt=\"Check installed packages on Ubuntu\" width=\"500\" height=\"75\" title=\"\"><\/a><\/p>\n<p>For a specific package, add the name filter.<\/p>\n<p class=\"command\">SELECT name, version FROM deb_packages WHERE name=&#8221;nginx&#8221;;<\/p>\n<p><a class=\"fancybox\" id=\"img-11\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/11.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-9.png\" alt=\"get details about a specific package, in this case nginx\" width=\"500\" height=\"121\" title=\"\"><\/a><\/p>\n<p><strong>&#8211; On CentOS<\/strong><\/p>\n<p>On CentOS, we can check the available repository through the &#8216;yum_sources&#8217; and check packages installed through the &#8216;rpm_packages&#8217;.<\/p>\n<p>Check all available CentOS repositories.<\/p>\n<p class=\"command\">SELECT * FROM yum_sources;<br \/>SELECT name, baseurl, enabled FROM yum_sources;<\/p>\n<p>Check enabled repository by adding the &#8216;enabled&#8217; filter.<\/p>\n<p class=\"command\">SELECT name, baseurl, enabled FROM yum_sources WHERE enabled=1;<\/p>\n<p><a class=\"fancybox\" id=\"img-9\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/9.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-10.png\" alt=\"Get Package details on CentOS\" width=\"500\" height=\"185\" title=\"\"><\/a><\/p>\n<p>Check all packages installed using the rpm_packages table.<\/p>\n<p class=\"command\">SELECT * FROM rpm_packages;<br \/>SELECT name, version FROM rpm_packages ORDER BY name;<\/p>\n<p>For specific package name, add the name filter.<\/p>\n<p class=\"command\">SELECT name, version FROM rpm_packages WHERE name=&#8221;firewalld&#8221;;<\/p>\n<p><a class=\"fancybox\" id=\"img-10\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/10.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-11.png\" alt=\"Details about Firewalld\" width=\"500\" height=\"117\" title=\"\"><\/a><\/p>\n<h3 id=\"mount-disk-info\">Mount Disk Info<\/h3>\n<p>We can use the mounts table to check all details about the system drive, including free inodes, flags, type etc.<\/p>\n<p>Check all disks mounted by the system.<\/p>\n<p class=\"command\">SELECT * FROM mounts;<br \/>SELECT device, path, type, inodes_free, flags FROM mounts;<\/p>\n<p>For the specific type of device.<\/p>\n<p class=\"command\">SELECT device, path, type, inodes_free, flags FROM mounts WHERE type=&#8221;ext4&#8243;;<br \/>SELECT device, path, type, inodes_free, flags FROM mounts WHERE type=&#8221;tmpfs&#8221;;<\/p>\n<p><a class=\"fancybox\" id=\"img-12\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/12.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-12.png\" alt=\"Get disk mounts\" width=\"500\" height=\"437\" title=\"\"><\/a><\/p>\n<h3 id=\"memory-info\">Memory Info<\/h3>\n<p>Checking the system memory in bytes.<\/p>\n<p class=\"command\">SELECT * FROM memory_info;<\/p>\n<p><a class=\"fancybox\" id=\"img-13\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/13.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-13.png\" alt=\"Get memory details\" width=\"500\" height=\"225\" title=\"\"><\/a><\/p>\n<h3 id=\"network-interface-info\">Network Interface Info<\/h3>\n<p>Checking the network address using &#8216;interface_addresses&#8217;.<\/p>\n<p class=\"command\">SELECT * FROM interface_addresses;<\/p>\n<p><a class=\"fancybox\" id=\"img-14\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/14.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-14.png\" alt=\"Network Interface Info\" width=\"500\" height=\"523\" title=\"\"><\/a><\/p>\n<p>Checking the network interface details using &#8216;interface_details&#8217;.<\/p>\n<p class=\"command\">SELECT * FROM interface_details;<br \/>SELECT interface, mac, ipackets, opackets, ibytes, obytes FROM interface_details;<\/p>\n<p><a class=\"fancybox\" id=\"img-15\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/15.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-15.png\" alt=\"Network interface details\" width=\"410\" height=\"550\" title=\"\"><\/a><\/p>\n<h3 id=\"server-uptime\">Server Uptime<\/h3>\n<p>Checking the server uptime.<\/p>\n<p class=\"command\">SELECT * FROM uptime;<\/p>\n<p><a class=\"fancybox\" id=\"img-17\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/17.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-16.png\" alt=\"\" title=\"\"><\/a><\/p>\n<h3 id=\"checking-user\">Checking User<\/h3>\n<p>osqery provides detail tables for checking system users. We can use the &#8216;users&#8217; table to check all users on the system, using the &#8216;last&#8217; table to check users last login, and using the &#8216;logged_in_users&#8217; to get the logged in user with the active shell.<\/p>\n<p>To check all available users on the server, use the &#8216;users&#8217; table.<\/p>\n<p class=\"command\">SELECT * FROM users;<\/p>\n<p>For normal users, we can specify the uid to &#8216;&gt;=1000&#8217;.<\/p>\n<p class=\"command\">SELECT * FROM users WHERE uid&gt;=1000;<\/p>\n<p><a class=\"fancybox\" id=\"img-18\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/18.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-17.png\" alt=\"System user details\" width=\"382\" height=\"550\" title=\"\"><\/a><\/p>\n<p>To check the last login users, use the &#8216;last&#8217; table.<\/p>\n<p class=\"command\">SELECT * FROM last;<\/p>\n<p><a class=\"fancybox\" id=\"img-19\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/19.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-18.png\" alt=\"Last login\" width=\"500\" height=\"502\" title=\"\"><\/a><\/p>\n<p>For normal users, fill &#8216;type&#8217; to &#8216;7&#8217;.<\/p>\n<p class=\"command\">SELECT username, time, host FROM last WHERE type=7;<\/p>\n<p><a class=\"fancybox\" id=\"img-191\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/191.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-19.png\" alt=\"Get details about normal users only\" width=\"500\" height=\"502\" title=\"\"><\/a><\/p>\n<p>Checking the logged in user with active shell, use the &#8216;logged_in_users&#8217; tables.<\/p>\n<p class=\"command\">SELECT * FROM logged_in_users;<\/p>\n<h3 id=\"ip-tables-firewall-info\">IP Tables Firewall Info<\/h3>\n<p>With the &#8216;tables&#8217; table, we can check all available rules of the firewall, including the chain, policy, src\/dst IP and port etc.<\/p>\n<p>Show all iptables rules.<\/p>\n<p class=\"command\">SELECT * FROM iptables;<\/p>\n<p>Specify the rule using the custom query below.<\/p>\n<p class=\"command\">SELECT chain, policy, src_ip, dst_ip FROM iptables WHERE chain=&#8221;POSTROUTING&#8221; order by src_ip;<\/p>\n<p><a class=\"fancybox\" id=\"img-20\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/20.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-20.png\" alt=\"IP Tables Firewall Info\" width=\"500\" height=\"370\" title=\"\"><\/a><\/p>\n<h3 id=\"process-info\">Process Info<\/h3>\n<p>We can check all application process by using the &#8216;processes&#8217; table. It provides detailed info about the process including pid, name, path, command etc.<\/p>\n<p>Basic processes query for checking all running apps.<\/p>\n<p class=\"command\">SELECT * FROM processes;<\/p>\n<p>Specify columns for pid etc, path, and the command.<\/p>\n<p class=\"command\">SELECT pid, name, path, cmdline FROM processes;<\/p>\n<p><a class=\"fancybox\" id=\"img-21\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/21.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-21.png\" alt=\"Details about Linux processes\" width=\"500\" height=\"486\" title=\"\"><\/a><\/p>\n<h3 id=\"checking-cron-job\">Checking Cron Job<\/h3>\n<p>Check available cron job and time of script run using the &#8216;crontab&#8217; table.<\/p>\n<p class=\"command\">SELECT * FROM crontab;<\/p>\n<p class=\"comman\"><a class=\"fancybox\" id=\"img-22\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/22.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-22.png\" alt=\"Cronjobs\" width=\"500\" height=\"207\" title=\"\"><\/a><\/p>\n<h3 id=\"suid-binary-file\">SUID Binary File<\/h3>\n<p>SUID (Set owner User ID up on execution) is a special type of file permissions given to a file and mostly binary executable files.<\/p>\n<p>Check all available said binary file.<\/p>\n<p class=\"command\">SELECT * FROM suid_bin;<\/p>\n<p>Specify the username and group name.<\/p>\n<p class=\"command\">SELECT * FROM suid_bin WHERE username=&#8221;root&#8221; AND groupname=&#8221;nobody&#8221; order by path;<\/p>\n<p><a class=\"fancybox\" id=\"img-23\" href=\"https:\/\/www.howtoforge.com\/images\/how_to_monitor_linux_server_using_osquery\/big\/23.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-23.png\" alt=\"List od SUID files\" width=\"500\" height=\"166\" title=\"\"><\/a><\/p>\n<p>And all the above is the basic Linux system monitoring using osquery.<\/p>\n<h2 id=\"reference\">Reference<\/h2>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-monitor-your-linux-server-using-osquery%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-24.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-monitor-your-linux-server-using-osquery%2F&amp;text=How+to+Monitor+your+Linux+Server+using+osquery&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-25.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-26.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fhow-to-monitor-your-linux-server-using-osquery%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/08\/how-to-monitor-your-linux-server-using-osquery-27.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Osquery is an open source Operating System monitoring, query, and analytics software. Created by Facebook, it exposes an operating system as a high-performance relational database that can be queried using SQL-based queries. Osquery is a multi-platform software, can be installed on Linux, Windows, MacOS, and FreeBSD. Osquery allows us to explore\u00a0the operating system profile, performance, &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-6245","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=6245"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/6245\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=6245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=6245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=6245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}