{"id":9508,"date":"2023-09-30T09:00:18","date_gmt":"2023-09-30T07:00:18","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=9508"},"modified":"2023-09-30T09:02:36","modified_gmt":"2023-09-30T07:02:36","slug":"logstation-die-logs-unter-linux-im-blick","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/30\/logstation-die-logs-unter-linux-im-blick\/","title":{"rendered":"Logstation &#8211; die Logs unter Linux im Blick"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Wer sich mit seinem Betriebssystem befasst, wirft auch gerne einen Blick in die Log-Dateien. Gerade unter Linux sind diese Logs \u00fcberall verteilt, beinahe jede Software kann solche Log-Dateien erstellen. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit der Software Logstation haben Sie auch mehrere solcher Logdateien im Blick.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Logstation installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sie finden diese Software auf <a href=\"https:\/\/github.com\/jdrews\/logstation\/releases\">GitHub<\/a> zum Download. Sie entpacken das komprimierte Archiv und machen die darin liegende Datei ausf\u00fchrbar &#8211; entweder per Kontextmen\u00fc &#8222;<em>Eigenschaften \u2192 Berechtigungen<\/em>&#8220; oder auf dem Terminal mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x logstation<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend verschieben Sie die Datei als root auf dem Terminal etwa nach <em>\/usr\/bin<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv logstation \/usr\/bin<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Logstation nutzen<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Die Software wird auf dem Terminal genutzt und mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logstation -c config.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">aufgerufen. Mit <code>-c<\/code> geben Sie die selbst erstellte Konfigurationsdatei an, mit dieser geben Sie an, welche Logdateien die Software anzeigen soll. Eine Beispiel-Konfiguration findet sich auf <a href=\"https:\/\/github.com\/jdrews\/logstation\/blob\/main\/logstation.default.conf\">GitHub<\/a> und hier:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\n# _                     _            _     _\n#| |  ___   __ _   ___ | |_   __ _  | |_  (_)  ___   _ _\n#| | \/ _ \\ \/ _` | (_-&lt; |  _| \/ _` | |  _| | | \/ _ \\ | ' \\\n#|_| \\___\/ \\__, | \/__\/  \\__| \\__,_|  \\__| |_| \\___\/ |_||_|\n#           |___\/\n#\n# logstaion config file\n# https:\/\/github.com\/jdrews\/logstation\n\n# List of log files to tail\n#   The list can be single log files or a wildcard glob to pick up\n#   all files in a directory or rotating log files\n# Windows example of setting up logs\nlogs = &#91;\n    'e:\\git\\logstation\\test\\logfile.log',\n    'e:\\git\\logstation\\test\\with space\\logfile.log',\n    'e:\\git\\logstation\\test\\*.log'\n]\n# Unix example of setting up logs\n#logs = &#91;\n#   '\/home\/jdrews\/git\/logstation\/logfile.log',\n#   '\/home\/jdrews\/git\/logstation\/*.log'\n#]\n\n# Unique name for logstation instance\n#   This name will be prepended to the browser tab\n#   Can be useful when connecting to multiple logstations\nlogStationName = \"logstation\"\n\n# Setup your syntax highlighting below\n#   matching gives priority to the top most\n#   if the regular experssion passes, the entire log line will be colored\n#\n#   \"color\" can be any of of the following\n#       red, green, yellow, blue, magenta, cyan\n#       hired, higreen, hiyellow, hiblue, himagenta, hicyan\n#       NOTE: these are ANSI colors.\n#       The \"hi\" colors above are recommended as they show up much better on black backgrounds\n#\n#   \"regex\" is a regular expression matched against a log line\n#       syntax in particular follows https:\/\/github.com\/google\/re2\/wiki\/Syntax\nsyntaxColors = &#91;\n    { color=\"hired\", regex=\".*ERROR.*\" }, # red\n    { color=\"hiyellow\", regex=\".*WARN.*\" }, # yellow\n    { color=\"higreen\", regex=\".*INFO.*\" }, # green\n    { color=\"hiblue\", regex=\".*DEBUG.*\" }, # blue\n    { color=\"hicyan\", regex=\".*TRACE.*\" }, # cyan\n]\n\n# Select the method for tailing log files\n#   - \"filesystem\": listens for filesystem notifications that the log file has changed, then reads the file\n#   - \"polling\": polls the log file for updates at a regular cadence.\n#           Polling may use more CPU usage, depending on the polling rate\n#\n#   Defaults to \"filesystem\"\n#   If you find that you're not picking up log lines, try out \"polling\"\ntailingMethod = \"filesystem\"\n\n# Specity the polling time in milliseconds to check for log file updates\n#   Only applies when tailingMethod is set to \"polling\"\npollingTimeMS = 500\n\n&#91;server_settings]\nwebServerPort = 8884 # Webserver port to listen on\nwebServerAddress = \"0.0.0.0\" # Webserver address to listen on\n\n# Disable CORS checking on the server\n#   This is a security vulnerability if you disable CORS. Please be careful!\n#   Read more here: https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/CORS\ndisableCORS = false<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die wichtigste Konfiguration ist nat\u00fcrlich die Eingabe der Log-Dateien &#8211; diese geben Sie nach der Zeile:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logs = &#91;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">an. In meinem Beispiel ersetze ich:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logs = &#91;     'e:\\git\\logstation\\test\\logfile.log',     'e:\\git\\logstation\\test\\with space\\logfile.log',     'e:\\git\\logstation\\test\\*.log' \n]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">durch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logs = &#91;\n'e:\/var\/log\/apt\/history.log',\n'e:\/var\/log\/popularity-contest'\n]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Konfigurationsdatei speichere ich in meinem Home-Verzeichnis und nenne diese &#8222;<strong>.logstation.conf<\/strong>&#8222;. Jetzt l\u00e4sst sich die Software aufrufen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logstation -c \/home\/robert\/.logstation.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Die Software startet einen Webserver, diesen erreichen Sie im Webbrowser unter der Adresse <em>localhost:8884<\/em> und liefert nach und nach die Ausgaben der entsprechenden Logs. Laden Sie die Seite neu, verschwinden bereits geladene Logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit der Option <code>webServerPort Port<\/code> k\u00f6nnen Sie den Port \u00e4ndern, eine Zugangskontrolle bietet die Software nicht, darum sollten Sie die Software ausschlie\u00dflich  in Ihrem lokalen Netzwerk nutzen.<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"9508\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"9508\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Wer sich mit seinem Betriebssystem befasst, wirft auch gerne einen Blick in die Log-Dateien. Gerade unter Linux sind diese Logs \u00fcberall verteilt, beinahe jede Software kann solche Log-Dateien erstellen. Mit der Software Logstation haben Sie auch mehrere solcher Logdateien im Blick. Logstation installieren Sie finden diese Software auf GitHub zum Download. Sie entpacken das komprimierte [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":61,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[12,7,6],"class_list":["post-9508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-terminal","tag-kommandozeile","tag-shell","tag-terminal"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/9508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=9508"}],"version-history":[{"count":2,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/9508\/revisions"}],"predecessor-version":[{"id":9510,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/9508\/revisions\/9510"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/61"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=9508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=9508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=9508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}