FrPSUG / LogManagement

PowerShell module to manage logs
8 stars 5 forks source link

Add a log Header #8

Open christophekumor opened 5 years ago

christophekumor commented 5 years ago

Param to add a header to the log file.

we'll have to define what we want in this header.

lazywinadmin commented 5 years ago

in most case i see people use this to log the environment/context Version of powershell, path of script, current user, etc...

I would keep the header and footer parsable. example

<datetime> <delimiter> <messagetype> <delimiter> <source><delimiter><message> example:

2019/06/25.08:34:00UTC;INF;HEADER;Using PowerShell version: 6.2
2019/06/25.08:34:01UTC;INF;HEADER;current user: mydomain\lazywinadmin
2019/06/25.08:34:01UTC;INF;MAIN; define var....
2019/06/25.08:34:01UTC;INF;MAIN; connect to db
2019/06/25.08:34:01UTC;INF;MAIN; perform task
2019/06/25.08:34:01UTC;INF;MAIN; done
2019/06/25.08:34:01UTC;INF;FOOTER; script completed in 1sec
LaurentLienhard commented 5 years ago

ok for a header but as proposed @lazywinadmin with the same format as the log itself. I hate having a log with header, log then footer :-) like that

i don't like Header Using PowerShell version: 6.2 current user: mydomain\lazywinadminc

2019/06/25.08:34:01UTC;INF;MAIN; define var.... 2019/06/25.08:34:01UTC;INF;MAIN; connect to db 2019/06/25.08:34:01UTC;INF;MAIN; perform task 2019/06/25.08:34:01UTC;INF;MAIN; done

Footer script completed in 1sec

omiossec commented 5 years ago

The main problem here is that we create a fixed format. We should have a dynamic format or at least a format we can extend to use other log containers like Json, Win Event ...

LaurentLienhard commented 5 years ago

as i said i don't like header and footer on log file so for me is not useful ;-)