def learnDatesShell():
    print
    filename = prompt("full filename from which to learn dates", False).strip()
    if not dcutils.fileExists(filename):
        print "File does not exist."
        return
    info, html = getDateInfo(filename)
    splunkhome = os.environ["SPLUNK_HOME"]
    if splunkhome == None or splunkhome == "":
        dtfile = "datetime.xml"
    else:
        dtfile = os.path.join(splunkhome, 'etc', 'datetime.xml')

    print "\n\nPatterns Learned. \n\nIt is highly recommended that you make changes to a copy of the default datetime.xml file."
    print "For example, copy \"" + dtfile + "\" to \"" + splunkhome + "/etc/system/local/datetime.xml\", and work with that file.\n"
    print "In that custom file, add the below timestamp definitions, and add the pattern names "
    print "to timePatterns and datePatterns list.\n\nFor more details, see http://www.splunk.com/doc/latest/admin/TrainTimestampRecognition\n" 
    print "-"*80
    print html
Exemplo n.º 2
0
def looseFileExists(filename):
    return dcutils.fileExists(filename.strip())
Exemplo n.º 3
0
def looseFileExists(filename):
    return dcutils.fileExists(filename.strip())