Script Log Parser
Parse incoming logs with script defined in Starlark configuration language
Last updated
Was this helpful?
Was this helpful?
parser:
script:
function: |
def parse(log):
event = json.decode(log)
if event['actor']['email'].endswith('@panther.com'):
event['is_panther_employee'] = True
else:
event['is_panther_employee'] = False
return eventdef parse(log):
event = json.decode(log)
if event['actor']['email'].endswith('@panther.com'):
event['is_panther_employee'] = True
else:
event['is_panther_employee'] = False
return event127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326def parse(log):
fields = log.split(" ")
return {
'remote_ip': fields[0],
'identity': fields[1],
'user': fields[2],
'timestamp': ' '.join(fields[3:5]).strip('[]'),
'request_uri': ' '.join(fields[5:8]).strip('"'),
"status": int(fields[8]),
"bytes_sent": int(fields[9])
}fields:
- name: remote_ip
type: string
indicators:
- ip
- name: identity
type: string
- name: user
type: string
- name: timestamp
type: timestamp
isEventTime: true
timeFormats:
- '%d/%b/%Y:%H:%M:%S %z'
- name: method
type: string
- name: request_uri
type: string
- name: protocol
type: string
- name: status
type: int
- name: bytes_sent
type: bigint{
"bytes_sent":2326,
"identity": "-",
"method":"GET",
"protocol":"HTTP/1.0",
"remote_ip":"127.0.0.1",
"request_uri":"/apache_pb.gif",
"status":200,
"timestamp":"2000-10-10 20:55:36.000000000",
"user":"frank"
}