zmoog / public-notes

Apache License 2.0
0 stars 1 forks source link

Send sample events to an integration using the eventhub CLI tool #47

Closed zmoog closed 10 months ago

zmoog commented 10 months ago

I want to send some sample events from the Azure AD Identity Protection to Elasticsearch to test the dashboard.

Instead of setting up Identity Protection on Azure AD, I want to send existing sample events to the event hub using the eventhbs CLI tool.

zmoog commented 10 months ago

I will use the RiskyUsers log category at https://github.com/elastic/integrations/blob/main/packages/azure/data_stream/identity_protection/_dev/test/pipeline/test-rickyusers-raw.log

zmoog commented 10 months ago
┌────────────────┐           ┌────────────────┐            ┌─────────────────────┐
│     adlogs     │           │ azure-eventhub │            │ identityprotection  │
│ <<event hub>>  │──────────▶│   <<input>>    │───────────▶│   <<data stream>>   │
└────────────────┘           └────────────────┘            └─────────────────────┘
         ▲                                                                        
         │                                                                        
         │                                                                        
         │                                                                        
         │                                                                        
         │                                                                        
         │                                                                        
         │                                                                        
┌────────────────┐                                                                
│   eventhubs    │                                                                
│  <<cli tool>>  │                                                                
└────────────────┘                                                                
zmoog commented 10 months ago

I set up an agent policy:

CleanShot 2023-08-28 at 16 11 18@2x

zmoog commented 10 months ago

On the event hub namespace, I created a Shared Access Policy named eventhubs-cli-tool with the Send and Listen claims:

CleanShot 2023-08-28 at 16 15 39@2x

zmoog commented 10 months ago

Set up eventhubs and use it to send the test-rickyusers-raw.log sample file to the adlogs event hub:

export EVENTHUB_CONNECTION_STRING="Endpoint=sb://<REDACTED>.servicebus.windows.net/;SharedAccessKeyName=eventhubs-cli-tool;SharedAccessKey=<REDACTED>"
export EVENTHUB_NAMESPACE="<REDACTED>"
export EVENTHUB_NAME="adlogs"

eh eventdata send \
    --lines-from-text-file ~/path/to/test-rickyusers-raw.log 
zmoog commented 10 months ago

Gere's the docs in Elasticsearch:

CleanShot 2023-08-28 at 16 26 56@2x