{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":30421,"path":"it-operations-management/event-management/event-collection-custom-payloads.md","title":"Event collection from custom payloads","bundle":null,"doc_type":null,"release":"australia","body":"\n# Event collection from custom payloads\n\nThe MID WebService Event Collector enables you to collect event information from custom payloads in JSON, XML, or plain text format.\n\n## Before you begin\n\nEnsure that the Event Management Connectors \\(sn\\_em\\_connector\\) plugin is installed on the ServiceNow AI Platform instance.\n\nRole required: evt\\_mgmt\\_admin\n\n## About this task\n\nThe MID Server transforms the collected event messages and populates the Event table fields \\(em\\_table\\) in the instance. The collection of formatted event messages is described in this procedure using basic authentication. For information about supported authentication methods, see [Configure the MID Web Server extension](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/configure-mid-web-server-extension.md).\n\nThe format of the required MID Server URL is: `http://{MID_Server_IP}:{MID_Web_Server_Port}/api/mid/em/inbound_event?Transform={Transform_script_name}`. The name of the MID Server script include is composed by appending a suffix to the default `TransformEvents_` prefix. For information about the collection of JSON v2 event messages, see [Configure the MID WebService Event Collector Context](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/configure-em-context-extension.md).\n\n**Note:** The URL in the format `http://{MID_Server_IP}:{MID_Web_Server_Port}/api/mid/em/{transform_script_name}`is also supported.\n\n## Procedure\n\n1.  Configure the MID WebService Event Collector, see [Configure the MID WebService Event Collector Context](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/configure-em-context-extension.md).\n\n2.  Start the MID WebService Event Collector.\n\n\n## Example\n\n**Transformation of XML formatted event messages using the custom payload URL**\n\nAssume that XML formatted event messages are sent to the MID Server. Use this example to return an array of event objects from the collected event messages. The name of the MID Server script include is composed by appending a suffix to the default `TransformEvents_` prefix. For the purposes of this example, the user supplied the xmlSample script include. Using these details, the name of the MID Server script include is `TransformEvents_xmlSample`. The MID Server transforms the collected event messages by parsing the messages using the script include and then transmitting them to the instance.\n\n|Field|Value|\n|-----|-----|\n|MID\\_Server\\_IP|10.218.64.27|\n|MID\\_Web\\_Server\\_Extension\\_Port|8097|\n|transform\\_script\\_suffix \\_name|xmlSample|\n\nReplace the variables in the URL with the values from the above table: `http://10.218.64.27:8097/api/mid/em/xmlSample`\n\n**Note:** When copying and pasting the text below, hidden characters might also be copied and can cause unexpected results.\n\nExample showing XML formatted event messages:\n\n```\n<records>\n    <event>\n    <source>My Source</source>\n    <node>host1</node>\n    <type>type1</type>\n    <severity>3</severity>\n    <description>Virtual memory usage exceeds 98%</description>\n    </event>\n    <event>\n    <source>My Source</source>\n    <node>host2</node>\n    <type>type2</type>\n    <severity>2</severity>\n    <description>Virtual memory usage exceeds 90%</description>\n    </event>\n    </records>\n\n```\n\n**Related topics**  \n\n\n[Configure the MID Web Server extension](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/configure-mid-web-server-extension.md)\n\n[Configure the MID WebService Event Collector Context](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/configure-em-context-extension.md)\n\n"}}