blob: 21ab3f03f518323c56b4628ae9c9767f2602f7d5 [file] [log] [blame]
{"version":3,"sources":["webpack:///./src/pages/docs/installation/event-logging-page.mdx"],"names":["_frontmatter","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","isMDXComponent"],"mappings":"wPAMaA,G,UAAe,S,oOAE5B,IAKMC,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeI,EAAf,CAAsBD,WAAYA,EAAYE,QAAQ,cAC3D,iBAAQ,CACN,GAAM,WADR,WAGA,iBAAQ,CACN,GAAM,iBADR,iBAGA,wJAEE,qBAAY,CACV,WAAc,KADhB,yBAFF,oFAOA,4EACA,uBAAK,mBAAU,CACX,UAAa,kBACb,WAAc,OAFb,ipBAsBL,0GACA,uBAAK,mBAAU,CACX,WAAc,OADb,6CAIL,iBAAQ,CACN,GAAM,kBADR,kBAGA,mLAEA,iGACE,yBAAgB,CACd,WAAc,KADhB,sBADF,KAKA,uBAAK,mBAAU,CACX,UAAa,kBACb,WAAc,OAFb,4IAML,8FAEE,yBAAgB,CACd,WAAc,KADhB,yCAFF,W,kOAUJH,EAAWI,gBAAiB","file":"component---src-pages-docs-installation-event-logging-page-mdx-5c244e4fb861045f1471.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/max/code/superset/docs/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return <div {...props} />;\n};\n\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...props} components={components} mdxType=\"MDXLayout\">\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 `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`Security > Action Log`}</strong>\n {`. 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 {...{\n \"className\": \"language-python\",\n \"parentName\": \"pre\"\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 {...{\n \"parentName\": \"pre\"\n }}>{`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 `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`superset_config.py`}</inlineCode>\n {`.`}</p>\n <pre><code {...{\n \"className\": \"language-python\",\n \"parentName\": \"pre\"\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`}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`superset.stats_logger.BaseStatsLogger`}</inlineCode>\n {`.`}</p>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}