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

add journalctl launcher logs to flare #1592

Conversation

James-Pickett
Copy link
Contributor

No description provided.

func writeInitLogs(_ context.Context, _ *zip.Writer) error {
return nil
func writeInitLogs(ctx context.Context, logZip *zip.Writer) error {
cmd, err := allowedcmd.Journalctl(ctx, "-u", "launcher.kolide-k2.service", "-o", "json")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

putting these in JSON format, both for this and for windows, produce very verbose logs due to the extra properties it adds associated with each message ... do we want this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra info doesn't seem super useful (except for _PID maybe, but that should be available in a different checkup anyway) -- I think I'd lean toward not including it just to avoid the extra noise?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My inkling is not. I think of this as being pretty simple to a quick "tail the log file". But maybe I'll regret saying that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

droped the json conversation and just let it print the default on linux. We could add some output options to make it prettier or more customized, but those options might not be present on all distros

@@ -9,7 +9,7 @@ import (
)

func writeInitLogs(ctx context.Context, logZip *zip.Writer) error {
cmdStr := `Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='launcher'} | ConvertTo-Json`
cmdStr := `Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='launcher'} | ForEach-Object { $_.Message }`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works pretty well except for powershell adding a new line between each log, we could remove with some post processing of the output but ... 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to monkey here, you could also add Get-EventLog -Newest 10 -LogName System -Source "Service Control Manager" -Message "*launcherkolidek2svc*" | select -ExpandProperty message

@James-Pickett James-Pickett added this pull request to the merge queue Feb 9, 2024
Merged via the queue into kolide:main with commit 0915b7d Feb 9, 2024
28 checks passed
@James-Pickett James-Pickett deleted the james/add-launcher-journalctl-logs-to-flare branch February 9, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants