blob: 915ad777105e3dd5f36a3ba5f948ad069af3e6ce [file] [log] [blame]
{"version":3,"sources":["webpack:///./src/pages/docs/installation/event-logging-page.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","isMDXComponent"],"mappings":"wPAQaA,G,UAAe,S,oOAC5B,IAAMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAG5E,iBAAQ,CACN,GAAM,WADR,WAGA,iBAAQ,CACN,GAAM,iBADR,iBAGA,wJACyB,sBAAQC,WAAW,KAAnB,yBADzB,oFAGA,4EACA,uBAAK,gCAAMA,WAAW,OAAU,CAC5B,UAAa,oBADZ,ipBAqBL,0GACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,6CAEL,iBAAQ,CACN,GAAM,kBADR,kBAGA,mLAEA,iGAAgF,0BAAYA,WAAW,KAAvB,sBAAhF,KACA,uBAAK,gCAAMA,WAAW,OAAU,CAC5B,UAAa,oBADZ,4IAKL,8FACF,0BAAYA,WAAW,KAAvB,yCADE,W,kOAMJJ,EAAWK,gBAAiB","file":"component---src-pages-docs-installation-event-logging-page-mdx-b14dbe674a24da1cc205.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\n\nimport DefaultLayout from \"/home/runner/work/superset/superset/docs/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n\n\n <h2 {...{\n \"id\": \"logging\"\n }}>{`Logging`}</h2>\n <h3 {...{\n \"id\": \"event-logging\"\n }}>{`Event Logging`}</h3>\n <p>{`Superset by default logs special action events in its internal database. These logs can be accessed\non the UI by navigating to `}<strong parentName=\"p\">{`Security > Action Log`}</strong>{`. You can freely customize these logs by\nimplementing your own event log class.`}</p>\n <p>{`Here's an example of a simple JSON-to-stdout class:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-python\"\n }}>{` def log(self, user_id, action, *args, **kwargs):\n records = kwargs.get('records', list())\n dashboard_id = kwargs.get('dashboard_id')\n slice_id = kwargs.get('slice_id')\n duration_ms = kwargs.get('duration_ms')\n referrer = kwargs.get('referrer')\n\n for record in records:\n log = dict(\n action=action,\n json=record,\n dashboard_id=dashboard_id,\n slice_id=slice_id,\n duration_ms=duration_ms,\n referrer=referrer,\n user_id=user_id\n )\n print(json.dumps(log))\n`}</code></pre>\n <p>{`End by updating your config to pass in an instance of the logger you want to use:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`EVENT_LOGGER = JSONStdOutEventLogger()\n`}</code></pre>\n <h3 {...{\n \"id\": \"statsd-logging\"\n }}>{`StatsD Logging`}</h3>\n <p>{`Superset can be instrumented to log events to StatsD if desired. Most endpoints hit are logged as\nwell as key events like query start and end in SQL Lab.`}</p>\n <p>{`To setup StatsD logging, it’s a matter of configuring the logger in your `}<inlineCode parentName=\"p\">{`superset_config.py`}</inlineCode>{`.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-python\"\n }}>{`from superset.stats_logger import StatsdStatsLogger\nSTATS_LOGGER = StatsdStatsLogger(host='localhost', port=8125, prefix='superset')\n`}</code></pre>\n <p>{`Note that it’s also possible to implement you own logger by deriving\n`}<inlineCode parentName=\"p\">{`superset.stats_logger.BaseStatsLogger`}</inlineCode>{`.`}</p>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}