Nuclear Pumpkin Mayhem

    winston-azure-table-storage

    1.0.9 • Public • Published

    winston-azure-table-storage

    Table storage transport for winston Microsoft azure SDK. Fork of original winston-azure-sw project.

    In short, with this library you can use account/key as well as host/sas. Also, it fixes bug with generation of entity key (if your app logs too fast, it's possible to generate same keys for different entities.) in original lib.

    Installation

      $ npm install winston
      $ npm install winston-azure-table-storage

    Usage

    Here is the use of account/key pair.

      var winston = require('winston');
      require('winston-azure-table-storage');
      winston.configure({
          transports: [
              new (winston.transports.AzureTable) ({
                account: "Azure storage account sub domain ([A-Za-z0-9])",
                key: "The long Azure storage secret key",
                table: "The name of the table (why not just 'log'?)",
                partition: require('os').hostname(),
                level: 'warn',
                metaAsColumns: true
              })
          ]
      });
      
      winston.warn('Hello toto!');

    And here is the use of host/sas pair, created with Access Policies and SAS (See Storage Explorer fro details)

      var winston = require('winston');
      require('winston-azure-table-storage');
     
      
      winston.configure({
          transports: [
              new (winston.transports.AzureTable) ({
                host: "somestorage.table.core.windows.net", 
                sas: "The long Azure SAS", // something like '?sv=2015-12-11&si=Folder1-A123&tn=folder1&sig=BLA-BLA'
                table: "Folder1", //SAS usssualy also contains it
                partition: require('os').hostname(),
                level: 'warn',
                metaAsColumns: true
              })
          ]
      });
      
      winston.warn('Hello toto!');

    The Azure transport accepts the following options:

    • level: Level of messages that this transport should log (defaults to info).
    • account: The name of the Windows Azure storage account to use
    • key: The access key used to authenticate into this storage account
    • host: The name of the Windows Azure storage host
    • sas: The SAS used to authenticate and associated with given Access Policy
    • table: The name of the table to log to (defaults to 'log'). Must already exist.
    • partition: The value to use for the PartitionKey in each row (defaults to 'log').
    • metaAsColumns: If true, the transport will store the metadata key/value pairs in individual columns (this can be helpful when querying table storage for log entries with specific metadata values). The default is to store the entire meta value as a single JSON string in a 'meta' column.
    • rowKeyBuilder: A function to build the primary key, default is:
        function()
        {
            var rtext = '';
            var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
            for (var i = 0; i < 5; i++)
                rtext += possible.charAt(Math.floor(Math.random() * possible.length));
            return (new Date()).getTime() + '_' + (new Date()).getMilliseconds() + '_' + rtext;
        }

    Install

    npm i winston-azure-table-storage

    DownloadsWeekly Downloads

    100

    Version

    1.0.9

    License

    ISC

    Unpacked Size

    22 kB

    Total Files

    6

    Last publish

    Collaborators

    • ramji.p