Skip to content

Commit

Permalink
Update Receiver Configurations and Transformation Rules (#159)
Browse files Browse the repository at this point in the history
* Refactor receiver configs and update transformation logic

* update windowseventlog files
  • Loading branch information
bardabun authored Apr 8, 2024
1 parent 5a9c841 commit 0193a82
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion resources/otel/processors/transform_application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ transform/application:
statements:
- flatten(body["event_data"], depth=1)
- flatten(body["event_data"], depth=2)
- replace_all_patterns(body["event_data"], "key", "data.([0-9]).", "data_$$1")
- replace_all_patterns(body["event_data"], "key", "^data.([0-9A-Za-z]+).", "data_$${1}_") # Transforms 'data.<dynamic_part>.' keys. If <dynamic_part> is not empty, it formats as 'data_0_TargetUserName:"Administrator"'. Otherwise, it appears as 'data_0_:"Administrator"'.
8 changes: 4 additions & 4 deletions resources/otel/receivers/filelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mac_run: |
fi
done
set_yaml_file_field_value "$OTEL_RECEIVERS_DIR/filelog.yaml" '.receiver.filelog/NAME.attributes.type' "$LOGS_TYPE"
set_yaml_file_field_value "$OTEL_RECEIVERS_DIR/filelog.yaml" '.receiver.filelog/NAME.resource.type' "$LOGS_TYPE"
if [[ $? -ne 0 ]]; then
echo -e "error setting type to filelog receiver: $(get_task_error_message)" >"$TASK_ERROR_FILE"
return 3
Expand All @@ -26,7 +26,7 @@ linux_run: |
fi
done
set_yaml_file_field_value "$OTEL_RECEIVERS_DIR/filelog.yaml" '.receiver.filelog/NAME.attributes.type' "$LOGS_TYPE"
set_yaml_file_field_value "$OTEL_RECEIVERS_DIR/filelog.yaml" '.receiver.filelog/NAME.resource.type' "$LOGS_TYPE"
if [[ $? -ne 0 ]]; then
echo -e "error setting type to filelog receiver: $(get_task_error_message)" >"$TASK_ERROR_FILE"
return 3
Expand Down Expand Up @@ -60,7 +60,7 @@ windows_run: |
}
}
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\filelog.yaml" '.receiver.filelog/NAME.attributes.type' $LogsType
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\filelog.yaml" '.receiver.filelog/NAME.resource.type' $LogsType
if ($Err.Count -ne 0) {
Write-Output "error setting type to filelog receiver: $($Err[0])"
return 4
Expand All @@ -77,5 +77,5 @@ receiver:
- type: move
from: attributes["log.file.path"]
to: attributes["log_file_path"]
attributes:
resource:
type:
4 changes: 2 additions & 2 deletions resources/otel/receivers/windowseventlog_application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ windows_run: |
return 1
}
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_application.yaml" '.receiver.windowseventlog/application/NAME.attributes.type' $LogsType
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_application.yaml" '.receiver.windowseventlog/application/NAME.resource.type' $LogsType
if ($Err.Count -ne 0) {
Write-Output "error setting type to windowseventlog/application receiver: $($Err[0])"
return 3
Expand All @@ -36,5 +36,5 @@ receiver:
windowseventlog/application/NAME:
channel: Application
exclude_providers: []
attributes:
resource:
type:
4 changes: 2 additions & 2 deletions resources/otel/receivers/windowseventlog_security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ windows_run: |
return 1
}
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_security.yaml" '.receiver.windowseventlog/security/NAME.attributes.type' $LogsType
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_security.yaml" '.receiver.windowseventlog/security/NAME.resource.type' $LogsType
if ($Err.Count -ne 0) {
Write-Output "error setting type to windowseventlog/security receiver: $($Err[0])"
return 2
Expand All @@ -29,5 +29,5 @@ windows_run: |
receiver:
windowseventlog/security/NAME:
channel: Security
attributes:
resource:
type:
4 changes: 2 additions & 2 deletions resources/otel/receivers/windowseventlog_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ windows_run: |
return 1
}
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_system.yaml" '.receiver.windowseventlog/system/NAME.attributes.type' $LogsType
$local:Err = Set-YamlFileFieldValue "$LogzioTempDir\resources\otel\receivers\windowseventlog_system.yaml" '.receiver.windowseventlog/system/NAME.resource.type' $LogsType
if ($Err.Count -ne 0) {
Write-Output "error setting type to windowseventlog/system receiver: $($Err[0])"
return 2
Expand All @@ -29,5 +29,5 @@ windows_run: |
receiver:
windowseventlog/system/NAME:
channel: System
attributes:
resource:
type:

0 comments on commit 0193a82

Please sign in to comment.