{"id":390,"date":"2022-03-23T22:34:08","date_gmt":"2022-03-23T21:34:08","guid":{"rendered":"https:\/\/camilomatajira.wordpress.com\/?p=390"},"modified":"2025-09-29T18:40:35","modified_gmt":"2025-09-29T18:40:35","slug":"sysadmindb","status":"publish","type":"post","link":"https:\/\/camilo.matajira.com\/?p=390","title":{"rendered":"SysadminDB"},"content":{"rendered":"\n<p>This is a proof of concept of SysadminDB: a database for System Administrators Available here: https:\/\/gitlab.com\/matajira\/sysadmindb.<br>The Unique Value Proposition is that SysadminDB stores logs and can be queried using unix\/linux powertools such as grep, sed and awk.<\/p>\n\n\n\n<p>In this sense, the user does not need to learn PromQL (used by Prometheus or Loki), neither has to learn Lucene (ElasticSearch), nor any other DSL. The user, mainly a System Administrator, will be able to query logs, and produce metrics and kpis using his well known command line tools.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Demo -&gt; Querying the DB<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Dependencies<\/h3>\n\n\n\n<p>python3-django<br>python3-whitenoise<br>python3-waitress<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Version with no dependencies<\/h3>\n\n\n\n<p>See the pure_python_no_dependencies branch<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setting up the web server and the tcp server<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>cd src &amp;&amp; python3 main.py<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #8BE9FD\">cd<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">src<\/span><span style=\"color: #F8F8F2\"> &amp;&amp; <\/span><span style=\"color: #50FA7B\">python3<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">main.py<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Querying the db through the web server<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>Visit the site at localhost:8080<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">Visit<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">the<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">site<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">at<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">localhost:8080<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Demo -&gt; Sending logs<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>cd src &amp;&amp; python3 main.py\nlogger &#8211;server 127.0.0.1 &#8211;port 1999 -T &#8220;hello world&#8221;  <\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #8BE9FD\">cd<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">src<\/span><span style=\"color: #F8F8F2\"> &amp;&amp; <\/span><span style=\"color: #50FA7B\">python3<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">main.py<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">logger<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">--server<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">127.0<\/span><span style=\"color: #F1FA8C\">.0.1<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">--port<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">1999<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #BD93F9\">-T<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">hello world<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">  <\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>It is also possible to forward rsyslog to sysadmindb:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>sudo su\necho &#8220;*.* action(type=\\&#8221;omfwd\\&#8221; target=\\&#8221;127.0.0.1\\&#8221; port=\\&#8221;1999\\&#8221; protocol=\\&#8221;tcp\\&#8221;)&#8221; >> \/etc\/rsyslog.conf\nsystemctl restart rsyslog<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">sudo<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">su<\/span><\/span>\n<span class=\"line\"><span style=\"color: #8BE9FD\">echo<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">*.* action(type=<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\">omfwd<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\"> target=<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\">127.0.0.1<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\"> port=<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\">1999<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\"> protocol=<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\">tcp<\/span><span style=\"color: #FF79C6\">\\&quot;<\/span><span style=\"color: #F1FA8C\">)<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #FF79C6\">&gt;&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">\/etc\/rsyslog.conf<\/span><\/span>\n<span class=\"line\"><span style=\"color: #50FA7B\">systemctl<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">restart<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F1FA8C\">rsyslog<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Check the first terminal to see logs arrive and be stored.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Core of the project<\/h1>\n\n\n\n<p>The two most important technical aspects of the code are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Being able to send stdout to a subprocess.<\/li>\n\n\n\n<li>Allowing the user to send safely any type of bash command.<\/li>\n<\/ol>\n\n\n\n<p>For both, the code that permits me to do it is the following:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>      # Restrict PATH to a directory with only the binaries that I allow the user to execute\n      my_env[&#8220;PATH&#8221;] = str(pathlib.Path(os.path.realpath(__file__)).parent) + &#8220;\/restricted_bin&#8221;\n      # Run a restricted shell, norc and no profile to augment security\n      p = Popen([&#8220;\/bin\/bash&#8221;, &#8220;&#8211;norc&#8221;, &#8220;&#8211;noprofile&#8221;, &#8220;&#8211;restricted&#8221;, &#8220;-c&#8221;, users_command], stdout=PIPE, stdin=PIPE, stderr=PIPE, shell=False, env=my_env)\n      # Insert the logs to the stdout of the subprocess\n      process_result = p.communicate(input=logs.encode())<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">      <\/span><span style=\"color: #6272A4\"># Restrict PATH to a directory with only the binaries that I allow the user to execute<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">      my_env[<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">PATH<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">] <\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #8BE9FD; font-style: italic\">str<\/span><span style=\"color: #F8F8F2\">(pathlib.Path(os.path.realpath(<\/span><span style=\"color: #BD93F9\">__file__<\/span><span style=\"color: #F8F8F2\">)).parent) <\/span><span style=\"color: #FF79C6\">+<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">\/restricted_bin<\/span><span style=\"color: #E9F284\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">      <\/span><span style=\"color: #6272A4\"># Run a restricted shell, norc and no profile to augment security<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">      p <\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\"> Popen([<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">\/bin\/bash<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">--norc<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">--noprofile<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">--restricted<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F1FA8C\">-c<\/span><span style=\"color: #E9F284\">&quot;<\/span><span style=\"color: #F8F8F2\">, users_command], <\/span><span style=\"color: #FFB86C; font-style: italic\">stdout<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #BD93F9\">PIPE<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FFB86C; font-style: italic\">stdin<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #BD93F9\">PIPE<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FFB86C; font-style: italic\">stderr<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #BD93F9\">PIPE<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FFB86C; font-style: italic\">shell<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #BD93F9\">False<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FFB86C; font-style: italic\">env<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\">my_env)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">      <\/span><span style=\"color: #6272A4\"># Insert the logs to the stdout of the subprocess<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">      process_result <\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\"> p.communicate(<\/span><span style=\"color: #FFB86C; font-style: italic\">input<\/span><span style=\"color: #FF79C6\">=<\/span><span style=\"color: #F8F8F2\">logs.encode())<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is a proof of concept of SysadminDB: a database for System Administrators Available here: https:\/\/gitlab.com\/matajira\/sysadmindb.The Unique Value Proposition is that SysadminDB stores logs and can be queried using unix\/linux powertools such as grep, sed and awk. In this sense, the user does not need to learn PromQL (used by Prometheus or Loki), neither has&#8230;<\/p>\n","protected":false},"author":2,"featured_media":398,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects"],"_links":{"self":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390"}],"version-history":[{"count":1,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions\/573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=\/wp\/v2\/media\/398"}],"wp:attachment":[{"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/camilo.matajira.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}