<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to index Azure Table storage data without a valid DateTime column? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275419#M190289</link>
    <description>&lt;P&gt;The generic Azure Storage Table input does not support this.  However, the Azure Diagnostics input does use ticks on some of the queries.  The PartitionKey for some of the tables is ticks.  Using the PartitionKey is preferable when querying Azure data since this field is indexed by Azure (which means faster queries).  Check out the code in AzureDiagnostics.py.&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2016 16:21:16 GMT</pubDate>
    <dc:creator>jconger</dc:creator>
    <dc:date>2016-05-31T16:21:16Z</dc:date>
    <item>
      <title>How to index Azure Table storage data without a valid DateTime column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275417#M190287</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Do someone have experience using the Splunk Add-on for Azure app, and retrieving Azure Table storage data? &lt;/P&gt;

&lt;P&gt;The problem is getting the table data without having a valid DateTime field in the Azure Table. Instead the table has a column using DateTime.Ticks (a 64-bit integer, e.g. 635999855693046079). The provider of the table is a 3rd party, so I'm not able to change this.&lt;/P&gt;

&lt;P&gt;I've tried using the Tick field as the &lt;EM&gt;Date/Time Column&lt;/EM&gt; in the input setup, no error message is shown when pressing save input, but nothing gets indexed. As a test I made a new table with a standard DateTime column, and this was indexed as expected. So far the only solution I see is to mess around in the &lt;EM&gt;AzureStorageTable.py&lt;/EM&gt; script to parse the field correct there, but that's something I'd rather not do.&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 12:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275417#M190287</guid>
      <dc:creator>thilleso</dc:creator>
      <dc:date>2016-05-30T12:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to index Azure Table storage data without a valid DateTime column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275418#M190288</link>
      <description>&lt;P&gt;The best thing is to convert Azure &lt;CODE&gt;ticks&lt;/CODE&gt; to &lt;CODE&gt;time_t&lt;/CODE&gt; before you import the data.  If that cannot be done, then the next best thing is to use &lt;CODE&gt;DATETIME=CURRENT&lt;/CODE&gt; to force it to use &lt;CODE&gt;now&lt;/CODE&gt; as each event's timestamp and then use &lt;CODE&gt;All time&lt;/CODE&gt; for every search, convert the &lt;CODE&gt;Ticks&lt;/CODE&gt; field to a &lt;CODE&gt;time_t&lt;/CODE&gt; field and reassign this value to &lt;CODE&gt;_time&lt;/CODE&gt; before doing any work.  The performance on this will be terrible but it will work.  Here is how to convert:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/1613853/convert-ticks-to-time-t-or-filetime"&gt;http://stackoverflow.com/questions/1613853/convert-ticks-to-time-t-or-filetime&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 13:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275418#M190288</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-30T13:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to index Azure Table storage data without a valid DateTime column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275419#M190289</link>
      <description>&lt;P&gt;The generic Azure Storage Table input does not support this.  However, the Azure Diagnostics input does use ticks on some of the queries.  The PartitionKey for some of the tables is ticks.  Using the PartitionKey is preferable when querying Azure data since this field is indexed by Azure (which means faster queries).  Check out the code in AzureDiagnostics.py.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 16:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275419#M190289</guid>
      <dc:creator>jconger</dc:creator>
      <dc:date>2016-05-31T16:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to index Azure Table storage data without a valid DateTime column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275420#M190290</link>
      <description>&lt;P&gt;Ended up editing &lt;EM&gt;AzureStorageTable.py&lt;/EM&gt; to make it work. I edited/added the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import md5, hashlib 
.
.

def get_encoded_csv_file_path(checkpoint_dir, file_name):
    name = ""
    for i in range(len(file_name)):
        if file_name[i].isalnum():
            name += file_name[i]
        else:
            name += "_"

    name = name[:100]

    m = hashlib.md5() # Updated to hashlib since md5.new() is depricated and slower
    m.update(file_name)
    name += "_" + m.hexdigest() + ".csv.gz"

    return os.path.join(checkpoint_dir, name)

# This is used to convert a datetime object to ticks
def dateTimetoTicks(dt):
    ticksBeforeEpoch = 621355968000000000
    ticksSinceEpochToDateTime = (dt - datetime.datetime.utcfromtimestamp(0)).total_seconds() * 10000000
    long(ticksSinceEpochToDateTime)
    totalTime = long(ticksBeforeEpoch + ticksSinceEpochToDateTime)

    return totalTime
.
.

# Default the start date to 2 days ago
    dateTimeStart = (datetime.datetime.today() - datetime.timedelta(days=2))
    dateTimeStart = dateTimetoTicks(dateTimeStart)

if not date_time_start in ['',None]:
    # if a start time was specified in the config, use that value instead of the default
    TempdateTimeStart = dateutil.parser.parse(date_time_start)
    dateTimeStart = dateTimetoTicks(TempdateTimeStart)
.
.

if marker is not None:
    dateTimeStart = marker

# NEW filter_string with ticks as filter - appending L for specifying Int64
filter_string = "%s gt %sL" % (date_time_column, dateTimeStart)
.
.

# Update to check for if entity is long 
if not isinstance(entity[date_time_column], long):
    # if the entity column is not a datetime, try to convert it
    try:
        entity[date_time_column] = dateTimetoTicks(entity[date_time_column])
.
.

if isinstance(entity[date_time_column], long) and (entity[date_time_column] &amp;gt; last_dateTime):
    # compare this entitiy's datetime to the last_dateTime variable
    last_dateTime = entity[date_time_column]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Querying PartitionKey (ticks) is much faster than querying datetime-objects as explained here&lt;BR /&gt;
&lt;A href="http://www.codeproject.com/Tips/671361/Some-tips-and-tricks-for-azure-table-storage"&gt;http://www.codeproject.com/Tips/671361/Some-tips-and-tricks-for-azure-table-storage&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Cheers! &lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 13:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-index-Azure-Table-storage-data-without-a-valid-DateTime/m-p/275420#M190290</guid>
      <dc:creator>thilleso</dc:creator>
      <dc:date>2016-06-06T13:41:16Z</dc:date>
    </item>
  </channel>
</rss>

