Skip to content

Commit

Permalink
Promtail: Fix collecting userdata field from Windows Event Log (#7461)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
The windows event log target for Promtail had a typo that led to
`EventData` being assigned to `UserData`. This PR fixes this typo.

**Which issue(s) this PR fixes**:
Fixes #6167
  • Loading branch information
latere-a-latere authored Nov 7, 2022
1 parent fa781e0 commit 17c36d6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
##### Fixes
* [6766](https://github.com/grafana/loki/pull/6766) **kavirajk**: fix(logql): Make `LabelSampleExtractor` ignore processing the line if it doesn't contain that specific label. Fixes unwrap behavior explained in the issue https://github.com/grafana/loki/issues/6713
* [7016](https://github.com/grafana/loki/pull/7016) **chodges15**: Fix issue with dropping logs when a file based SD target's labels are updated
* [7461](https://github.com/grafana/loki/pull/7461) **MarNicGit**: Promtail: Fix collecting userdata field from Windows Event Log

##### Changes
* **quodlibetor**: Change Docker target discovery log level from `Error` to `Info`
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/promtail/targets/windows/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func formatLine(cfg *scrapeconfig.WindowsEventsTargetConfig, event win_eventlog.
structuredEvent.EventData = string(event.EventData.InnerXML)
}
if !cfg.ExcludeUserData {
structuredEvent.UserData = string(event.EventData.InnerXML)
structuredEvent.UserData = string(event.UserData.InnerXML)
}
if event.Correlation.ActivityID != "" || event.Correlation.RelatedActivityID != "" {
structuredEvent.Correlation = &Correlation{
Expand Down
2 changes: 1 addition & 1 deletion clients/pkg/promtail/targets/windows/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func Test_renderEntries(t *testing.T) {
Labels: model.LabelSet{"channel": "channel", "computer": "local", "job": "windows-events"},
Entry: logproto.Entry{
Timestamp: time.Unix(0, 1).UTC(),
Line: `{"source":"Application","channel":"channel","computer":"local","event_id":10,"version":10,"level":10,"task":10,"opCode":10,"keywords":"keywords","timeCreated":"1970-01-01T00:00:00.000000001Z","eventRecordID":11,"correlation":{"activityID":"some activity","relatedActivityID":"some related activity"},"execution":{"processId":1,"threadId":5},"security":{"userId":"1"},"user_data":"eventdata","event_data":"eventdata","message":"message"}`,
Line: `{"source":"Application","channel":"channel","computer":"local","event_id":10,"version":10,"level":10,"task":10,"opCode":10,"keywords":"keywords","timeCreated":"1970-01-01T00:00:00.000000001Z","eventRecordID":11,"correlation":{"activityID":"some activity","relatedActivityID":"some related activity"},"execution":{"processId":1,"threadId":5},"security":{"userId":"1"},"user_data":"userdata","event_data":"eventdata","message":"message"}`,
},
},
}, entries)
Expand Down

0 comments on commit 17c36d6

Please sign in to comment.