You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Yunkai Zhang (JIRA)" <ji...@apache.org> on 2013/11/18 09:39:21 UTC

[jira] [Created] (TS-2364) Introduce slice notation to field syntax in log format

Yunkai Zhang created TS-2364:
--------------------------------

             Summary: Introduce slice notation to field syntax in log format
                 Key: TS-2364
                 URL: https://issues.apache.org/jira/browse/TS-2364
             Project: Traffic Server
          Issue Type: Improvement
          Components: Logging
            Reporter: Yunkai Zhang


Now, we have two kind of field syntax in log format:
{code}
(1) simple; example %<cqu>
(2) container field, which is a field within a container (such as an http header or an Inktomi stat).  Fields of this type have  the syntax: '%<{field}container>'.  See documentation for valid container names.
{code}

I'm going to introduce slice notation, so that we can easy to limit the length of filed's output. With slice notation, the filed syntax will looks like:
{code}
'%<{field}container[start:end]>'
{code}

But with one limitation: slice notation makes sense only when the container is string type. 

We can see the syntax of slice notation from Python, Golang, it's pretty simple:
{code}
a[start:end] # items start through end-1
a[start:]       # items start through the rest of the array
a[:end]        # items from the beginning through end-1
a[:]              # the whole array
{code}

For example, '%<cqh[0:30]>' means the first 30 characters of <cqh>.



--
This message was sent by Atlassian JIRA
(v6.1#6144)