This file is indexed.

/usr/share/logsparser/normalizers/common_callBacks.xml is in python-logsparser 0.4-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<?xml version="1.0" encoding="UTF-8"?>
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!--                                                            -->
<!-- pylogparser - Logs parsers python library                  -->
<!-- Copyright (C) 2011 Wallix Inc.                             -->
<!--                                                            -->
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!--                                                            -->
<!-- This package is free software; you can redistribute        -->
<!-- it and/or modify it under the terms of the GNU Lesser      -->
<!-- General Public License as published by the Free Software   -->
<!-- Foundation; either version 2.1 of the License, or (at      -->
<!-- your option) any later version.                            -->
<!--                                                            -->
<!-- This package is distributed in the hope that it will be    -->
<!-- useful, but WITHOUT ANY WARRANTY; without even the implied -->
<!-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR    -->
<!-- PURPOSE.  See the GNU Lesser General Public License for    -->
<!-- more details.                                              -->
<!--                                                            -->
<!-- You should have received a copy of the GNU Lesser General  -->
<!-- Public License along with this package; if not, write      -->
<!-- to the Free Software Foundation, Inc., 59 Temple Place,    -->
<!-- Suite 330, Boston, MA  02111-1307  USA                     -->
<!--                                                            -->
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!DOCTYPE callBacks [
<!ELEMENT callBacks (callBack+)>
<!ELEMENT callBack (description?, code)>
<!ATTLIST callBack name CDATA #REQUIRED>
<!ELEMENT description (localized_desc+)>
<!ELEMENT localized_desc (#PCDATA)>
<!ATTLIST localized_desc language CDATA #REQUIRED>
<!ELEMENT code (#PCDATA)>
]>

<!-- Definition of commmon callbacks. -->

<callBacks>
	<callback name="MM/dd/YYYY hh:mm:ss">
		<description>
			<localized_desc language="en">
			dd matches the number of the day (1, 2, 3, etc...)
			MM matches the name of the month (Jan, Feb, Mar, etc...)
			YYYY matches the year (2012)
			hh:mm:ss matches the time (23:54:42)
			</localized_desc>
		</description>
		<code>
r = re.compile('(?P&lt;month&gt;\d{2})/(?P&lt;day&gt;\d{2})/(?P&lt;year&gt;\d{4}) (?P&lt;hour&gt;\d{2}):(?P&lt;minute&gt;\d{2}):(?P&lt;second&gt;\d{2})')
date = r.search(value).groupdict()
date = dict([(u, int(date[u])) for u in date.keys()])
newdate = datetime(**date)
log['date'] = newdate
		</code>
	</callback>
	<callback name="dd/MMM/YYYY:hh:mm:ss">
		<description>
			<localized_desc language="en">
			dd matches the number of the day (1, 2, 3, etc...)
			MMM matches the name of the month (Jan, Feb, Mar, etc...)
			YYYY matches the year (2012)
			hh:mm:ss matches the time (23:54:42)
			</localized_desc>
		</description>
		<code>
english_months = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
ctf = re.compile("(?P&lt;day&gt;\d+)/(?P&lt;month&gt;[a-zA-Z]+)/(?P&lt;year&gt;\d+):(?P&lt;hour&gt;\d+):(?P&lt;minute&gt;\d+):(?P&lt;second&gt;\d+)")
m = ctf.search(value)
if m:
    vals = m.groupdict()
    vals['month'] = english_months[vals['month']]
    vals = dict( [ (u, int(vals[u])) for u in vals.keys() ])
    newdate = datetime(**vals)

    log['date'] = newdate  
else:
    raise Exception, "invalid date string %s" % value
		</code>
	</callback>
	<callback name="MMM dd hh:mm:ss">
		<description>
			<localized_desc language="en">
			MMM matches the name of the month (Jan, Feb, Mar, etc...)
			dd matches the number of the day (1, 2, 3, etc...)
			hh:mm:ss matches the time (23:54:42)
			</localized_desc>
		</description>
		<code>
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
          'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']   
now = datetime.now()
currentyear = now.year
# Following line may throw a lot of ValueError
newdate = datetime(currentyear,
                   MONTHS.index(value[0:3]) + 1,
                   int(value[4:6]),
                   int(value[7:9]),
                   int(value[10:12]),
                   int(value[13:15]))
if newdate > datetime.today():
	newdate = newdate.replace(year = newdate.year - 1)

log['date'] = newdate
		</code>
	</callback>
	<callback name="MMM dd YYYY hh:mm:ss">
		<description>
			<localized_desc language="en">
			MMM matches the name of the month (Jan, Feb, Mar, etc...)
			dd matches the number of the day (1, 2, 3, etc...)
			hh:mm:ss matches the time (23:54:42)
			YYYY matches the year (2012)
			</localized_desc>
		</description>
		<code>
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
          'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']   
# Following line may throw a lot of ValueError
newdate = datetime(int(value[7:11]),
                   MONTHS.index(value[0:3]) + 1,
                   int(value[4:6]),
                   int(value[12:14]),
                   int(value[15:17]),
                   int(value[18:20]))
log['date'] = newdate
		</code>
	</callback>
	<callBack name="DDD MMM dd hh:mm:ss YYYY">
		<description>
			<localized_desc language="en">
			DDD matches the name of the day (Mon, Tue, Wed, etc...)
			MMM matches the name of the month (Jan, Feb, Mar, etc...)
			dd matches the number of the day (1, 2, 3, etc...)
			hh:mm:ss matches the time (23:54:42)
			YYYY matches the year (2012)
			</localized_desc>
		</description>
		<code>
reg = re.compile(u'(?P&lt;month&gt;[A-Z]{1}[a-z]{2}) (?P&lt;day&gt;\d{1,2}) (?P&lt;hours&gt;\d{2}):(?P&lt;minutes&gt;\d{2}):(?P&lt;seconds&gt;\d{2}) (?P&lt;year&gt;\d{4})')

month = {'Jan' : 1, 
     'Feb' : 2, 
     'Mar' : 3, 
     'Apr' : 4, 
     'May' : 5, 
     'Jun' : 6, 
     'Jul' : 7, 
     'Aug' : 8, 
     'Sep' : 9, 
     'Oct' : 10, 
     'Nov' : 11, 
     'Dec' : 12}

date = reg.search(value).groupdict()

year = int(date.get('year'))
month = month.get(date.get('month', None), None)
day = int(date.get('day'))
hours = int(date.get('hours'))
minutes = int(date.get('minutes'))
seconds = int(date.get('seconds'))

newdate = datetime(year, month, day, hours, minutes, seconds)

log['date'] = newdate
		</code>
	</callBack>
	<callBack name="YYYY-MM-DD hh:mm:ss">
		<description>
			<localized_desc language="en">
			YYYY matches the year (2012)
			MM matches the number of the month (01, 02, 03 etc...)
			DD matches the number of the day (01, 02, 03, etc...)
			hh:mm:ss matches the time (23:54:42)
			</localized_desc>
		</description>
		<code>
reg = re.compile('(?P&lt;year&gt;\d{4})-(?P&lt;month&gt;\d{2})-(?P&lt;day&gt;\d{2}) (?P&lt;hours&gt;\d{2}):(?P&lt;minutes&gt;\d{2}):(?P&lt;seconds&gt;\d{2})')

date = reg.search(value).groupdict()

year= int(date.get('year'))
month = int(date.get('month'))
day = int(date.get('day'))
hours = int(date.get('hours'))
minutes = int(date.get('minutes'))
seconds = int(date.get('seconds'))

newdate = datetime(year, month, day, hours, minutes, seconds)

log['date'] = newdate
		</code>
	</callBack>
    <callback name="MM/DD/YY, hh:mm:ss">
		<description>
			<localized_desc language="en">
			MM matches the number of the month (01, 02, 03 etc...)
			DD matches the number of the day (01, 02, 03, etc...)
			YY matches the year (12)
			hh:mm:ss matches the time (23:54:42)
			The year is set arbitrarily in the XXIst century.
			</localized_desc>
		</description>
		<code>
reg = re.compile('(?P&lt;month&gt;\d{2})/(?P&lt;day&gt;\d{2})/(?P&lt;year&gt;\d{2}), (?P&lt;hours&gt;\d{1,2}):(?P&lt;minutes&gt;\d{2}):(?P&lt;seconds&gt;\d{2})')

date = reg.search(value)

date = date.groupdict()

year= int(date.get('year'))
month = int(date.get('month'))
day = int(date.get('day'))
hours = int(date.get('hours'))
minutes = int(date.get('minutes'))
seconds = int(date.get('seconds'))

newdate = datetime(2000 + year, month, day, hours, minutes, seconds)

log['date'] = newdate
		</code>
	</callback>
	<callback name="YYMMDD hh:mm:ss">
		<description>
			<localized_desc language="en">
			YY matches the year (12)
			MM matches the number of the month (01, 02, 03 etc...)
			DD matches the number of the day (01, 02, 03, etc...)
			hh:mm:ss matches the time (23:54:42)
			</localized_desc>
		</description>
		<code>
reg = re.compile('(?P&lt;year&gt;[0-9]{2})(?P&lt;month&gt;[0-9]{2})(?P&lt;day&gt;[0-9]{2}) (?P&lt;hours&gt;(?:[0-9]{2}| [0-9])):(?P&lt;minutes&gt;[0-9]{2}):(?P&lt;seconds&gt;[0-9]{2})')

date = reg.search(value)
date = date.groupdict()

year= int(date.get('year'))
month = int(date.get('month'))
day = int(date.get('day'))
hours = int(date.get('hours'))
minutes = int(date.get('minutes'))
seconds = int(date.get('seconds'))

newdate = datetime(2000 + year, month, day, hours, minutes, seconds)

log["date"] = newdate
		</code>
	</callback>
	<callback name="ISO8601">
	    <description>
	        <localized_desc language="en">
Converts a combined date and time in UTC expressed according to the ISO 8601 
standard. Also commonly referred to as "Zulu Time".
Precision can be up to the millisecond.
            </localized_desc>
	    </description>
	    <code>
r = re.compile("""
(?P&lt;year&gt;\d{4})-
(?P&lt;month&gt;\d{2})-
(?P&lt;day&gt;\d{2})
T(?P&lt;hour&gt;\d{2}):
(?P&lt;minute&gt;\d{2}):
(?:(?P&lt;second&gt;\d{2})
(?:\.(?P&lt;microsecond&gt;\d{3}))?)?Z""", re.VERBOSE)
m = r.match(value).groupdict()
m = dict( [ (u, v and int(v) or 0) for u,v in m.items() ] )
m['microsecond'] = m['microsecond'] * 1000
log['date'] = datetime(**m)
	    </code>
	</callback>
	<callback name="EPOCH">
	    <description>
	        <localized_desc language="en">
Converts an EPOCH timestamp to a human-readable date.
	        </localized_desc>
	    </description>
	    <code>
log['date'] = datetime.utcfromtimestamp(float(value))
	    </code>
	</callback>
	<callback name="dd-MMM-YYYY hh:mm:ss">
	    <description>
	        <localized_desc language="en">
Converts a date as in 28-Feb-2010 23:15:54 . This format is used in BIND9 logs among others.
Precision can be up to the millisecond.
	        </localized_desc>
	    </description>
        <code>
MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
          'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
r = re.compile('(?P&lt;day&gt;\d+)-(?P&lt;month&gt;\w+)-(?P&lt;year&gt;\d{4}) (?P&lt;hour&gt;\d+):(?P&lt;minute&gt;\d+):(?P&lt;second&gt;\d+)(?:\.(?P&lt;microsecond&gt;\d+))?')
m = r.match(value).groupdict()
m['month'] = MONTHS.index(m['month']) + 1
m = dict( [ (u, v and int(v) or 0) for u,v in m.items() ] )
m['microsecond'] = m['microsecond'] * 1000
log['date'] = datetime(**m)
        </code>
	</callback>
</callBacks>