Repository: fluent/fluent-bit (C)

Issue:
Record Accessor not recognize key that contains special characters
## Bug Report

**Describe the bug**
Record Accessor not recognize key that contains special characters, e.g. `logging.googleapis.com/severity`
https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/record-accessor

**To Reproduce**
fluentbit.conf
```
[INPUT]
    name   tail
    path   lines
    Read_from_Head true
[FILTER]
    name   modify
    add    logging.googleapis.com/severity INFO
    match  *
[FILTER]
    name     grep
    match    *
    exclude  logging.googleapis.com/severity INFO
[OUTPUT]
    name   stdout
    match  *
```
file: lines
```
bar
app
"wo":"ccc"
```
$ ./fluent-bit --config fluentbit.conf -v


**Additional context**
We try to exclude logs e.g. if the severity is info.



Discussion:
Reopen this issue since the patch #4619 caused regression and the patch was reverted by #4935.
I am facing a similar issue with the record accessor selecting a key with `@` character (@timestamp in this case). Are there any known workarounds currently?
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the `exempt-stale` label.
We use fluentbit v1.9.3  the issue doesn't appear there.
Please reopen.
Slash or dots are still not working, and related test disabled:
https://github.com/mgeriesa/fluent-bit/blob/master/tests/internal/record_accessor.c#L1640

```
[FILTER]
    Name                rewrite_tag
    Match               kube.*
    Rule                $kubernetes['labels']['app.kubernetes.io/name'] . sometag false
    Emitter_Name        re_emitted
```

and record accessors with `@` doesn't work too.
cc: @edsiper 
Same here. Record accessor is not recognizing `$fluentbit.es-index`

```
[OUTPUT]
    Name                opensearch
    Host                opensearch
    Index               $fluentbit.es-index
```



Patch:
diff --git a/src/flb_record_accessor.c b/src/flb_record_accessor.c
index d643b4ee514..50d868595bf 100644
--- a/src/flb_record_accessor.c
+++ b/src/flb_record_accessor.c
@@ -182,7 +182,7 @@ static int ra_parse_buffer(struct flb_record_accessor *ra, flb_sds_t buf)
                 /* ignore '.' if it is inside a string/subkey */
                 continue;
             }
-            else if (buf[end] == '.' || buf[end] == ' ' || buf[end] == ',' || buf[end] == '"') {
+            else if (buf[end] == ' ' || buf[end] == ',' || buf[end] == '"') {
                 break;
             }
         }
diff --git a/src/record_accessor/ra.l b/src/record_accessor/ra.l
index 035dcab1d16..b35d6bd26d2 100644
--- a/src/record_accessor/ra.l
+++ b/src/record_accessor/ra.l
@@ -53,7 +53,7 @@ static inline char *remove_dup_quotes(const char *s, size_t n)
 
 [1-9][0-9]*|0            { yylval->integer = atoi(yytext);  return INTEGER; }
 \'([^']|'{2})*\'           { yylval->string = remove_dup_quotes(yytext + 1, yyleng - 2); return STRING; }
-[_A-Za-z][A-Za-z0-9_.-]*	   { yylval->string = flb_strdup(yytext); return IDENTIFIER; }
+[_A-Za-z][A-Za-z0-9_.\-/]*	   { yylval->string = flb_strdup(yytext); return IDENTIFIER; }
 
 "$"                     |
 "["                     |


Test patch:
diff --git a/tests/internal/record_accessor.c b/tests/internal/record_accessor.c
index 72f3d6ff999..b3296b2ff3f 100644
--- a/tests/internal/record_accessor.c
+++ b/tests/internal/record_accessor.c
@@ -469,9 +469,74 @@ void cb_dash_key()
     msgpack_unpacked_destroy(&result);
 }
 
+void cb_dot_and_slash_key()
+{
+    int len;
+    int ret;
+    int type;
+    size_t off = 0;
+    char *out_buf;
+    size_t out_size;
+    char *json;
+    char *fmt;
+    char *fmt_out;
+    flb_sds_t str;
+    msgpack_unpacked result;
+    msgpack_object map;
+    struct flb_record_accessor *ra;
+
+    /* Sample JSON message */
+    json = "{\"root.with/symbols\": \"something\"}";
+
+    /* Convert to msgpack */
+    len = strlen(json);
+    ret = flb_pack_json(json, len, &out_buf, &out_size, &type);
+    TEST_CHECK(ret == 0);
+    if (ret == -1) {
+        exit(EXIT_FAILURE);
+    }
+
+    /* Formatter */
+    fmt = flb_sds_create("$root.with/symbols");
+    if (!TEST_CHECK(fmt != NULL)) {
+        exit(EXIT_FAILURE);
+    }
+
+    fmt_out = "something";
+
+    ra = flb_ra_create(fmt, FLB_FALSE);
+    TEST_CHECK(ra != NULL);
+    if (!ra) {
+        exit(EXIT_FAILURE);
+    }
+
+    /* Unpack msgpack object */
+    msgpack_unpacked_init(&result);
+    msgpack_unpack_next(&result, out_buf, out_size, &off);
+    map = result.data;
+
+    /* Do translation */
+    str = flb_ra_translate(ra, NULL, -1, map, NULL);
+    TEST_CHECK(str != NULL);
+    if (!str) {
+        exit(EXIT_FAILURE);
+    }
+
+    TEST_CHECK(flb_sds_len(str) == strlen(fmt_out));
+    TEST_CHECK(memcmp(str, fmt_out, strlen(fmt_out)) == 0);
+    printf("== input ==\n%s\n== output ==\n%s\n", str, fmt_out);
+
+    flb_sds_destroy(str);
+    flb_sds_destroy(fmt);
+    flb_ra_destroy(ra);
+    flb_free(out_buf);
+    msgpack_unpacked_destroy(&result);
+}
+
 TEST_LIST = {
     { "keys"         , cb_keys},
     { "dash_key"     , cb_dash_key},
+    { "dot_slash_key", cb_dot_and_slash_key},
     { "translate"    , cb_translate},
     { "translate_tag", cb_translate_tag},
     { "dots_subkeys" , cb_dots_subkeys},