예제 #1
0
파일: twink.py 프로젝트: DRArpitha/splunk
    def executeSearch(self, q, **kwargs):
        job = splunk.search.dispatch(q)
        splunk.search.waitForJob(job)

        output = []
        for event in job.results[0:50]:
            output.append({
                'status': unicode(event.raw),
                'time': i18n.format_datetime_microseconds(event['_time'], 'short'),
                'screen_name': unicode(event['source']),
                'host': unicode(event['host']),
                'source': unicode(event['sourcetype'])
            })
        return output
    def executeSearch(self, q, **kwargs):
        job = splunk.search.dispatch(q)
        splunk.search.waitForJob(job)

        output = []
        for event in job.results[0:50]:
            output.append({
                'status':
                unicode(event.raw),
                'time':
                i18n.format_datetime_microseconds(event['_time'], 'short'),
                'screen_name':
                unicode(event['source']),
                'host':
                unicode(event['host']),
                'source':
                unicode(event['sourcetype'])
            })
        return output
예제 #3
0
            long - October 17, 2009
            
        time_format:
            short - 3:49 PM
            medium - 3:49:33.000 PM
            long - 3:49:40.000 PM -0700
        '''

        try:
            parsed = times.splunktime2Iso(ts)
        except Exception, e:
            logger.exception(e)
            return '{}'

        output = {}

        for key in parsed:

            localizedargs = {
                'dt': splunk.util.parseISO(parsed[key]),
                'date_base_format': date_format,
                'time_base_format': time_format
            }

            output[key] = {
                'iso': parsed[key],
                'localized': i18n.format_datetime_microseconds(**localizedargs)
            }

        return self.render_json(output)
예제 #4
0
파일: utility.py 프로젝트: DRArpitha/splunk
        time_format:
            short - 3:49 PM
            medium - 3:49:33.000 PM
            long - 3:49:40.000 PM -0700
        '''

        try:
             parsed = times.splunktime2Iso(ts)
        except Exception, e:
            logger.exception(e)
            return '{}'
            
        output = {}
        
        for key in parsed:
            
            localizedargs = {
                'dt': splunk.util.parseISO(parsed[key]),
                'date_base_format': date_format,
                'time_base_format': time_format
            }
                
            output[key] = {
                'iso': parsed[key],
                'localized': i18n.format_datetime_microseconds(**localizedargs)
            }
            
        return self.render_json(output)