none
letzter log eintrag lesen RRS feed

  • Frage

  • hallo zusammen ausgangslage. ich hab ein verzeichnis mit div. log files. jeder tag wird ein neues log file erstellt. logs: history-13-11-12.log history-14-11-12.log history-15-11-12.log etc. mich interessiert wie kann ich jeweils den letzten log eintrag in einer var speichern und lesen. vielen dank disco g
    Donnerstag, 15. November 2012 20:14

Antworten

Alle Antworten

  • benutzdochbittegroßundkleinschreibungsowiesatzzeichenwennduetwasschreibstkannmanndanndeutlichbesserlesen. ;) Lies auch bitte mal hier.

    Grüße, Denniver


    Blog: http://bytecookie.wordpress.com

    Hilf mit und markiere hilfreiche Beiträge als "Hilfreich" und Beiträge die deine Frage ganz oder teilweise beantwortet haben als "Antwort".


    Donnerstag, 15. November 2012 21:02
    Moderator
  • Hollo Denniver

    Sorry für die Darstellung. Habe das ganze mit dem Tab geschrieben.

    Gruss Disco G

    Freitag, 16. November 2012 10:33
  • Aber leider hast du immer noch nicht genauer ausgeführt was du nun genau auslesen möchtest.

    Das jeweils zuletzt beschriebene Logfile komplett? Aus dem jeweils zuletzt beschriebenen Logfile den aktuellsten Eintrag? Aus allen Logfiles den jeweils aktuellsten Eintrag? Woraus besteht der "aktuellste Eintrag"? Eine Zeile? Mehrere Zeilen? Wie sehen diese aus? Gibts noch andere wichtige Infos, die du vielleicht vorraussetzt, wir aber nicht wissen können?

    Deshalb nochmal: lies bitte diesen Post aufmerksam: Wie man am schnellsten die gewünschte Antwort erhält
    Der Post heißt übrigens so, weil du schon längst ne Antwort haben könntest. :)

    Grüße, Denniver


    Blog: http://bytecookie.wordpress.com

    Hilf mit und markiere hilfreiche Beiträge als "Hilfreich" und Beiträge die deine Frage ganz oder teilweise beantwortet haben als "Antwort".



    Freitag, 16. November 2012 10:50
    Moderator
  • Hallo Matthias

    Das sind mal nicht schlecht aus. Vielen dank

    Ich hab bei mir folgendes eingegeben:

    PS>$files = get-childitem -Path "C:\Program Files\marimba\Tuner\.marimba\MarimbaTuner" *.log
    PS>$files
    Resultat:
    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    -a---        01.10.2012     14:35    1824398 audit-y2012-m10-d01.log
    -a---        02.10.2012     14:05    1525120 audit-y2012-m10-d02.log
    -a---        03.10.2012     13:52    1342501 audit-y2012-m10-d03.log
    -a---        04.10.2012     15:11    1978334 audit-y2012-m10-d04.log
    -a---        05.10.2012     15:04    1456209 audit-y2012-m10-d05.log
    -a---        08.10.2012     14:46    1725954 audit-y2012-m10-d08.log
    -a---        09.10.2012     13:55    1526920 audit-y2012-m10-d09.log
    -a---        14.10.2012     19:41     354007 audit-y2012-m10-d14.log
    -a---        15.10.2012     18:42    2691107 audit-y2012-m10-d15.log
    -a---        16.10.2012     14:24    1884373 audit-y2012-m10-d16.log
    -a---        17.10.2012     14:05    1375146 audit-y2012-m10-d17.log
    -a---        18.10.2012     13:51    1097808 audit-y2012-m10-d18.log
    -a---        19.10.2012     14:48    2057873 audit-y2012-m10-d19.log
    -a---        20.10.2012     12:06     584799 audit-y2012-m10-d20.log
    -a---        22.10.2012     14:31    1713463 audit-y2012-m10-d22.log
    -a---        25.10.2012     15:37    1617427 audit-y2012-m10-d25.log
    -a---        26.10.2012     14:23    1730812 audit-y2012-m10-d26.log
    -a---        29.10.2012     14:52    2308631 audit-y2012-m10-d29.log
    -a---        30.10.2012     13:45    1444727 audit-y2012-m10-d30.log
    -a---        31.10.2012     23:54    2990591 audit-y2012-m10-d31.log
    -a---        01.11.2012     15:55    3941502 audit-y2012-m11-d01.log
    -a---        02.11.2012     14:36    1790840 audit-y2012-m11-d02.log
    -a---        05.11.2012     14:47    2070081 audit-y2012-m11-d05.log
    -a---        06.11.2012     13:47    1708550 audit-y2012-m11-d06.log
    -a---        07.11.2012     15:23    2531995 audit-y2012-m11-d07.log
    -a---        08.11.2012     17:01    2129119 audit-y2012-m11-d08.log
    -a---        09.11.2012     16:20    1399755 audit-y2012-m11-d09.log
    -a---        12.11.2012     14:58    1892432 audit-y2012-m11-d12.log
    -a---        13.11.2012     14:37    2233848 audit-y2012-m11-d13.log
    -a---        15.11.2012     07:31    1494137 audit-y2012-m11-d14.log
    -a---        15.11.2012     15:55    3235903 audit-y2012-m11-d15.log
    -a---        16.11.2012     11:28    1080083 audit-y2012-m11-d16.log
    -a---        01.10.2012     14:35    1700827 history-y2012-m10-d01.log
    -a---        02.10.2012     14:05    1430083 history-y2012-m10-d02.log
    -a---        03.10.2012     13:52    1217801 history-y2012-m10-d03.log
    -a---        04.10.2012     15:11    1779222 history-y2012-m10-d04.log
    -a---        05.10.2012     15:04    1310887 history-y2012-m10-d05.log
    -a---        08.10.2012     14:46    1584688 history-y2012-m10-d08.log
    -a---        09.10.2012     13:55    1388673 history-y2012-m10-d09.log
    -a---        14.10.2012     19:41     379936 history-y2012-m10-d14.log
    -a---        15.10.2012     18:42    2120495 history-y2012-m10-d15.log
    -a---        16.10.2012     14:24    1807012 history-y2012-m10-d16.log
    -a---        17.10.2012     14:05    1302968 history-y2012-m10-d17.log
    -a---        18.10.2012     13:51    1063902 history-y2012-m10-d18.log
    -a---        19.10.2012     14:48    1956268 history-y2012-m10-d19.log
    -a---        20.10.2012     12:06     607846 history-y2012-m10-d20.log
    -a---        22.10.2012     14:31    1638989 history-y2012-m10-d22.log
    -a---        25.10.2012     15:37    1564990 history-y2012-m10-d25.log
    -a---        26.10.2012     14:23    1666721 history-y2012-m10-d26.log
    -a---        29.10.2012     14:52    2210775 history-y2012-m10-d29.log
    -a---        30.10.2012     13:45    1382915 history-y2012-m10-d30.log
    -a---        31.10.2012     23:54    2799740 history-y2012-m10-d31.log
    -a---        01.11.2012     15:55    3686676 history-y2012-m11-d01.log
    -a---        02.11.2012     14:36    1690191 history-y2012-m11-d02.log
    -a---        05.11.2012     14:47    1952631 history-y2012-m11-d05.log
    -a---        06.11.2012     13:47    1613585 history-y2012-m11-d06.log
    -a---        07.11.2012     15:23    2278394 history-y2012-m11-d07.log
    -a---        08.11.2012     17:01    2011369 history-y2012-m11-d08.log
    -a---        09.11.2012     16:20    1297228 history-y2012-m11-d09.log
    -a---        12.11.2012     14:58    1825523 history-y2012-m11-d12.log
    -a---        13.11.2012     14:37    2087426 history-y2012-m11-d13.log
    -a---        15.11.2012     07:33    1168198 history-y2012-m11-d14.log
    -a---        15.11.2012     15:55    2886979 history-y2012-m11-d15.log
    -a---        16.11.2012     11:28     977224 history-y2012-m11-d16.log
    -a---        09.11.2012     13:31     259427 launch-1.log
    -a---        16.11.2012     11:28     197991 launch.log
    -a---        16.11.2012     11:28     231266 stdout.log

    was mich aber interessier ist jeweils den letzten history eintrag "history-2012-m11-d11.log" und nicht die audit logs und die launch,stdout logs.

    Gruss Disco G

    Freitag, 16. November 2012 11:57

  • $recentlogname = get-childitem | Where { $_.name -like "*history-2012-m11*" } | sort LastWriteTime -descending | select -First 1 -Expand Name
    $recentlogname



    Blog: http://bytecookie.wordpress.com

    Hilf mit und markiere hilfreiche Beiträge als "Hilfreich" und Beiträge die deine Frage ganz oder teilweise beantwortet haben als "Antwort".



    Freitag, 16. November 2012 12:15
    Moderator
  • Das wars. Vielen dank

    Jetzt muss ich das ganze noch Remote ausführen und das log File öffnen zum Lesen.

    Gruss

    Disco G

    Freitag, 16. November 2012 12:23