118057
Goto Top

Ich habe die folgende aufgabe zu lösen und brauche hilfe.

Logging Aggregator and Reporting:
Imagine a fitness studio chain that operates different studios in Munich. Every studio has been given a Windows server that operates the entry of studio clients via a key-card (NFC) and it also operates the cashier at the bar where beverages are and snacks are sold.

The management of the chain wants to get a better overview of the daily activity in all of their studios (4 at the moment and a 5<sup>th</sup> one being prepared for the grand opening). Therefore you have been given the task to retrieve the log files from each of the servers copy them to a central aggregation server, read those files, merge them if necessary and send an email with a report once a day to the management.


Servers The following servers are in operation at the moment
\\Server1
\\Server2
\\Server3
\\Server4

Every of these servers has a user names “Aggregator” which has the password “gimme_data” and which has the rights to read the log files.

Services Each server runs 2 services
Check-In – writes a log-entry for each “check-in” of a client
Cashier – writes a log-entry for each sale at the bar
Log Files

Each services creates a rolling file for the actual hour and writes all the log entries during this hour into this file. At the beginning of a new hour a new file is created and then used for writing the log entries into it. So for every day you will have a maximum of 24 log files per service (a total of max 48 log files for 2 services)
The log files for the checkin can be found at this relative path c:\logs\sevices\check-in\<reverse-date>\<hour[always 2 digits]>.txt Example: for the studio at Server1 you will find the file for the cashier for the period of September 10<sup>th</sup> 2014 from 15:00 to 15:59:59 at \\Server1\C\logs\services\cashier\2014-09-10\15.txt
Logging Entries The logging entries have the following format

Check-in => <timestamp>,<user-id-read-from-key-card><CR> Example: 14:34:51, 2932 14:39:22, 1922 15:12:09, 0976
Cashier => <time-stamp>, <user-id>, <beverage|snack>, <amount><CR> Example: 16:34:51, 2235, beverage, 13.12 17:23:22, 0127, snack, 7.23 17:48:09, 0976, beverage, 17.91

Line endings are denoted by <CR Carriage Return>. Fields are split by commas

Aggregation Server The aggregation servers has the following tasks
Copy each file from each of the servers to the aggregation server itself.
The path to copy the files is the same as on the original servers => path c:\logs\sevices\check-in\<reverse-date>\<hour[always 2 digits]>.txt
Rename the file(s) so that every file has the name of the server origin in it. Example: path c:\logs\sevices\check-in\2014-09-10\17-Server1.txt
Create a file that merges all files from all servers into on for each day. Name that file total.txt. Do this for the check-in and cashier service Example: c:\logs\sevices\check-in\2014-09-10\17-Leopold.txt 17:34:51, 2932 17:39:22, 1922 c:\logs\sevices\check-in\2014-09-10\19-Leopold.txt 19:22:51, 4132 19:31:22, 9122 c:\logs\sevices\check-in\2014-09-10\15-Server4.txt 15:51:51, 2222 15:99:22, 1222 c:\logs\sevices\check-in\2014-09-10\19-Server4.txt 19:12:51, 7332 19:19:22, 3522 Should result in a file name c:\logs\sevices\check-in\2014-09-10\total.txt that contains the following data 17:34:51, 2932 17:39:22, 1922 19:22:51, 4132 19:31:22, 9122 15:51:51, 2222 15:99:22, 1222 19:12:51, 7332 19:19:22, 3522
Report

Send an email to admin@hotmail.com and attach both “total” files for the check-in service and the cashier-service.

Use Powershell to write the script

Content-Key: 250276

Url: https://administrator.de/contentid/250276

Printed on: April 18, 2024 at 20:04 o'clock

Member: Lochkartenstanzer
Solution Lochkartenstanzer Sep 26, 2014, updated at Oct 01, 2014 at 18:54:33 (UTC)
Goto Top
Moin,

Hausaufgabe oder Kundenanforderung?

lks

PS. Was woran hapert es denn?

Nachtrag: Crossposts mögen wir nicht. Außerdem wurde Dir dort doch schon ein Tipp gegeben.
Mitglied: 118057
118057 Sep 26, 2014 at 21:12:04 (UTC)
Goto Top
moin moin,
Ich lerne gerade PowerShell und habe diese Hausaufgabe face-smile Parallel zur einarbeitung habe ich die Frage hier veröffentlicht.
Zuerst würde es mir helfen ein Paar Ideen für die Vorgehensweise zu haben.
olly
Member: Lochkartenstanzer
Solution Lochkartenstanzer Sep 27, 2014, updated at Oct 01, 2014 at 18:52:59 (UTC)
Goto Top
Zitat von @118057:

Zuerst würde es mir helfen ein Paar Ideen für die Vorgehensweise zu haben.

Dann solltest Du die Aufgabe/Frage am besten erstmal in Deutsch formulieren/ergänzen, damit diejenigen, die nicht ganz so fit in Englisch sind, Dir ggf. auch helfen können. Außerdem hilft es beim Verständnis der Frage. Auch wenn das hier ein admin-Forum ist, sind doch einige hier, die hier eher russisch, chinesisch oder altgriechisch als englisch können.

さようなら

lks
Member: Lochkartenstanzer
Solution Lochkartenstanzer Sep 27, 2014, updated at Oct 01, 2014 at 18:53:22 (UTC)
Goto Top
Moin,

Die Aufgabe ist doch eigentlich recht genau beschrieben:

  • kopiere die dateien vom entfernten Serevr auf den lokalen server (z.B. xcopy oder robocopy)
  • benenne die daten um (for-schrleife)
  • aggregiere die Dateien in eine (unter unix wäre das einfach ein cat dateien*.txt >toptal.txt face-smile)
  • mail verschicken. Mit diesen totals als Anhang.

lks

PS. Ahmad freut sich sicher über mehr SPAM. face-smile
Member: colinardo
Solution colinardo Sep 27, 2014, updated at Oct 01, 2014 at 18:52:41 (UTC)
Goto Top
Hallo olly72,
ich könnte dir jetzt hier ein fertiges Script posten (Powershell 1-Zeiler würde hier genügen face-wink), das hätte aber, da es ja eine Hausaufgabe ist, keinen Lerneffekt für dich. Deswegen schreibe ich dir mal als Einstieg für den Anfang, nur die für diese Aufgabe zu verwendenden Powershell-CMDLets auf:

Dateien auswählen: get-childitem
Aktion für eine Anzahl an Objekten ausführen ForEach-Object
Dateien kopieren: copy-item
Das aktuelle Datum formatieren: get-date -Format "yyyy-MM-dd"
Text einer Datei auslesen: get-content
Einer Textdatei weiteren Text anhängen: add-content
E-Mail verschicken: send-mailmessage

Viel Erfolg
Grüße Uwe
Member: bastla
Solution bastla Sep 28, 2014, updated at Oct 01, 2014 at 18:54:58 (UTC)
Goto Top
Hallo LKS!
aggregiere die Dateien in eine
type dateien*.txt>toptal.txt
Grüße
bastla
Member: Lochkartenstanzer
Solution Lochkartenstanzer Sep 28, 2014, updated at Oct 01, 2014 at 18:54:57 (UTC)
Goto Top
Zitat von @bastla:

Hallo LKS!
> aggregiere die Dateien in eine
type dateien*.txt>toptal.txt
> 


Das habe ich mit Absicht nicht verraten. face-smile
Member: bastla
Solution bastla Sep 29, 2014, updated at Oct 01, 2014 at 18:55:00 (UTC)
Goto Top
@lks

Sorry, wenn ich Deine edukativen Bemühungen unterlaufen habe ... face-wink

Grüße
bastla
Member: colinardo
Solution colinardo Oct 01, 2014 updated at 18:55:01 (UTC)
Goto Top
Der TO ist mit genügend Stoff versorgt face-wink
Wenns das dann war, den Beitrag bitte noch auf gelöst setzen, bevor er vermodert. Merci.