{"id":27011510,"url":"https://github.com/pcon/sfdc-eventmonitoring","last_synced_at":"2025-04-04T11:29:38.443Z","repository":{"id":57357220,"uuid":"138169856","full_name":"pcon/sfdc-eventMonitoring","owner":"pcon","description":"Command line tools surrounding event monitoring","archived":false,"fork":false,"pushed_at":"2019-11-25T16:16:07.000Z","size":263,"stargazers_count":9,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T00:11:33.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-21T12:52:12.000Z","updated_at":"2022-08-02T11:18:48.000Z","dependencies_parsed_at":"2022-09-26T16:31:04.407Z","dependency_job_id":null,"html_url":"https://github.com/pcon/sfdc-eventMonitoring","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcon%2Fsfdc-eventMonitoring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcon%2Fsfdc-eventMonitoring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcon%2Fsfdc-eventMonitoring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcon%2Fsfdc-eventMonitoring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcon","download_url":"https://codeload.github.com/pcon/sfdc-eventMonitoring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247169318,"owners_count":20895263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-04T11:29:37.826Z","updated_at":"2025-04-04T11:29:38.427Z","avatar_url":"https://github.com/pcon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Event Monitoring\n[![Build Status](https://travis-ci.org/pcon/sfdc-eventMonitoring.svg?branch=master)](https://travis-ci.org/pcon/sfdc-eventMonitoring)\n[![Code Climate](https://codeclimate.com/github/pcon/sfdc-eventMonitoring/badges/gpa.svg)](https://codeclimate.com/github/pcon/sfdc-eventMonitoring)\n[![Coverage Status](https://img.shields.io/coveralls/github/pcon/sfdc-eventMonitoring.svg)](https://coveralls.io/github/pcon/sfdc-eventMonitoring?branch=master)\n\nThis application is a command-line interface for interacting with the Event Monitoring capabilities of Salesforce.\n\nThis application is in a very early state and is limited in it's functionality.  Additionally, it may eat your babies if you leave it alone in the same room with them.  You have been warned.\n\n# Installation\nThe application is installed via `npm`\n\n```bash\nnpm -g install sfdc-eventmonitoring\n```\n\n# Usage\nBasic usage is to run the `eventmonitoring` command with a `--help` to see all of the available commands.  You will need to make sure you provide your authentication information to login to your org.\n\n## Authentication\nThis can be provided in a couple of ways\n\n### Command-line\nThe simplest way to do it is to provide username, password and token as command-line parameters\n\n```bash\neventmonitoring --username user@example.com --password donthackme --token 123abc\n```\n\n**Flags**\n*   **--interval \\[interval\\]** - hourly, daily - The interval to use for the data\n*   **--latest=\\[true,false\\]** - If we should get the latest (single) log\n*   **--date \\[date\\]** - The date\n*   **--start \\[datetime\\]** - The start date/time\n*   **--end \\[datetime\\]** - The end date/time\n\n### Logging\nFlags\n*   **--debug** - Enables debug logging\n*   **--logformat=\\[console,bunyan\\]** - The log format to use\n*   **--logfile=\\[pathtofile\\]** - The logfile to output to. Only used with `--logformat=bunyan`\n\nIf you want to be able to produce debug logs and still be able to pipe the output from the command-line into another process, use `--logformat=bunyan` and `--logfile` options.  This will produce a log file that you can use with the [bunyan](https://github.com/trentm/node-bunyan) executable.\n\n### Solenopsis\nThe application support usage of [Solenopsis](http://solenopsis.org/Solenopsis/) style configuration files and locations.\n\nFor example you can create the following `prod.properties` credentials files in `$HOME/.solenopsis/credentials/prod.properties`\n\n```text\nusername=user@example.com\npassword=donthackme\ntoken=123abc\nurl=https://login.salesforce.com\n```\n\nThen run the application using the `env` and `solenopsis` flags\n\n```bash\neventmonitoring --env prod --solenopsis\n```\n\n### Configuration File\nYou can also store these values in the `$HOME/.eventmonitoring` config file\n\n```json\n{\n  \"username\": \"user@example.com\",\n  \"password\": \"donthackme\",\n  \"token\": \"123abc\"\n}\n```\n\n```json\n{\n  \"env\": \"prod\",\n  \"solenopsis\": true\n}\n```\n\n### Caching\nYou can enable caching by adding the `--cache /path/to/cache/folder` or adding the following to your config file\n\n```json\n\"cache\": \"/path/to/cache/folder\"\n```\n\n## Cache\nThis sub command interacts with the cache.  If you do not have a cache set up in the config or command line flag, this will not work.\n\n### Stats\nShows cache stats\n\n```bash\neventmonitoring cache stats\n```\n\n```text\nTotal Size Usage: 90.5 MB\n      JSON Usage: 46.4 MB\n       CSV Usage: 44.1 MB\n\n\n╔════════════╤═════════╗\n║ Date       │ Usage   ║\n╟────────────┼─────────╢\n║ 2018-07-18 │ 90.5 MB ║\n╚════════════╧═════════╝\n```\n\n### Clear\nClears the cache\n\n#### Clear all the cache\n```bash\neventmonitoring cache clear\n```\n\n#### Clear a specific date's cache\n```bash\neventmonitoring cache clear --date 2018-07-18\n```\n\n#### Clear a date range's cache\n```bash\neventmonitoring cache clear --start 2018-07-18T00:00:00.000Z --end 2018-07-18T02:00:00.000Z\n```\n\n## Dump\nThis sub command dumps all the data to stdout or disk\n\n**Flags**\n*   **--format \\[format\\]** - json, csv - The format the output should be displayed in\n*   **--type \\[type\\]** - The event type to dump\n*   **--split** - Split the files based on event type\n*   **--file \\[filename\\]** - The filename to save the data to\n\n```bash\neventmonitoring dump --type ApexSoap --type Login --type API --file events.json --split\n```\n\n```text\n# ls\nevents_ApexSoap.json\nevents_Login.json\nevents_API.json\n```\n\n## Show\nThis sub command shows users doing things\n\n**Flags**\n*   **--api** - Only show API users\n*   **--format \\[format\\]** - json, table - The format the output should be displayed in\n*   **--asc** - Sort the data in ascending order\n*   **--sort \\[field1,field2\\]** - The fields to sort the data by.  This will vary from type to type.\n*   **--limit \\[limit\\]** - The number of results to limit to\n*   **--subsort \\[field1,field2\\]** - The fields to sort the secondary data by.  This will vary from type to type.\n*   **--sublimit \\[limit\\]** - The number of results for secondary data to limit to.\n*   **--userid \\[id\\]** - The user id to return.  This can be stacked to return multiple users\n\n### API Usage\nData around users and API usage\n\nThe summary mode can be useful for getting an idea of the overal usage of your API\n\n```bash\neventmonitoring show apiusage --summary\n```\n\n```text\n╔══════════════════════╤══════════════════════════════════════════════╤═════════════════╤════════╗\n║ Name                 │ Username                                     │ Id              │ Count  ║\n╟──────────────────────┼──────────────────────────────────────────────┼─────────────────┼────────╢\n║ Integration User     │ integrationuser@example.com                  │ 005A000000abcde │ 238084 ║\n╟──────────────────────┼──────────────────────────────────────────────┼─────────────────┼────────╢\n║ Utility User         │ utility@api.example.com                      │ 005A000000abcdf │ 11081  ║\n╟──────────────────────┼──────────────────────────────────────────────┼─────────────────┼────────╢\n║ Script Kiddie        │ scriptkiddie@example.com                     │ 005A000000abcdg │ 7168   ║\n╟──────────────────────┼──────────────────────────────────────────────┼─────────────────┼────────╢\n║ Another User         │ anotherautomationuser@example.com            │ 005A000000abcdh │ 2037   ║\n╚══════════════════════╧══════════════════════════════════════════════╧═════════════════╧════════╝\n```\n\nFor more information you can get a breakdown per user per endpoint\n\n```bash\neventmonitoring show apiusage --limit 3 --sublimit 4\n```\n\n```text\nUser: Integration User - integrationuser@example.com - 005A000000abcde\nTotal API Calls: 43,289\n╔══════════════════════════════════╤═══════╗\n║ Endpoint                         │ Count ║\n╟──────────────────────────────────┼───────╢\n║ CaseAPI.listAttachments          │ 10814 ║\n╟──────────────────────────────────┼───────╢\n║ AccountAPI.getContactsForAccount │ 10152 ║\n╟──────────────────────────────────┼───────╢\n║ CaseAPI.getCase                  │ 10109 ║\n╟──────────────────────────────────┼───────╢\n║ AccountAPI.getAccount            │ 10099 ║\n╚══════════════════════════════════╧═══════╝\n\nUser: Utility User - utility@api.example.com - 005A000000abcdf\nTotal API Calls: 19,974\n╔══════════════════════════════════╤═══════╗\n║ Endpoint                         │ Count ║\n╟──────────────────────────────────┼───────╢\n║ CaseAPI.getCase                  │ 2137  ║\n╟──────────────────────────────────┼───────╢\n║ CaseAPI.listAttachments          │ 1930  ║\n╟──────────────────────────────────┼───────╢\n║ ContactAPI.getContact            │ 1840  ║\n╟──────────────────────────────────┼───────╢\n║ AccountAPI.getContactsForAccount │ 1738  ║\n╚══════════════════════════════════╧═══════╝\n\nUser: Script Kiddie - scriptkiddie@example.com - 005A000000abcdg\nTotal API Calls: 2,084\n╔═════════════════════════════════╤═══════╗\n║ Endpoint                        │ Count ║\n╟─────────────────────────────────┼───────╢\n║ ProductAPI.listVersions         │ 2046  ║\n╟─────────────────────────────────┼───────╢\n║ ProductAPI.listEntitledProducts │ 20    ║\n╟─────────────────────────────────┼───────╢\n║ InternalAPI.upsertCaseComment   │ 10    ║\n╟─────────────────────────────────┼───────╢\n║ ProductAPI.listProducts         │ 8     ║\n╚═════════════════════════════════╧═══════╝\n```\n\n### Logins\nData around user logins\n\n```bash\neventmonitoring show logins\n```\n\n```text\nUsername: automation@example.com (005A00000010LgN)\nTotal Logins: 20249\nTotal Logouts: 209       Explicit: 0         Implicit: 209\n\nUsername: bob@api.example.com (005A0000001qLI1)\nTotal Logins: 1827\nTotal Logouts: 0         Explicit: 0         Implicit: 0\n\nUsername: foobar@api.example.com (005A0000008PItw)\nTotal Logins: 1554\nTotal Logouts: 42        Explicit: 0         Implicit: 42\n```\n\n## Login\nThis sub command is used around Login data\n\n**Flags**\n*   **--format \\[format\\]** - json, table - The format the output should be displayed in\n*   **--asc** - Sort the data in ascending order\n*   **--sort** - The field to sort the data by.  This will vary from report type to report type.\n*   **--limit \\[limit\\]** - The number of results to limit to\n*   **--maxversion** - The max API version.  Only used with apiversion\n*   **--summary** - Summerize the results.  Only used with apiversion\n\n### APIVersion\nReport based on the API Version.\n\nThe summary mode is useful to see if you have API clients using older versions of the API\n\n```bash\neventmonitoring login apiversion --summary\n```\n\n```text\n╔═════════╤═══════╗\n║ Version │ Count ║\n╟─────────┼───────╢\n║ 8       │ 60    ║\n╟─────────┼───────╢\n║ 19      │ 228   ║\n╟─────────┼───────╢\n║ 29      │ 61    ║\n╟─────────┼───────╢\n║ 30      │ 11    ║\n╟─────────┼───────╢\n║ 32      │ 74    ║\n╟─────────┼───────╢\n║ 33      │ 1     ║\n╟─────────┼───────╢\n║ 35      │ 5     ║\n╟─────────┼───────╢\n║ 37      │ 11    ║\n╟─────────┼───────╢\n║ 39      │ 35    ║\n╟─────────┼───────╢\n║ 40      │ 20    ║\n╚═════════╧═══════╝\n```\n\nWithout the summary flag, it will group by username.  Most likely, you'll want to apply the max version flag to limit it to only older versions of the API to \"blame\" users\n\n```bash\neventmonitoring login apiversion --maxversion 30\n```\n\n```text\n╔═════════╤══════════════════════════════════════════════╤═══════╗\n║ Version │ Username                                     │ Count ║\n╟─────────┼──────────────────────────────────────────────┼───────╢\n║ 8       │ utility@api.example.com                      │ 60    ║\n╟─────────┼──────────────────────────────────────────────┼───────╢\n║ 19      │ automationuser@example.com                   │ 228   ║\n╟─────────┼──────────────────────────────────────────────┼───────╢\n║ 29      │ scriptkiddie@api.example.com                 │ 60    ║\n╟─────────┼──────────────────────────────────────────────┼───────╢\n║ 29      │ anotherautomationuser@example.com            │ 1     ║\n╚═════════╧══════════════════════════════════════════════╧═══════╝\n```\n\n### Failed Login\nReport based on failed logins\n\n```bash\neventmonitoring login failed\n```\n\n```text\n╔═════════════════════╤═══════╤══════════════════════════════╗\n║ Username            │ Count │ Error Message                ║\n╟─────────────────────┼───────┼──────────────────────────────╢\n║ user1@example.com   │ 1     │ Failed: InResponseTo Invalid ║\n╟─────────────────────┼───────┼──────────────────────────────╢\n║ user2@example.com   │ 1     │ Failed: InResponseTo Invalid ║\n╚═════════════════════╧═══════╧══════════════════════════════╝\n```\n\n## Report\nThis sub command is used to report on Event Monitoring data\n\n**Flags**\n*   **--format \\[format\\]** - json, table - The format the output should be displayed in\n*   **--asc** - Sort the data in ascending order\n*   **--sort** - The field to sort the data by.  This will vary from report type to report type.\n*   **--limit \\[limit\\]** - The number of results to limit to\n\n### Apex Callouts\nReporting based on ApexCallout data\n\n```bash\neventmonitoring report apexcallout\n```\n\n```text\n╔══════════════════════════════════════════════════════════════════════╤═══════╤══════════════╤═══════════════╤════════════╗\n║ Name                                                                 │ Count │ Request Size │ Response Size │ Total Time ║\n╟──────────────────────────────────────────────────────────────────────┼───────┼──────────────┼───────────────┼────────────╢\n║ REST.GET    https://api.example.com/restful/api/Ticket               │ 368   │ -1 B         │ 85 B          │ 370ms      ║\n╟──────────────────────────────────────────────────────────────────────┼───────┼──────────────┼───────────────┼────────────╢\n║ REST.GET    https://api.example.com/restful/api/Receipt              │ 368   │ -1 B         │ 89 B          │ 410ms      ║\n╟──────────────────────────────────────────────────────────────────────┼───────┼──────────────┼───────────────┼────────────╢\n║ REST.POST   https://remote.example.com/api/command.ns                │ 3     │ -1 B         │ 195 B         │ 764ms      ║\n╚══════════════════════════════════════════════════════════════════════╧═══════╧══════════════╧═══════════════╧════════════╝\n```\n\n**Sort Fields**\n*   **name** - The Apex callout name\n*   **count** - The number of times the callout was called\n*   **request** - The average request size\n*   **response** - The average response size\n*   **time** - The average execution time\n\n\n### Apex Execution\nReporting based on ApexExecution data\n\n```bash\neventmonitoring report apexexecution\n```\n\n```text\n╔══════════════════════════════════════════════╤═══════╤══════════╤══════════╤════════════════╤═══════════════╤══════════════╤════════════╗\n║ Entry Point                                  │ Count │ CPU Time │ Run Time │ Execution Time │ DB Total Time │ Callout Time │ SOQL Count ║\n╟──────────────────────────────────────────────┼───────┼──────────┼──────────┼────────────────┼───────────────┼──────────────┼────────────╢\n║ common.apex.soap.impl.ApexObjectDeserializer │ 43616 │ 2ms      │ 3ms      │ 1ms            │ 0ms           │ 0ms          │ 0          ║\n╟──────────────────────────────────────────────┼───────┼──────────┼──────────┼────────────────┼───────────────┼──────────────┼────────────╢\n║ VFRemote- CaseViewV2 invoke(fetchCase)       │ 6094  │ 237ms    │ 322ms    │ 58ms           │ 1ms           │ 0ms          │ 8          ║\n╟──────────────────────────────────────────────┼───────┼──────────┼──────────┼────────────────┼───────────────┼──────────────┼────────────╢\n║ VF- /apex/CaseTag                            │ 2553  │ 232ms    │ 293ms    │ 212ms          │ 1ms           │ 0ms          │ 2.13       ║\n╟──────────────────────────────────────────────┼───────┼──────────┼──────────┼────────────────┼───────────────┼──────────────┼────────────╢\n║ TEPAPI.runBatchJob                           │ 2461  │ 67ms     │ 503ms    │ 28ms           │ 1ms           │ 123ms        │ 3.86       ║\n╟──────────────────────────────────────────────┼───────┼──────────┼──────────┼────────────────┼───────────────┼──────────────┼────────────╢\n║ VFRemote- CaseViewV2 invoke(caseUpdateList)  │ 1632  │ 374ms    │ 593ms    │ 72ms           │ 1ms           │ 0ms          │ 12.49      ║\n╚══════════════════════════════════════════════╧═══════╧══════════╧══════════╧════════════════╧═══════════════╧══════════════╧════════════╝\n```\n\n**Sort Fields**\n*   **name** - The Apex entry\n*   **count** - The number of times the entry was called\n*   **cpu** - The average time spent on the CPU\n*   **run** - The average run time\n*   **exec** - The average execution time\n*   **dbtotal** - The average total database CPU time\n*   **callout** - The average callout time\n*   **soql** - The average number of SOQL calls\n\n### Apex Soap\nReporting based on ApexSoap data\n\n```bash\neventmonitoring report apexsoap\n```\n\n```text\n╔══════════════════════════════════╤═══════╤══════════╤══════════╤═════════════════════╤═══════════════╗\n║ Name                             │ Count │ CPU Time │ Run Time │ Usage Percent Limit │ DB Total Time ║\n╟──────────────────────────────────┼───────┼──────────┼──────────┼─────────────────────┼───────────────╢\n║ CaseAPI.listAttachments          │ 8525  │ 179ms    │ 261ms    │ 45.13%              │ 57ms          ║\n╟──────────────────────────────────┼───────┼──────────┼──────────┼─────────────────────┼───────────────╢\n║ CaseAPI.getCase                  │ 8404  │ 359ms    │ 521ms    │ 45.12%              │ 102ms         ║\n╟──────────────────────────────────┼───────┼──────────┼──────────┼─────────────────────┼───────────────╢\n║ AccountAPI.getContactsForAccount │ 7777  │ 195ms    │ 289ms    │ 45.13%              │ 53ms          ║\n╟──────────────────────────────────┼───────┼──────────┼──────────┼─────────────────────┼───────────────╢\n║ AccountAPI.getAccount            │ 7609  │ 152ms    │ 224ms    │ 45.13%              │ 42ms          ║\n╟──────────────────────────────────┼───────┼──────────┼──────────┼─────────────────────┼───────────────╢\n║ ProductAPI.listVersions          │ 2787  │ 68ms     │ 113ms    │ 45.25%              │ 29ms          ║\n╚══════════════════════════════════╧═══════╧══════════╧══════════╧═════════════════════╧═══════════════╝\n```\n\n**Sort Fields**\n*   **name** - The name of the SOAP endpoint\n*   **count** - The number of times the endpoint was called\n*   **cpu** - The average time spent on the CPU\n*   **run** - The average run time\n*   **limit** - The average percentage of SOAP calls made against the org limit (probably not all that useful)\n*   **dbtotal** - The average total database CPU time\n\n### Apex Trigger\nReporting based on ApexTrigger data\n\n```bash\neventmonitoring report apextrigger\n```\n\n```text\n╔═══════════════════════════════╤═══════╤════════════════╗\n║ Name                          │ Count │ Execution Time ║\n╟───────────────────────────────┼───────┼────────────────╢\n║ CaseAfter.AfterUpdate         │ 2761  │ 342ms          ║\n╟───────────────────────────────┼───────┼────────────────╢\n║ CaseBefore.BeforeUpdate       │ 2761  │ 195ms          ║\n╟───────────────────────────────┼───────┼────────────────╢\n║ Outgoing_Message.AfterInsert  │ 1990  │ 3ms            ║\n╟───────────────────────────────┼───────┼────────────────╢\n║ Outgoing_Message.BeforeInsert │ 1990  │ 11ms           ║\n╟───────────────────────────────┼───────┼────────────────╢\n║ CaseHistory.AfterInsert       │ 1262  │ 218ms          ║\n╚═══════════════════════════════╧═══════╧════════════════╝\n```\n\n**Sort Fields**\n*   **name** - The name of the trigger\n*   **count** - The number of times the trigger was called\n*   **exec** - The average execution time\n\n### Report\nReporting based on Report data\n```bash\neventmonitoring report report --limit 5 --sort cpu\n```\n\n```text\n╔════════════════════════════╤═════════════════╤═══════╤══════════╤══════════╤══════════╤═════════════╤═══════════╗\n║ Name                       │ Id              │ Count │ CPU Time │ Run Time │ DB Time  │ DB CPU Time │ Row Count ║\n╟────────────────────────────┼─────────────────┼───────┼──────────┼──────────┼──────────┼─────────────┼───────────╢\n║ DELETE FROM YOUR DASHBOARD │ 00OA0000004abcd │ 1     │ 1.9s     │ 12s      │ 10.9s    │ 10.7s       │ 1243006   ║\n╟────────────────────────────┼─────────────────┼───────┼──────────┼──────────┼──────────┼─────────────┼───────────╢\n║ Case Comment Report        │ 00OA0000006abcd │ 1     │ 643ms    │ 29.8s    │ 29.2s    │ 1.4s        │ 4394      ║\n╟────────────────────────────┼─────────────────┼───────┼──────────┼──────────┼──────────┼─────────────┼───────────╢\n║ 00OA0000006efgh            │ 00OA0000006efgh │ 1     │ 539ms    │ 8s       │ 7.5s     │ 970ms       │ 4613      ║\n╟────────────────────────────┼─────────────────┼───────┼──────────┼──────────┼──────────┼─────────────┼───────────╢\n║ 00OA0000006ijkl            │ 00OA0000006ijkl │ 1     │ 503ms    │ 7.9s     │ 7.5s     │ 1.6s        │ 16624     ║\n╟────────────────────────────┼─────────────────┼───────┼──────────┼──────────┼──────────┼─────────────┼───────────╢\n║ 00OA0000006mnop            │ 00OA0000006mnop │ 3     │ 487ms    │ 2m 25.9s │ 2m 24.9s │ 2m 22.7s    │ NaN       ║\n╚════════════════════════════╧═════════════════╧═══════╧══════════╧══════════╧══════════╧═════════════╧═══════════╝\n```\n\n**Sort Fields**\n*   **name** - The name of the report\n*   **id** - The id of the report\n*   **count** - The number of times the endpoint was called\n*   **cpu** - The average time spent on the CPU\n*   **run** - The average run time\n*   **dbcpu** - The average database CPU time\n*   **dbtotal** - The average total database CPU time\n*   **rowcount** - The average number of rows returned in the report\n\n\n### Visualforce\nReporting based on Visualforce data\n\n```bash\neventmonitoring report visualforce\n```\n\n```text\n╔═════════════════════════════════════════╤═══════╤══════════╤══════════╤═════════════════╤═══════════════╤═════════════╤═══════════════╗\n║ URI                                     │ Count │ CPU Time │ Run Time │ View State Size │ Response Size │ DB CPU Time │ DB Total Time ║\n╟─────────────────────────────────────────┼───────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/CaseTag                           │ 2951  │ 229ms    │ 286ms    │ 20.5 kB         │ 65.5 kB       │ 18ms        │ 35ms          ║\n╟─────────────────────────────────────────┼───────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Chat_Hidden                       │ 1739  │ 11ms     │ 25ms     │ 0 B             │ 105 B         │ 3ms         │ 11ms          ║\n╟─────────────────────────────────────────┼───────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Case_View                         │ 1529  │ 901ms    │ 1.7s     │ 39.8 kB         │ 241 kB        │ 179ms       │ 415ms         ║\n╟─────────────────────────────────────────┼───────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/NegotiatedEntitlementProcess_View │ 216   │ 177ms    │ 467ms    │ 8.03 kB         │ 22.1 kB       │ 165ms       │ 270ms         ║\n╟─────────────────────────────────────────┼───────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Case_Edit                         │ 172   │ 649ms    │ 1.3s     │ 7.16 kB         │ 63.1 kB       │ 330ms       │ 580ms         ║\n╚═════════════════════════════════════════╧═══════╧══════════╧══════════╧═════════════════╧═══════════════╧═════════════╧═══════════════╝\n```\n\n**Sort Fields**\n*   **name** - The URI of the Visualforce page\n*   **count** - The number of times the page was accessed\n*   **cpu** - The average time spent on CPU\n*   **run** - The average run time\n*   **view** - The average view state size\n*   **response** - The average response state size\n*   **dbcpu** - The average database CPU time\n*   **dbtotal** - The average total database CPU time\n\n# Advanced Usage\n## Helpers\n\n_Currently only supported by the report command_\n\nThe **--helper** flag allows you to pass in a javascript file and provide your own formatter and filterer.\n\n```bash\neventmonitoring report visualforce --sort cpu --helper /path/to/helper.js\n```\n\n```javascript\n/**\n* Format incoming data\n* @param {string} field_name The field name being outputted\n* @param {object} data The data to be formatted\n* @return {string} The formatted data\n* @throws An error if it's not a field we're formatting\n*/\nvar formatter = function (field_name, data) {\n    if (field_name !== 'count') {\n        throw new Error('Unhandled field');\n    }\n\n    return 'Custom ' + data;\n};\n\n/**\n* Returns true if the data should be included\n* @param {object} data The data to check\n* @returns {boolean} If the data should be included\n*/\nvar filter = function (data) {\n    if (data.view \u003c 80) {\n        return false;\n    }\n\n    return true;\n};\n\nmodule.exports = {\n    formatter: formatter,\n    filter: filter\n};\n```\n\n```text\n╔═════════════════════════════════════╤════════════╤══════════╤══════════╤═════════════════╤═══════════════╤═════════════╤═══════════════╗\n║ URI                                 │ Count      │ CPU Time │ Run Time │ View State Size │ Response Size │ DB CPU Time │ DB Total Time ║\n╟─────────────────────────────────────┼────────────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Account_View                  │ Custom 4   │ 995ms    │ 2.9s     │ 52.1 kB         │ 475 kB        │ 368ms       │ 1.6s          ║\n╟─────────────────────────────────────┼────────────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Case_View                     │ Custom 811 │ 868ms    │ 1.5s     │ 39.2 kB         │ 241 kB        │ 160ms       │ 352ms         ║\n╟─────────────────────────────────────┼────────────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Case_Edit                     │ Custom 45  │ 696ms    │ 1.3s     │ 7.98 kB         │ 70.2 kB       │ 333ms       │ 540ms         ║\n╟─────────────────────────────────────┼────────────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/Escalation_View               │ Custom 19  │ 315ms    │ 479ms    │ 15.3 kB         │ 102 kB        │ 68ms        │ 144ms         ║\n╟─────────────────────────────────────┼────────────┼──────────┼──────────┼─────────────────┼───────────────┼─────────────┼───────────────╢\n║ /apex/casetag                       │ Custom 3   │ 298ms    │ 470ms    │ 13.9 kB         │ 44.2 kB       │ 104ms       │ 140ms         ║\n╚═════════════════════════════════════╧════════════╧══════════╧══════════╧═════════════════╧═══════════════╧═════════════╧═══════════════╝\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcon%2Fsfdc-eventmonitoring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcon%2Fsfdc-eventmonitoring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcon%2Fsfdc-eventmonitoring/lists"}