Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEQ: structured logging not implemented #98

Open
gahujipo opened this issue May 29, 2020 · 4 comments
Open

SEQ: structured logging not implemented #98

gahujipo opened this issue May 29, 2020 · 4 comments

Comments

@gahujipo
Copy link
Contributor

I'd really like to use SEQ as logging target. It fails for every Write-Log command, because there is a problem in serializing the JSON, which I already fixed here: acsdatasystems@c0980fa but haven't merged yet.

With these changes, logs are coming to the SEQ server. But it seems, that there isn't implemented any structured logging. How can I get the original log message?
E.g.

Write-Log -Message "Hello {0}!" -Arguments "PowerShell"

in that case I would need Hello {0}! instead of Hello PowerShell!. I would need that, because I have to send a JSON to the server where the message cannot contain the value, but only a key and the value for that key somewhere else.

{
    "Events": [
        {
            "MessageTemplate": "Hello {Who}!",
            "Timestamp": "2020-05-29T16:46:09.3034428+02:00",
            "Level": null,
            "Properties": {
                "Who": "World"
            }
        }
    ]
}

The passed $Log variable doesn't seem to contain such a message template. Is there another way to get the original template?

@EsOsO
Copy link
Collaborator

EsOsO commented Jun 1, 2020

Right now we cannot implement strucuterd logging (although I'd like it) cause the form Write-Log -Message 'Hello, {0}!' -Arguments 'Powershell' uses powershell string formatting and doesn't work on named parameters (the {Who}).

We need to write our custom string formatting to propagate the raw string down to the logging target.

@tosoikea
Copy link
Collaborator

tosoikea commented Mar 4, 2021

@EsOsO How is the current status, I could add the feature next week.

@EsOsO
Copy link
Collaborator

EsOsO commented Mar 15, 2021

Please go on, I didn't write anything yet.

@gahujipo
Copy link
Contributor Author

Hey @tosoikea,
have you been able to implement this?

SilentBob999 added a commit to SilentBob999/Logging that referenced this issue May 12, 2022
commit 05549cd
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Wed Mar 23 14:19:36 2022 +0000

    Updated docs [skip ci]

commit 03d2f0c
Author: awesomecogs <44172583+awesomecogs@users.noreply.github.com>
Date:   Wed Mar 23 08:57:47 2022 -0500

    Update CONTRIBUTING.md (RootITUp#122)

    Small grammar correction.

    Co-authored-by: Massimo Bonvicini <EsOsO@users.noreply.github.com>

commit a3cf4d8
Author: awesomecogs <44172583+awesomecogs@users.noreply.github.com>
Date:   Wed Mar 23 08:57:04 2022 -0500

    Update index.md (RootITUp#121)

    Minor spelling, grammar, and formatting changes.

commit 7f93b73
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Wed Oct 6 08:59:31 2021 +0000

    Updated docs [skip ci]

commit 5cbe86b
Author: gahujipo <26710574+gahujipo@users.noreply.github.com>
Date:   Wed Oct 6 10:56:07 2021 +0200

    SEQ: fix event type and implement properties (RootITUp#119)

    * SEQ: fix event level

    * SEQ: implement Properties

commit cfd09d6
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Mon Mar 15 10:31:12 2021 +0000

    Updated docs [skip ci]

commit e30b975
Merge: 18e35cf d41df85
Author: Massimo Bonvicini <EsOsO@users.noreply.github.com>
Date:   Mon Mar 15 10:29:14 2021 +0000

    Merge pull request RootITUp#116 from tosoikea/rotation

    Added rotation to file target

commit d41df85
Author: Soennecken, Torben <Torben.Soennecken@adesso.de>
Date:   Mon Mar 8 10:03:11 2021 +0100

    [~] Using internal Sort-Object for sorting
    [-] Remove debug prints

commit e196559
Merge: b92d24d 18e35cf
Author: Soennecken, Torben <Torben.Soennecken@adesso.de>
Date:   Mon Mar 8 09:46:43 2021 +0100

    Merge remote-tracking branch 'upstream/master' into rotation

commit 18e35cf
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 18 08:43:16 2021 +0000

    Updated docs [skip ci]

commit 2eb6136
Merge: fe4b47c 7aa1b7c
Author: Massimo Bonvicini <EsOsO@users.noreply.github.com>
Date:   Thu Feb 18 09:41:33 2021 +0100

    Merge pull request RootITUp#115 from tosoikea/master

    Added initialization to file target

commit b92d24d
Author: Soennecken, Torben <Torben.Soennecken@adesso.de>
Date:   Mon Feb 15 16:34:17 2021 +0100

    [~] Updated Usage.md to include rotation of files

commit 22e3fb2
Author: Soennecken, Torben <Torben.Soennecken@adesso.de>
Date:   Mon Feb 15 16:21:12 2021 +0100

    [+] Added rotation to file target

commit 7aa1b7c
Author: Soennecken, Torben <Torben.Soennecken@adesso.de>
Date:   Mon Feb 15 13:36:25 2021 +0100

    [+] Added target initialization for File. It tries to initially create the directory for the log target.
    This should be useful for e.g. nested log directories C:\log\module\monday\...

commit fe4b47c
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 14:30:20 2021 +0000

    Updated docs [skip ci]

commit 2f27bb8
Merge: c8f23b3 b0e054b
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 15:27:51 2021 +0100

    Merge branch 'dev' into master

commit b0e054b
Merge: d000628 5328b08
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 15:07:54 2021 +0100

    Merge branch '93-target-exception' into dev

commit 5328b08
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 15:07:45 2021 +0100

    removed unused file

commit d000628
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 15:06:46 2021 +0100

    excluded debug file

commit 10aae4a
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 15:06:27 2021 +0100

    removed unused file

commit 93f333f
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 14:57:09 2021 +0100

    removed unused file

commit 68a2e8e
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 14:55:40 2021 +0100

    working toward structured logging RootITUp#98

commit 08c5ce3
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 14:54:15 2021 +0100

    seq prints excpetions RootITUp#93
    works with seq version 2021.1

commit d459044
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 13:54:03 2021 +0100

    email target prints exception RootITUp#93

commit 0fb08f6
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 13:46:27 2021 +0100

    console target now prints exceptions RootITUp#93

commit 9282b90
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 13:40:21 2021 +0100

    file target prints exceptions

commit c8f23b3
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 09:41:27 2021 +0000

    Updated docs [skip ci]

commit 5446cb2
Merge: 914c22f 6f2f1de
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 10:36:23 2021 +0100

    Merge branch '112-read-only-log-in-target' into dev

commit 914c22f
Merge: 74fadef 47e48f1
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 10:36:15 2021 +0100

    Merge branch 'master' into dev

    # Conflicts:
    #	docs/CHANGELOG.md

commit 6f2f1de
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Feb 11 10:33:38 2021 +0100

    Targets now work on a copy of log object

commit 47e48f1
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 13:13:33 2020 +0000

    Updated docs [skip ci]

commit d771d10
Author: Massimo Bonvicini <EsOsO@users.noreply.github.com>
Date:   Thu Oct 22 13:10:12 2020 +0000

    Dev (RootITUp#109)

    * Updated Team target  (RootITUp#108)

    * Updated docs [skip ci]

    * refactor Teams target
    + support additional body types for adaptive card

    * syntax cleanup to better follow PnP

    Co-authored-by: EsOsO <massimo.bonvicini@gmail.com>
    Co-authored-by: Jenkins, Michael <mjenkins@msnpath.com>

    * ignore function name clashing

    * unified timestamp format

    * keeping raw timestamp
    the target is in charge of formatting it using his format

    * removed blank lines

    * compiled release +semver:minor

    Co-authored-by: Michael Jenkins <jangins101@users.noreply.github.com>
    Co-authored-by: Jenkins, Michael <mjenkins@msnpath.com>

commit 74fadef
Merge: 5adf465 9170045
Author: Massimo Bonvicini <EsOsO@users.noreply.github.com>
Date:   Thu Oct 22 13:09:26 2020 +0000

    Merge branch 'master' into dev

commit 5adf465
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 14:56:55 2020 +0200

    compiled release +semver:minor

commit dea2bfe
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 14:51:21 2020 +0200

    removed blank lines

commit 1eed271
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 14:49:56 2020 +0200

    keeping raw timestamp
    the target is in charge of formatting it using his format

commit 65ba713
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 14:48:45 2020 +0200

    unified timestamp format

commit 90b1c6e
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Thu Oct 22 14:43:15 2020 +0200

    ignore function name clashing

commit 04ad875
Author: Michael Jenkins <jangins101@users.noreply.github.com>
Date:   Tue Sep 29 09:52:55 2020 -0400

    Updated Team target  (RootITUp#108)

    * Updated docs [skip ci]

    * refactor Teams target
    + support additional body types for adaptive card

    * syntax cleanup to better follow PnP

    Co-authored-by: EsOsO <massimo.bonvicini@gmail.com>
    Co-authored-by: Jenkins, Michael <mjenkins@msnpath.com>

commit 9170045
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Wed Jun 17 15:06:30 2020 +0000

    Updated docs [skip ci]

commit 3a0358f
Merge: aa99080 6bfbc47
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Wed Jun 17 17:01:12 2020 +0200

    Merge branch 'dev'

commit 6bfbc47
Author: EsOsO <massimo.bonvicini@gmail.com>
Date:   Wed Jun 17 17:00:36 2020 +0200

    updated RELEASE.md

commit 736c354
Author: Tadas Medišauskas <thetadas+github@gmail.com>
Date:   Tue Jun 16 21:39:20 2020 +0100

    Use case-insensitive dictionary (RootITUp#107)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants