I need to send custom data (json) to my Log Analytics Workspace. In the documentation they say that custom app can send it via Data Ingestion API:
I created Data Collection Endpoint, but now have a problem with Data Collection Rule.
Data source is an obligatory setting there, but none of Data Source types are matches my needs. Seems like Custom Text Logs are the closest, but they have File Pattern setting, which I assume related to logs stored on a machine. After all, I don't have any Data source, my app will just use Ingestion API.
My question is should I just pick random and then just use those DCE and DCR via Ingestion API(and sending my custom jsons) or is there some other way to do it?
To send customized
JSON
data to the Log Analytics Workspace, you can use a custom app to deliver it over the Data Ingestion API. Create a new data collection endpoint and a data collection rule by selecting thecustom text logs
type with some random file pattern such as'/'
.Once it is created, use below
PowerShell
script to send the data by usingREST API
with theInvoke-RestMethod
command.Now generated an encoded hash by using the below format for authentication purpose.
At last, use
Invoke-RestMethod
by passing the above gatheredheaders
as shown below.Refer MSDoc for more related information.